Skip to content

Instantly share code, notes, and snippets.

@phiggins
Created January 19, 2014 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phiggins/8511474 to your computer and use it in GitHub Desktop.
Save phiggins/8511474 to your computer and use it in GitHub Desktop.
require 'spec_helper'
describe User do
it "should blow up" do
expect(User).to receive(:create!).and_raise(ActiveRecord::RecordNotUnique)
end
end
=begin
Fails with:
$ rspec spec/models/user_spec.rb
F
Failures:
1) User should blow up
Failure/Error: expect(User).to receive(:create!).and_raise(ActiveRecord::RecordNotUnique)
ArgumentError:
wrong number of arguments (0 for 2)
# ./spec/models/user_spec.rb:5:in `block (2 levels) in <top (required)>'
Finished in 0.00639 seconds
1 example, 1 failure
Failed examples:
rspec ./spec/models/user_spec.rb:4 # User should blow up
Randomized with seed 58760
=end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment