Skip to content

Instantly share code, notes, and snippets.

@daveworth
Created April 9, 2012 12:21
Show Gist options
  • Select an option

  • Save daveworth/2343114 to your computer and use it in GitHub Desktop.

Select an option

Save daveworth/2343114 to your computer and use it in GitHub Desktop.
Querying our object's state using RSpec2 instead of a debugger
describe RailsyObject do
describe "predicates" do
before do
@railsy_obj = FactoryGirl.create(:railsy_object)
end
describe "#compound?" do
it "should pass for the default object from FactoryGirl" do
@railsy_obj.should be_simple
@railsy_obj.should be_clean
@railsy_obj.should be_complicated
@railsy_obj.should be_compound
end
end
end
end
$ bundle exec rspec spec
F
Failures:
1) RailsyObject predicates#compound? should pass for the default object from FactoryGirl
Failure/Error: @railsy_obj.should be_simple
expected simple? to return true, got false
# ./spec/models/railsy_object_spec.rb:12:in `block (4 levels) in <top (required)>'
Finished in 0.01648 seconds
1 example, 1 failure
Failed examples:
rspec ./spec/models/railsy_object_spec.rb:11 # RailsyObject predicates#compound? should pass for the default object from FactoryGirl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment