Created
September 26, 2011 13:45
-
-
Save yfeldblum/1242262 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FF | |
Failures: | |
1) Widget the object itself attributes | |
Failure/Error: its(:attributes) { should_not include("level") } | |
expected {"_id"=>BSON::ObjectId('4e8081eeb2bc073bf9000001'), "level"=>nil} not to include "level" | |
Diff: | |
@@ -1,2 +1,2 @@ | |
-level | |
+{"_id"=>BSON::ObjectId('4e8081eeb2bc073bf9000001'), "level"=>nil} | |
# ./spec/models/widget_spec.rb:23:in `block (3 levels) in <top (required)>' | |
2) Widget query by exists | |
Failure/Error: it { should be_empty } | |
expected empty? to return true, got false | |
# ./spec/models/widget_spec.rb:28:in `block (3 levels) in <top (required)>' | |
Finished in 0.02767 seconds | |
2 examples, 2 failures | |
Failed examples: | |
rspec ./spec/models/widget_spec.rb:23 # Widget the object itself attributes | |
rspec ./spec/models/widget_spec.rb:28 # Widget query by exists |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "spec_helper" | |
class Widget | |
include Mongoid::Document | |
end | |
describe Widget do | |
let(:widget) { Widget.create! } | |
before do | |
widget.write_attribute(:level, 3) | |
widget.save! | |
widget.reload | |
widget.remove_attribute(:level) | |
widget.save! | |
widget.reload | |
end | |
context "the object itself" do | |
subject { widget } | |
its(:attributes) { should_not include("level") } | |
end | |
context "query by exists" do | |
subject { Widget.where(:level => {"$exists"=>true}) } | |
it { should be_empty } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment