thirteen-tien-len/spec/views/tokens/index.html.haml_spec.rb

39 lines
1.1 KiB
Ruby

require 'rails_helper'
RSpec.describe "tokens/index", type: :view do
before(:each) do
assign(:tokens, [
Token.create!(
canister_id: "Canister",
standard: 2,
symbol: "Symbol",
name: "Name",
total_supply: "",
decimals: 3,
transfer_fee: ""
),
Token.create!(
canister_id: "Canister",
standard: 2,
symbol: "Symbol",
name: "Name",
total_supply: "",
decimals: 3,
transfer_fee: ""
)
])
end
it "renders a list of tokens" do
render
cell_selector = Rails::VERSION::STRING >= '7' ? 'div>p' : 'tr>td'
assert_select cell_selector, text: Regexp.new("Canister".to_s), count: 2
assert_select cell_selector, text: Regexp.new(2.to_s), count: 2
assert_select cell_selector, text: Regexp.new("Symbol".to_s), count: 2
assert_select cell_selector, text: Regexp.new("Name".to_s), count: 2
assert_select cell_selector, text: Regexp.new("".to_s), count: 2
assert_select cell_selector, text: Regexp.new(3.to_s), count: 2
assert_select cell_selector, text: Regexp.new("".to_s), count: 2
end
end