Skip to content

Commit

Permalink
Revert "Fix spec failures for rspec 2.11"
Browse files Browse the repository at this point in the history
- RSpec 2.11.1 fixed the issue in question - the specs can go back to
  how they were before.
  • Loading branch information
durran committed Jul 8, 2012
1 parent 500b030 commit e7f33a0
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion mongoid.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |s|
s.add_dependency("origin", ["~> 1.0.3"])

s.add_development_dependency("mocha", ["= 0.11"])
s.add_development_dependency("rspec", ["~> 2.11"])
s.add_development_dependency("rspec", ["~> 2.10"])
s.add_development_dependency("guard", ["= 1.2.1"])
s.add_development_dependency("guard-rspec", ["~> 0.7"])

Expand Down
10 changes: 5 additions & 5 deletions spec/mongoid/paranoia_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
end

it "soft deletes the document" do
raw["deleted_at"].should_not be_nil
raw["deleted_at"].should be_within(1).of(Time.now)
end

it "does not return the document in a find" do
Expand Down Expand Up @@ -145,7 +145,7 @@
end

it "soft deletes the document" do
raw["paranoid_phones"].first["deleted_at"].should_not be_nil
raw["paranoid_phones"].first["deleted_at"].should be_within(1).of(Time.now)
end

it "does not return the document in a find" do
Expand Down Expand Up @@ -337,7 +337,7 @@
end

it "soft deletes the document" do
raw["deleted_at"].should_not be_nil
raw["deleted_at"].should be_within(1).of(Time.now)
end

it "does not return the document in a find" do
Expand Down Expand Up @@ -374,7 +374,7 @@
end

it "soft deletes the document" do
raw["paranoid_phones"].first["deleted_at"].should_not be_nil
raw["paranoid_phones"].first["deleted_at"].should be_within(1).of(Time.now)
end

it "does not return the document in a find" do
Expand Down Expand Up @@ -502,7 +502,7 @@
end

it "persists the change" do
post.reload.deleted_at.to_i.should be_within(5).of(time.to_i)
post.reload.deleted_at.should be_within(1).of(time)
end
end

Expand Down
24 changes: 12 additions & 12 deletions spec/mongoid/persistence_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -639,11 +639,11 @@
end

it "updates the updated_at timestamp" do
label.updated_at.to_i.should be_within(10).of(Time.now.to_i)
label.updated_at.should be_within(1).of(Time.now)
end

it "persists the changes" do
label.reload.updated_at.to_i.should be_within(10).of(Time.now.to_i)
label.reload.updated_at.should be_within(1).of(Time.now)
end
end

Expand Down Expand Up @@ -677,11 +677,11 @@
end

it "sets the attribute to the current time" do
person.lunch_time.to_i.should be_within(5).of(Time.now.to_i)
person.lunch_time.should be_within(5).of(Time.now)
end

it "persists the change" do
person.reload.lunch_time.to_i.should be_within(5).of(Time.now.to_i)
person.reload.lunch_time.should be_within(5).of(Time.now)
end

it "returns true" do
Expand All @@ -703,11 +703,11 @@
end

it "sets the updated at to the current time" do
agent.updated_at.to_i.should be_within(5).of(Time.now.to_i)
agent.updated_at.should be_within(5).of(Time.now)
end

it "persists the change" do
agent.reload.updated_at.to_i.should be_within(5).of(Time.now.to_i)
agent.reload.updated_at.should be_within(5).of(Time.now)
end

it "returns true" do
Expand All @@ -726,23 +726,23 @@
end

it "sets the updated at to the current time" do
agent.updated_at.to_i.should be_within(5).of(Time.now.to_i)
agent.updated_at.should be_within(5).of(Time.now)
end

it "sets the attribute to the current time" do
agent.dob.to_i.should be_within(5).of(Time.now.to_i)
agent.dob.should be_within(5).of(Time.now)
end

it "sets both attributes to the exact same time" do
agent.updated_at.should eq(agent.dob)
end

it "persists the updated at change" do
agent.reload.updated_at.to_i.should be_within(5).of(Time.now.to_i)
agent.reload.updated_at.should be_within(5).of(Time.now)
end

it "persists the attribute change" do
agent.reload.dob.to_i.should be_within(5).of(Time.now.to_i)
agent.reload.dob.should be_within(5).of(Time.now)
end

it "returns true" do
Expand Down Expand Up @@ -789,11 +789,11 @@
end

it "sets the parent updated at to the current time" do
agency.updated_at.to_i.should be_within(5).of(Time.now.to_i)
agency.updated_at.should be_within(5).of(Time.now)
end

it "persists the change" do
agency.reload.updated_at.to_i.should be_within(5).of(Time.now.to_i)
agency.reload.updated_at.should be_within(5).of(Time.now)
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/mongoid/timestamps/created_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
end

it "forces the created_at timestamps to UTC" do
quiz.created_at.to_i.should be_within(10).of(Time.now.utc.to_i)
quiz.created_at.should be_within(10).of(Time.now.utc)
end
end

Expand All @@ -38,7 +38,7 @@

it "runs the created callbacks" do
quiz.created_at.should_not be_nil
quiz.created_at.to_i.should be_within(10).of(Time.now.utc.to_i)
quiz.created_at.should be_within(10).of(Time.now.utc)
end
end
end
4 changes: 2 additions & 2 deletions spec/mongoid/timestamps/updated_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
end

it "forces the updated_at timestamps to UTC" do
agent.updated_at.to_i.should be_within(10).of(Time.now.utc.to_i)
agent.updated_at.should be_within(10).of(Time.now.utc)
end

it "includes a record_timestamps class_accessor to ease AR compatibility" do
Expand Down Expand Up @@ -80,7 +80,7 @@

it "runs the update callbacks" do
agent.updated_at.should_not be_nil
agent.updated_at.to_i.should be_within(10).of(Time.now.utc.to_i)
agent.updated_at.should be_within(10).of(Time.now.utc)
end
end
end
8 changes: 4 additions & 4 deletions spec/mongoid/timestamps_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
end

it "forces the created_at timestamps to UTC" do
document.created_at.to_i.should be_within(10).of(Time.now.utc.to_i)
document.created_at.should be_within(10).of(Time.now.utc)
end

it "forces the updated_at timestamps to UTC" do
document.updated_at.to_i.should be_within(10).of(Time.now.utc.to_i)
document.updated_at.should be_within(10).of(Time.now.utc)
end

it "ensures created_at equals updated_at on new records" do
document.updated_at.to_i.should eq(document.created_at.to_i)
document.updated_at.should eq(document.created_at)
end

it "includes a record_timestamps class_accessor to ease AR compatibility" do
Expand Down Expand Up @@ -106,7 +106,7 @@
end

it "updates the root document updated at" do
document.updated_at.to_i.should be_within(1).of(Time.now.to_i)
document.updated_at.should be_within(1).of(Time.now)
end
end
end

0 comments on commit e7f33a0

Please sign in to comment.