NoMethodError: undefined method `key?' for "product :ruby cart :one":String

Hi, I am going through the Agile web development with rails 4th edition and am getting this error. It seems to be related to the fixtures (my guess) and all the tests are failing. Can someone point me in the right direction to understand what I did wrong here? Here is the first failure in the test:unit (they all fail)

1) Error: test_the_truth(CartTest): NoMethodError: undefined method `key?' for "product :ruby cart :one":String     /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/fixtures.rb:589:in `block (2 levels) in insert_fixtures'     /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/fixtures.rb:588:in `each'     /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/fixtures.rb:588:in `block in insert_fixtures'     /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/fixtures.rb:582:in `each'     /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/fixtures.rb:582:in `insert_fixtures'     /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/fixtures.rb:526:in `block (4 levels) in create_fixtures'     /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/fixtures.rb:526:in `each'     /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/fixtures.rb:526:in `block (3 levels) in create_fixtures'     /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/connection_adapters/abstract/database_statements.rb: 139:in `transaction'     /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/fixtures.rb:524:in `block (2 levels) in create_fixtures'     /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/connection_adapters/abstract_adapter.rb:109:in `disable_referential_integrity'     /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/fixtures.rb:515:in `block in create_fixtures'     /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/ lib/active_support/benchmarkable.rb:55:in `silence'     /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/fixtures.rb:514:in `create_fixtures'     /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/fixtures.rb:973:in `load_fixtures'     /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/fixtures.rb:938:in `setup_fixtures'     /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/ lib/active_support/callbacks.rb:415:in `_run_setup_callbacks'     /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/ lib/active_support/testing/setup_and_teardown.rb:34:in `run'

Hi, I am going through the Agile web development with rails 4th edition and am getting this error. It seems to be related to the fixtures (my guess) and all the tests are failing. Can someone point me in the right direction to understand what I did wrong here? Here is the first failure in the test:unit (they all fail)

1) Error: test_the_truth(CartTest): NoMethodError: undefined method `key?' for "product :ruby cart :one":String

I don't know the answer, but in your situation I would start by moving away all my fixtures files. If that removes this problem (your tests will then fail as there is no data of course) put them back until you find the one that is causing the problem (if in fact it is one of the fixtures files).

Colin