require 'rails_helper'

RSpec.describe "tokens/new", type: :view do
  before(:each) do
    assign(:token, Token.new(
      canister_id: "MyString",
      standard: 1,
      symbol: "MyString",
      name: "MyString",
      total_supply: "",
      decimals: 1,
      transfer_fee: ""
    ))
  end

  it "renders new token form" do
    render

    assert_select "form[action=?][method=?]", tokens_path, "post" do

      assert_select "input[name=?]", "token[canister_id]"

      assert_select "input[name=?]", "token[standard]"

      assert_select "input[name=?]", "token[symbol]"

      assert_select "input[name=?]", "token[name]"

      assert_select "input[name=?]", "token[total_supply]"

      assert_select "input[name=?]", "token[decimals]"

      assert_select "input[name=?]", "token[transfer_fee]"
    end
  end
end
