Moving Default Data: undefined method 'merge' for nil:NilClass

168 views
Skip to first unread message

Michael Stamps

unread,
Jun 17, 2013, 2:12:52 PM6/17/13
to cucumber-...@googlegroups.com
Making my way through the book, I get to the 'Moving our default data' section and got an error.  After banging on it for a while, I decided I got something wrong somewhere that I was not able to find, so I started over completely.  Then it happened again.

I created the config/data folder, the new default.yml file with the listed values.  I ran the "Adopting a puppy using all default data" scenario and am met with an error:

NoMethodError: undefined method `merge' for nil:NilClass
./features/support/pages/checkout_page.rb:19:in `checkout'
./features/step_definitions/adopting_puppies_steps.rb:50:in `/^I complete the adoption$/'
C:\Ruby\workspace\test_puppies\features\adopting_puppies.feature:89:in `And I complete the adoption'

checkout_page.rb lines 18-21:
  def checkout(data ={})
    populate_page_with data_for(:checkout_page, data)
    place_order
  end

adopting_puppies_steps.rb 49-51:
When(/^I complete the adoption$/) do
  on(CheckoutPage).checkout
end

  Scenario: Adopting a puppy using all default data
    When I click the View Details button for "Brook"
    And I click the Adopt Me button
    And I click the Complete the Adoption button
    And I complete the adoption
    Then I should see "Thank you for adopting a puppy!"

default.yml contents:
checkout_page:
name: Cheezy
address: 123 Main Street
pay_type: Check

More info available on request

Michael Stamps

unread,
Jun 17, 2013, 3:14:50 PM6/17/13
to cucumber-...@googlegroups.com
Today I learned to indent my yml contents properly.

Thanks!

Sanjay Hiremath

unread,
Jun 24, 2013, 12:11:01 PM6/24/13
to cucumber-...@googlegroups.com
HI Michael,

After posting my query, I realised that you had gone through the same issue with the error - NoMethodError: undefined method `merge' for nil:NilClass
Can you please help me sorting it out.

Thanks,
Sanjay
Reply all
Reply to author
Forward
0 new messages