Agile Web Development with Rails 7: Test in Iteration C4 not work

@rubys

Hello everyone. I’m following the test on page 109, but it not works :frowning:
When I ran this test, it breaks on line 10 (assert_select 'h2', 'Programming Ruby 1.9'

class StoreControllerTest < ActionDispatch::IntegrationTest
  test 'should get index' do
    get store_index_url
    assert_response :success
    assert_select 'nav a', minimum: 4
    assert_select 'main ul li', 3
    assert_select 'h2', 3
    assert_select 'h2', 'Programming Ruby 1.9'
    assert_select 'div', /\$[,\d]+\.\d\d/
  end
end

The error message:

# Running:

F

Failure:
StoreControllerTest#test_should_get_index [/home/grave/workspace/personal/learning/depot/test/controllers/store_controller_test.rb:10]:
Expected: "Programming Ruby 1.9"
  Actual: "MyString".
Expected 0 to be >= 1.

and my fixture:

# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html

one:
  title: MyString
  description: MyText
  image_url: lorem.jpg
  price: 9.99

two:
  title: MyString
  description: MyText
  image_url: lorem.jpg
  price: 9.99

ruby:
  title: Programing Ruby 1.9
  description: Ruby if the fastest growing and most exciting dynamic
    language out there. If you need to get working programs
    delivered fast, you should add Ruby to your toolbox.
  price: 49.50
  image_url: ruby.jpg

I discovered the problem. a typo on fixture :clown_face:
just saw after I created the post. :frowning: