Skip to content
This repository
Browse code

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

Old, bad habit.
  • Loading branch information...
commit 13d8cc6a8b4acec207b8e0867f5e7b84c055a38e 1 parent 5afba24
Pete Yandell authored June 19, 2011
16  spec/active_record_spec.rb
@@ -9,7 +9,7 @@
9 9
   end
10 10
 
11 11
   context "make" do
12  
-    it "should return an unsaved object" do
  12
+    it "returns an unsaved object" do
13 13
       Post.blueprint { }
14 14
       post = Post.make
15 15
       post.should be_a(Post)
@@ -18,14 +18,14 @@
18 18
   end
19 19
 
20 20
   context "make!" do
21  
-    it "should make and save objects" do
  21
+    it "makes and saves objects" do
22 22
       Post.blueprint { }
23 23
       post = Post.make!
24 24
       post.should be_a(Post)
25 25
       post.should_not be_new_record
26 26
     end
27 27
 
28  
-    it "should raise an exception for an invalid object" do
  28
+    it "raises an exception for an invalid object" do
29 29
       User.blueprint { }
30 30
       lambda {
31 31
         User.make!(:username => "")
@@ -34,7 +34,7 @@
34 34
   end
35 35
 
36 36
   context "associations support" do
37  
-    it "should handle belongs_to associations" do
  37
+    it "handles belongs_to associations" do
38 38
       User.blueprint do
39 39
         username { "user_#{sn}" }
40 40
       end
@@ -48,7 +48,7 @@
48 48
       post.author.should_not be_new_record
49 49
     end
50 50
 
51  
-    it "should handle has_many associations" do
  51
+    it "handles has_many associations" do
52 52
       Post.blueprint do
53 53
         comments(3)
54 54
       end
@@ -63,7 +63,7 @@
63 63
       end
64 64
     end
65 65
 
66  
-    it "should handle habtm associations" do
  66
+    it "handles habtm associations" do
67 67
       Post.blueprint do
68 68
         tags(3)
69 69
       end
@@ -80,7 +80,7 @@
80 80
       end
81 81
     end
82 82
 
83  
-    it "should handle overriding associations" do
  83
+    it "handles overriding associations" do
84 84
       User.blueprint do
85 85
         username { "user_#{sn}" }
86 86
       end
@@ -97,7 +97,7 @@
97 97
   end
98 98
 
99 99
   context "error handling" do
100  
-    it "should raise an exception for an attribute with no value" do
  100
+    it "raises an exception for an attribute with no value" do
101 101
       User.blueprint { username }
102 102
       lambda {
103 103
         User.make
18  spec/blueprint_spec.rb
@@ -3,19 +3,19 @@
3 3
 
4 4
 describe Machinist::Blueprint do
5 5
 
6  
-  it "should make an object of the given class" do
  6
+  it "makes an object of the given class" do
7 7
     blueprint = Machinist::Blueprint.new(OpenStruct) { }
8 8
     blueprint.make.should be_an(OpenStruct)
9 9
   end
10 10
 
11  
-  it "should construct an attribute in the blueprint" do
  11
+  it "constructs an attribute from the blueprint" do
12 12
     blueprint = Machinist::Blueprint.new(OpenStruct) do
13 13
       name { "Fred" }
14 14
     end
15 15
     blueprint.make.name.should == "Fred"
16 16
   end
17 17
 
18  
-  it "should construct an array for an attribute in the blueprint" do
  18
+  it "constructs an array for an attribute in the blueprint" do
19 19
     blueprint = Machinist::Blueprint.new(OpenStruct) do
20 20
       things(3) { Object.new }
21 21
     end
@@ -26,7 +26,7 @@
26 26
     things.uniq.should == things
27 27
   end
28 28
 
29  
-  it "should allow passing in attributes to override the blueprint" do
  29
+  it "allows passing in attributes to override the blueprint" do
30 30
     block_called = false
31 31
     blueprint = Machinist::Blueprint.new(OpenStruct) do
32 32
       name { block_called = true; "Fred" }
@@ -35,7 +35,7 @@
35 35
     block_called.should be_false
36 36
   end
37 37
 
38  
-  it "should provide a serial number within the blueprint" do
  38
+  it "provides a serial number within the blueprint" do
39 39
     blueprint = Machinist::Blueprint.new(OpenStruct) do
40 40
       name { "Fred #{sn}" }
41 41
     end
@@ -43,7 +43,7 @@
43 43
     blueprint.make.name.should == "Fred 0002"
44 44
   end
45 45
 
46  
-  it "should provide access to the object being constructed within the blueprint" do
  46
+  it "provides access to the object being constructed within the blueprint" do
47 47
     blueprint = Machinist::Blueprint.new(OpenStruct) do
48 48
       title { "Test" }
49 49
       body  { object.title }
@@ -51,14 +51,16 @@
51 51
     blueprint.make.body.should == "Test"
52 52
   end
53 53
 
54  
-  it "should allow attribute names to be strings" do
  54
+  it "allows attribute names to be strings" do
55 55
     blueprint = Machinist::Blueprint.new(OpenStruct) do
56 56
       name { "Fred" }
57 57
     end
58 58
     blueprint.make("name" => "Bill").name.should == "Bill"
59 59
   end
60 60
 
61  
-  it "should work with type and id attributes" do
  61
+  # These are normally a problem because of name clashes with the standard (but
  62
+  # deprecated) Ruby methods. This test makes sure we work around this.
  63
+  it "works with type and id attributes" do
62 64
     klass = Class.new do
63 65
       attr_accessor :id, :type
64 66
     end
4  spec/exceptions_spec.rb
@@ -3,7 +3,7 @@
3 3
 describe Machinist, "exceptions" do
4 4
 
5 5
   describe Machinist::BlueprintCantSaveError do
6  
-    it "should present the right message" do
  6
+    it "presents the right message" do
7 7
       blueprint = Machinist::Blueprint.new(String) { }
8 8
       exception = Machinist::BlueprintCantSaveError.new(blueprint)
9 9
       exception.message.should == "make! is not supported by blueprints for class String"
@@ -11,7 +11,7 @@
11 11
   end
12 12
 
13 13
   describe Machinist::NoBlueprintError do
14  
-    it "should present the right message" do
  14
+    it "presents the right message" do
15 15
       exception = Machinist::NoBlueprintError.new(String, :master)
16 16
       exception.message.should == "No master blueprint defined for class String"
17 17
     end
12  spec/inheritance_spec.rb
@@ -21,7 +21,7 @@ class Son < Dad
21 21
 describe Machinist::Blueprint do
22 22
 
23 23
   describe "explicit inheritance" do
24  
-    it "should inherit attributes from the parent blueprint" do
  24
+    it "inherits attributes from the parent blueprint" do
25 25
       parent_blueprint = Machinist::Blueprint.new(OpenStruct) do
26 26
         name { "Fred" }
27 27
         age  { 97 }
@@ -36,7 +36,7 @@ class Son < Dad
36 36
       child.age.should == 97
37 37
     end
38 38
 
39  
-    it "should take the serial number from the parent" do
  39
+    it "takes the serial number from the parent" do
40 40
       parent_blueprint = Machinist::Blueprint.new(OpenStruct) do
41 41
         parent_serial { sn }
42 42
       end
@@ -56,7 +56,7 @@ class Son < Dad
56 56
       [InheritanceSpecs::Grandpa, InheritanceSpecs::Dad, InheritanceSpecs::Son].each(&:clear_blueprints!)
57 57
     end
58 58
 
59  
-    it "should inherit blueprinted attributes from the parent class" do
  59
+    it "inherits blueprinted attributes from the parent class" do
60 60
       InheritanceSpecs::Dad.blueprint do
61 61
         name { "Fred" }
62 62
       end
@@ -64,7 +64,7 @@ class Son < Dad
64 64
       InheritanceSpecs::Son.make.name.should == "Fred"
65 65
     end
66 66
 
67  
-    it "should override blueprinted attributes in the child class" do
  67
+    it "overrides blueprinted attributes in the child class" do
68 68
       InheritanceSpecs::Dad.blueprint do
69 69
         name { "Fred" }
70 70
       end
@@ -75,7 +75,7 @@ class Son < Dad
75 75
       InheritanceSpecs::Son.make.name.should == "George"
76 76
     end
77 77
 
78  
-    it "should inherit from blueprinted attributes in ancestor class" do
  78
+    it "inherits from blueprinted attributes in ancestor class" do
79 79
       InheritanceSpecs::Grandpa.blueprint do
80 80
         name { "Fred" }
81 81
       end
@@ -85,7 +85,7 @@ class Son < Dad
85 85
       InheritanceSpecs::Son.make.name.should == "Fred"
86 86
     end
87 87
 
88  
-    it "should follow inheritance for named blueprints correctly" do
  88
+    it "follows inheritance for named blueprints correctly" do
89 89
       InheritanceSpecs::Dad.blueprint do
90 90
         name { "John" }
91 91
         age  { 56 }
12  spec/machinable_spec.rb
@@ -18,7 +18,7 @@ class Comment
18 18
     MachinableSpecs::Post.clear_blueprints!
19 19
   end
20 20
 
21  
-  it "should make an object" do
  21
+  it "makes an object" do
22 22
     MachinableSpecs::Post.blueprint do
23 23
       title { "First Post" }
24 24
     end
@@ -28,7 +28,7 @@ class Comment
28 28
     post.title.should == "First Post"
29 29
   end
30 30
 
31  
-  it "should make an object from a named blueprint" do
  31
+  it "makes an object from a named blueprint" do
32 32
     MachinableSpecs::Post.blueprint do
33 33
       title { "First Post" }
34 34
       body  { "Woot!" }
@@ -44,7 +44,7 @@ class Comment
44 44
     post.body.should == "Woot!"
45 45
   end
46 46
 
47  
-  it "should make an array of objects" do
  47
+  it "makes an array of objects" do
48 48
     MachinableSpecs::Post.blueprint do
49 49
       title { "First Post" }
50 50
     end
@@ -58,7 +58,7 @@ class Comment
58 58
     end
59 59
   end
60 60
 
61  
-  it "should make array attributes from the blueprint" do
  61
+  it "makes array attributes from the blueprint" do
62 62
     MachinableSpecs::Comment.blueprint { }
63 63
     MachinableSpecs::Post.blueprint do 
64 64
       comments(3) { MachinableSpecs::Comment.make }
@@ -72,7 +72,7 @@ class Comment
72 72
     end
73 73
   end
74 74
 
75  
-  it "should fail without a blueprint" do
  75
+  it "fails without a blueprint" do
76 76
     expect do
77 77
       MachinableSpecs::Post.make
78 78
     end.should raise_error(Machinist::NoBlueprintError) do |exception|
@@ -88,7 +88,7 @@ class Comment
88 88
     end
89 89
   end
90 90
 
91  
-  it "should fail when calling make! on an unsavable object" do
  91
+  it "fails when calling make! on an unsavable object" do
92 92
     MachinableSpecs::Post.blueprint { }
93 93
 
94 94
     expect do

0 notes on commit 13d8cc6

Please sign in to comment.
Something went wrong with that request. Please try again.