Skip to content

Instantly share code, notes, and snippets.

@yfeldblum
Created September 26, 2011 13:45
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 yfeldblum/1242262 to your computer and use it in GitHub Desktop.
Save yfeldblum/1242262 to your computer and use it in GitHub Desktop.
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
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