Skip to content

Instantly share code, notes, and snippets.

@ZenCocoon
Created February 21, 2011 20:04
Show Gist options
  • Select an option

  • Save ZenCocoon/837622 to your computer and use it in GitHub Desktop.

Select an option

Save ZenCocoon/837622 to your computer and use it in GitHub Desktop.
# Helper : app/helpers/bookings_helper.rb
module BookingsHelper
def booking_price(booking)
"something"
end
end
# Helper spec : spec/helpers/bookings_helper_spec.rb
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe BookingsHelper do
describe "#booking_price" do
helper.booking_price.should == 'something'
end
end
# Error
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/whiny_nil.rb:48:in `method_missing': undefined method `booking_price' for nil:NilClass (NoMethodError)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment