Skip to content

Commit

Permalink
Change version of rspec to 3.0.0.beta2
Browse files Browse the repository at this point in the history
Change old syntax to new expect().to
  • Loading branch information
erich committed Apr 25, 2014
1 parent 9b8b772 commit 7f45aef
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 49 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ gemspec
gem "rake"
gem "mongoid", github: 'mongoid'

gem "rspec", "~> 2.11"
gem "rspec", "~> 3.0.0.beta2"
6 changes: 3 additions & 3 deletions spec/mongoid/relations/metadata_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
end

it "returns true" do
metadata.should be_versioned
expect(metadata).to be_versioned
end
end

Expand All @@ -29,7 +29,7 @@
end

it "returns false" do
metadata.should_not be_versioned
expect(metadata).to_not be_versioned
end
end

Expand All @@ -43,7 +43,7 @@
end

it "returns false" do
metadata.should_not be_versioned
expect(metadata).to_not be_versioned
end
end
end
Expand Down
90 changes: 45 additions & 45 deletions spec/mongoid/versioning_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
end

it "sets the class version max" do
WikiPage.version_max.should eq(10)
expect(WikiPage.version_max).to eq(10)
end
end

Expand All @@ -30,7 +30,7 @@
end

it "sets the class version max" do
WikiPage.version_max.should eq(10)
expect(WikiPage.version_max).to eq(10)
end
end
end
Expand All @@ -42,7 +42,7 @@
context "when the document is new" do

it "returns 1" do
WikiPage.new.version.should eq(1)
expect(WikiPage.new.version).to eq(1)
end
end

Expand All @@ -53,7 +53,7 @@
end

it "returns 1" do
page.version.should eq(1)
expect(page.version).to eq(1)
end
end

Expand All @@ -68,7 +68,7 @@
end

it "returns the number of versions" do
page.version.should eq(4)
expect(page.version).to eq(4)
end
end

Expand All @@ -85,7 +85,7 @@
end

it "returns the number of versions" do
page.version.should eq(11)
expect(page.version).to eq(11)
end
end
end
Expand All @@ -103,7 +103,7 @@
end

it "does not increment the version number" do
page.version.should eq(1)
expect(page.version).to eq(1)
end
end
end
Expand All @@ -123,7 +123,7 @@ class WikiPage
context "when the document is new" do

it "returns 1" do
WikiPage.new.version.should eq(1)
expect(WikiPage.new.version).to eq(1)
end
end

Expand All @@ -134,7 +134,7 @@ class WikiPage
end

it "returns 1" do
page.version.should eq(1)
expect(page.version).to eq(1)
end
end

Expand All @@ -149,7 +149,7 @@ class WikiPage
end

it "returns the number of versions" do
page.version.should eq(4)
expect(page.version).to eq(4)
end
end

Expand All @@ -166,7 +166,7 @@ class WikiPage
end

it "returns the number of versions" do
page.version.should eq(11)
expect(page.version).to eq(11)
end
end
end
Expand All @@ -184,7 +184,7 @@ class WikiPage
end

it "does not increment the version number" do
page.version.should eq(1)
expect(page.version).to eq(1)
end
end
end
Expand All @@ -200,7 +200,7 @@ class WikiPage
context "when the document is persisted once" do

it "returns 1" do
page.version.should eq(1)
expect(page.version).to eq(1)
end

it "does not persist to default database" do
Expand All @@ -210,7 +210,7 @@ class WikiPage
end

it "persists to specified database" do
WikiPage.with(database: "mongoid_test_alt").find_by(title: title).should_not be_nil
expect(WikiPage.with(database: "mongoid_test_alt").find_by(title: title)).to_not be_nil
end
end

Expand All @@ -221,15 +221,15 @@ class WikiPage
end

it "returns the number of versions" do
page.version.should eq(4)
expect(page.version).to eq(4)
end

it "persists to specified database" do
WikiPage.with(database: "mongoid_test_alt").find_by(:title => title).should_not be_nil
expect(WikiPage.with(database: "mongoid_test_alt").find_by(:title => title)).to_not be_nil
end

it "persists the versions to specified database" do
WikiPage.with(database: "mongoid_test_alt").find_by(:title => title).version.should eq(4)
expect(WikiPage.with(database: "mongoid_test_alt").find_by(:title => title).version).to eq(4)
end
end
end
Expand All @@ -245,7 +245,7 @@ class WikiPage

