spec/mongomodel/concerns/associations/belongs_to_spec.rb in mongomodel-0.4.6 vs spec/mongomodel/concerns/associations/belongs_to_spec.rb in mongomodel-0.4.7
- old
+ new
@@ -7,25 +7,25 @@
let(:user) { User.create! }
let(:special_user) { SpecialUser.create! }
context "when uninitialized" do
- it "should be nil" do
+ it "is nil" do
subject.user.should be_nil
end
- it "should be settable" do
+ it "is settable" do
subject.user = user
subject.user.should == user
end
- it "should not be truthy" do
+ it "is not truthy" do
subject.user.should_not be_truthy
end
describe "setting a subclass type" do
- it "should set successfully" do
+ it "sets successfully" do
subject.user = special_user
subject.user.should == special_user
end
end
end
@@ -43,30 +43,30 @@
else
before(:each) { subject.save! }
let(:reloaded) { Article.find(subject.id) }
end
- it "should access the user through the association" do
+ it "accesses the user through the association" do
reloaded.user.should == user
end
- it "should be truthy" do
+ it "is truthy" do
subject.user.should be_truthy
end
- it "should allow the user to be reloaded" do
+ it "allows the user to be reloaded" do
user = reloaded.user.target
user.should equal(reloaded.user.target)
user.should equal(reloaded.user.target)
user.should_not equal(reloaded.user(true).target)
end
describe "setting a subclass type" do
subject { Article.new(:user => special_user) }
- it "should load successfully" do
+ it "loads successfully" do
reloaded.user.should == special_user
end
end
end
end
@@ -84,27 +84,27 @@
describe "setting a different class type" do
define_class(:NonUser, Document)
let(:non_user) { NonUser.create! }
- it "should raise a AssociationTypeMismatch exception" do
+ it "raises a AssociationTypeMismatch exception" do
lambda { subject.user = non_user }.should raise_error(AssociationTypeMismatch, "expected instance of User but got NonUser")
end
end
describe "#build_user" do
let(:user) { subject.build_user(:id => '123') }
- it "should return a new unsaved user with the given attributes" do
+ it "returns a new unsaved user with the given attributes" do
user.should be_an_instance_of(User)
user.should be_a_new_record
user.id.should == '123'
end
end
describe "#create_user" do
- it "should return a new saved user with the given attributes" do
+ it "returns a new saved user with the given attributes" do
user = subject.create_user(:id => '123')
user.should be_an_instance_of(User)
user.should_not be_a_new_record
user.id.should == '123'
end
@@ -123,11 +123,11 @@
let(:non_user) { NonUser.create! }
it_should_behave_like "assigning correct class to belongs_to association"
describe "setting a different class type" do
- it "should set successfully" do
+ it "sets successfully" do
subject.user = non_user
subject.user.should == non_user
end
end
@@ -147,10 +147,10 @@
end
describe "setting a different class type" do
subject { Article.new(:user => non_user) }
- it "should load successfully" do
+ it "loads successfully" do
reloaded.user.should == non_user
end
end
end
end