Rename helper function to `create?`

pull/307/head
Tim Mecklem 7 years ago
parent 12e5da97cd
commit a90909b506
  1. 2
      apps/explorer_web/lib/explorer_web/templates/address_internal_transaction/index.html.eex
  2. 2
      apps/explorer_web/lib/explorer_web/templates/transaction_internal_transaction/index.html.eex
  3. 4
      apps/explorer_web/lib/explorer_web/views/internal_transaction_view.ex
  4. 6
      apps/explorer_web/test/explorer_web/views/internal_transaction_view_test.exs

@ -103,7 +103,7 @@
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: internal_transaction.from_address %>
</td>
<td>
<%= if ExplorerWeb.InternalTransactionView.contract?(internal_transaction) do %>
<%= if ExplorerWeb.InternalTransactionView.create?(internal_transaction) do %>
<i class="fas fa-plus-square"></i>
<%= link(
gettext("Contract Creation"),

@ -41,7 +41,7 @@
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: internal_transaction.from_address %>
</td>
<td>
<%= if ExplorerWeb.InternalTransactionView.contract?(internal_transaction) do %>
<%= if ExplorerWeb.InternalTransactionView.create?(internal_transaction) do %>
<i class="fas fa-plus-square"></i>
<%= link(
gettext("Contract Creation"),

@ -4,6 +4,6 @@ defmodule ExplorerWeb.InternalTransactionView do
alias Explorer.Chain.InternalTransaction
def contract?(%InternalTransaction{type: :create}), do: true
def contract?(_), do: false
def create?(%InternalTransaction{type: :create}), do: true
def create?(_), do: false
end

@ -3,17 +3,17 @@ defmodule ExplorerWeb.InternalTransactionViewTest do
alias ExplorerWeb.InternalTransactionView
describe "contract?/1" do
describe "create?/1" do
test "with internal transaction of type create returns true" do
internal_transaction = build(:internal_transaction_create)
assert InternalTransactionView.contract?(internal_transaction)
assert InternalTransactionView.create?(internal_transaction)
end
test "with non-create type internal transaction returns false" do
internal_transaction = build(:internal_transaction)
refute InternalTransactionView.contract?(internal_transaction)
refute InternalTransactionView.create?(internal_transaction)
end
end
end

Loading…
Cancel
Save