it "sets versionless to true" do
page.versionless do |doc|
doc.should be_versionless
expect(doc).to be_versionless
end
end
end
Expand All @@ -254,7 +254,7 @@ class WikiPage

it "sets versionless to false" do
page.versionless
page.should_not be_versionless
expect(page).to_not be_versionless
end
end
end
Expand All @@ -280,23 +280,23 @@ class WikiPage
end

it "creates a new version" do
version.title.should eq("1")
expect(version.title).to eq("1")
end

it "properly versions the localized fields" do
version.description.should eq("test")
expect(version.description).to eq("test")
end

it "only creates 1 new version" do
page.versions.count.should eq(1)
expect(page.versions.count).to eq(1)
end

it "does not version the _id" do
version._id.should be_nil
expect(version._id).to be_nil
end

it "does version the updated_at timestamp" do
version.updated_at.should_not be_nil
expect(version.updated_at).to_not be_nil
end

context "when only updated_at was changed" do
Expand All @@ -306,16 +306,16 @@ class WikiPage
end

it "does not generate another version" do
page.versions.count.should eq(1)
expect(page.versions.count).to eq(1)
end
end

it "does not embed versions within versions" do
version.versions.should be_empty
expect(version.versions).to be_empty
end

it "versions protected fields" do
version.author.should eq("woodchuck")
expect(version.author).to eq("woodchuck")
end

context "when saving multiple times" do
Expand All @@ -325,11 +325,11 @@ class WikiPage
end

it "does not embed versions within versions" do
version.versions.should be_empty
expect(version.versions).to be_empty
end

it "does not embed versions multiple levels deep" do
page.versions.last.versions.should be_empty
expect(page.versions.last.versions).to be_empty
end
end
end
Expand All @@ -345,7 +345,7 @@ class WikiPage
end

it "does not create a new version" do
version.should be_nil
expect(version).to be_nil
end

context "and revision is forced" do
Expand All @@ -354,11 +354,11 @@ class WikiPage
end

it "creates a new version" do
version.should_not be_nil
expect(version).to_not be_nil
end

it "page version should be valid" do
page.version.should eq(2)
it "page is valid" do
expect(page.version).to eq(2)
end
end
end
Expand All @@ -378,15 +378,15 @@ class WikiPage
end

it "only versions the maximum amount" do
versions.count.should eq(5)
expect(versions.count).to eq(5)
end

it "shifts the versions in order" do
versions.last.title.should eq("8")
expect(versions.last.title).to eq("8")
end

it "persists the version shifts" do
page.reload.versions.last.title.should eq("8")
expect(page.reload.versions.last.title).to eq("8")
end
end

Expand All @@ -409,7 +409,7 @@ class WikiPage
end

it "only versions the maximum amount" do
versions.count.should eq(5)
expect(versions.count).to eq(5)
end
end
end
Expand All @@ -421,7 +421,7 @@ class WikiPage
end

it "does not version the document" do
page.versions.count.should eq(0)
expect(page.versions.count).to eq(0)
end
end

Expand Down Expand Up @@ -451,23 +451,23 @@ class WikiPage
end

it "does not perform dependent cascading" do
from_db.should eq(comment)
expect(from_db).to eq(comment)
end

it "does not delete related orphans" do
Comment.find(orphaned.id).should eq(orphaned)
expect(Comment.find(orphaned.id)).to eq(orphaned)
end

it "deletes the version" do
page.versions.should be_empty
expect(page.versions).to be_empty
end

it "persists the deletion" do
page.reload.versions.should be_empty
expect(page.reload.versions).to be_empty
end

it "retains the root relation" do
page.reload.comments.should eq([ comment ])
expect(page.reload.comments).to eq([ comment ])
end
end
end
Expand All @@ -489,11 +489,11 @@ class WikiPage
end

it "allows the document to be added" do
page.child_pages.should eq([ child ])
expect(page.child_pages).to eq([ child ])
end

it "persists the changes" do
page.reload.child_pages.should eq([ child ])
expect(page.reload.child_pages).to eq([ child ])
end
end

Expand Down
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ class Application < Rails::Application
Mongoid::Threaded.sessions[:default].drop
end
end

config.raise_errors_for_deprecations!

# Filter out MongoHQ specs if we can't connect to it.
config.filter_run_excluding(config: ->(value){
Expand Down

0 comments on commit 7f45aef

Please sign in to comment.