Skip to content

Instantly share code, notes, and snippets.

Created September 2, 2010 14:30
Show Gist options
  • Save anonymous/562361 to your computer and use it in GitHub Desktop.
Save anonymous/562361 to your computer and use it in GitHub Desktop.
it "should call the callback :before_add" do
@callback = mock('before_add', :call => true)
@record.class.has_and_belongs_to_many_active_resource :resourcen, :before_add => @callback
@record.resource_ids = [1]
@callback.should_receive(:call)
@record.add_resource(5)
end
TypeError in 'HasAndBelongsToManyActiveResource should call the callback :before_add'
#<Spec::Mocks::Mock:0x3fad637f2fb0 @name="before_add"> is not a symbol
/home/crolle/work/ceis_atk/trunk/app/modules/has_and_belongs_to_many_active_resource.rb:23:in `send'
/home/crolle/work/ceis_atk/trunk/app/modules/has_and_belongs_to_many_active_resource.rb:23:in `add_resource'
./spec/models/module_spec.rb:74:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment