Permalink
Browse files

Get rid of all the "should"s from spec names.

Old, bad habit.
  • Loading branch information...
notahat committed Jun 19, 2011
1 parent 5afba24 commit 13d8cc6a8b4acec207b8e0867f5e7b84c055a38e
Showing with 32 additions and 30 deletions.
  1. +8 −8 spec/active_record_spec.rb
  2. +10 −8 spec/blueprint_spec.rb
  3. +2 −2 spec/exceptions_spec.rb
  4. +6 −6 spec/inheritance_spec.rb
  5. +6 −6 spec/machinable_spec.rb
View
@@ -9,7 +9,7 @@
end
context "make" do
- it "should return an unsaved object" do
+ it "returns an unsaved object" do
Post.blueprint { }
post = Post.make
post.should be_a(Post)
@@ -18,14 +18,14 @@
end
context "make!" do
- it "should make and save objects" do
+ it "makes and saves objects" do
Post.blueprint { }
post = Post.make!
post.should be_a(Post)
post.should_not be_new_record
end
- it "should raise an exception for an invalid object" do
+ it "raises an exception for an invalid object" do
User.blueprint { }
lambda {
User.make!(:username => "")
@@ -34,7 +34,7 @@
end
context "associations support" do
- it "should handle belongs_to associations" do
+ it "handles belongs_to associations" do
User.blueprint do
username { "user_#{sn}" }
end
@@ -48,7 +48,7 @@
post.author.should_not be_new_record
end
- it "should handle has_many associations" do
+ it "handles has_many associations" do
Post.blueprint do
comments(3)
end
@@ -63,7 +63,7 @@
end
end
- it "should handle habtm associations" do
+ it "handles habtm associations" do
Post.blueprint do
tags(3)
end
@@ -80,7 +80,7 @@
end
end
- it "should handle overriding associations" do
+ it "handles overriding associations" do
User.blueprint do
username { "user_#{sn}" }
end
@@ -97,7 +97,7 @@
end
context "error handling" do
- it "should raise an exception for an attribute with no value" do
+ it "raises an exception for an attribute with no value" do
User.blueprint { username }
lambda {
User.make
View
@@ -3,19 +3,19 @@
describe Machinist::Blueprint do
- it "should make an object of the given class" do
+ it "makes an object of the given class" do
blueprint = Machinist::Blueprint.new(OpenStruct) { }
blueprint.make.should be_an(OpenStruct)
end
- it "should construct an attribute in the blueprint" do
+ it "constructs an attribute from the blueprint" do
blueprint = Machinist::Blueprint.new(OpenStruct) do
name { "Fred" }
end
blueprint.make.name.should == "Fred"
end
- it "should construct an array for an attribute in the blueprint" do
+ it "constructs an array for an attribute in the blueprint" do
blueprint = Machinist::Blueprint.new(OpenStruct) do
things(3) { Object.new }
end
@@ -26,7 +26,7 @@
things.uniq.should == things
end
- it "should allow passing in attributes to override the blueprint" do
+ it "allows passing in attributes to override the blueprint" do
block_called = false
blueprint = Machinist::Blueprint.new(OpenStruct) do
name { block_called = true; "Fred" }
@@ -35,30 +35,32 @@
block_called.should be_false
end
- it "should provide a serial number within the blueprint" do
+ it "provides a serial number within the blueprint" do
blueprint = Machinist::Blueprint.new(OpenStruct) do
name { "Fred #{sn}" }
end
blueprint.make.name.should == "Fred 0001"
blueprint.make.name.should == "Fred 0002"
end
- it "should provide access to the object being constructed within the blueprint" do
+ it "provides access to the object being constructed within the blueprint" do
blueprint = Machinist::Blueprint.new(OpenStruct) do
title { "Test" }
body { object.title }
end
blueprint.make.body.should == "Test"
end
- it "should allow attribute names to be strings" do
+ it "allows attribute names to be strings" do
blueprint = Machinist::Blueprint.new(OpenStruct) do
name { "Fred" }
end
blueprint.make("name" => "Bill").name.should == "Bill"
end
- it "should work with type and id attributes" do
+ # These are normally a problem because of name clashes with the standard (but
+ # deprecated) Ruby methods. This test makes sure we work around this.
+ it "works with type and id attributes" do
klass = Class.new do
attr_accessor :id, :type
end
View
@@ -3,15 +3,15 @@
describe Machinist, "exceptions" do
describe Machinist::BlueprintCantSaveError do
- it "should present the right message" do
+ it "presents the right message" do
blueprint = Machinist::Blueprint.new(String) { }
exception = Machinist::BlueprintCantSaveError.new(blueprint)
exception.message.should == "make! is not supported by blueprints for class String"
end
end
describe Machinist::NoBlueprintError do
- it "should present the right message" do
+ it "presents the right message" do
exception = Machinist::NoBlueprintError.new(String, :master)
exception.message.should == "No master blueprint defined for class String"
end
View
@@ -21,7 +21,7 @@ class Son < Dad
describe Machinist::Blueprint do
describe "explicit inheritance" do
- it "should inherit attributes from the parent blueprint" do
+ it "inherits attributes from the parent blueprint" do
parent_blueprint = Machinist::Blueprint.new(OpenStruct) do
name { "Fred" }
age { 97 }
@@ -36,7 +36,7 @@ class Son < Dad
child.age.should == 97
end
- it "should take the serial number from the parent" do
+ it "takes the serial number from the parent" do
parent_blueprint = Machinist::Blueprint.new(OpenStruct) do
parent_serial { sn }
end
@@ -56,15 +56,15 @@ class Son < Dad
[InheritanceSpecs::Grandpa, InheritanceSpecs::Dad, InheritanceSpecs::Son].each(&:clear_blueprints!)
end
- it "should inherit blueprinted attributes from the parent class" do
+ it "inherits blueprinted attributes from the parent class" do
InheritanceSpecs::Dad.blueprint do
name { "Fred" }
end
InheritanceSpecs::Son.blueprint { }
InheritanceSpecs::Son.make.name.should == "Fred"
end
- it "should override blueprinted attributes in the child class" do
+ it "overrides blueprinted attributes in the child class" do
InheritanceSpecs::Dad.blueprint do
name { "Fred" }
end
@@ -75,7 +75,7 @@ class Son < Dad
InheritanceSpecs::Son.make.name.should == "George"
end
- it "should inherit from blueprinted attributes in ancestor class" do
+ it "inherits from blueprinted attributes in ancestor class" do
InheritanceSpecs::Grandpa.blueprint do
name { "Fred" }
end
@@ -85,7 +85,7 @@ class Son < Dad
InheritanceSpecs::Son.make.name.should == "Fred"
end
- it "should follow inheritance for named blueprints correctly" do
+ it "follows inheritance for named blueprints correctly" do
InheritanceSpecs::Dad.blueprint do
name { "John" }
age { 56 }
View
@@ -18,7 +18,7 @@ class Comment
MachinableSpecs::Post.clear_blueprints!
end
- it "should make an object" do
+ it "makes an object" do
MachinableSpecs::Post.blueprint do
title { "First Post" }
end
@@ -28,7 +28,7 @@ class Comment
post.title.should == "First Post"
end
- it "should make an object from a named blueprint" do
+ it "makes an object from a named blueprint" do
MachinableSpecs::Post.blueprint do
title { "First Post" }
body { "Woot!" }
@@ -44,7 +44,7 @@ class Comment
post.body.should == "Woot!"
end
- it "should make an array of objects" do
+ it "makes an array of objects" do
MachinableSpecs::Post.blueprint do
title { "First Post" }
end
@@ -58,7 +58,7 @@ class Comment
end
end
- it "should make array attributes from the blueprint" do
+ it "makes array attributes from the blueprint" do
MachinableSpecs::Comment.blueprint { }
MachinableSpecs::Post.blueprint do
comments(3) { MachinableSpecs::Comment.make }
@@ -72,7 +72,7 @@ class Comment
end
end
- it "should fail without a blueprint" do
+ it "fails without a blueprint" do
expect do
MachinableSpecs::Post.make
end.should raise_error(Machinist::NoBlueprintError) do |exception|
@@ -88,7 +88,7 @@ class Comment
end
end
- it "should fail when calling make! on an unsavable object" do
+ it "fails when calling make! on an unsavable object" do
MachinableSpecs::Post.blueprint { }
expect do

0 comments on commit 13d8cc6

Please sign in to comment.