remarkable_activerecord 3.1.8 → 3.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/CHANGELOG +140 -138
  2. data/LICENSE +20 -20
  3. data/README +80 -80
  4. data/lib/remarkable_activerecord.rb +29 -29
  5. data/lib/remarkable_activerecord/base.rb +248 -237
  6. data/lib/remarkable_activerecord/describe.rb +27 -27
  7. data/lib/remarkable_activerecord/human_names.rb +36 -36
  8. data/lib/remarkable_activerecord/matchers/accept_nested_attributes_for_matcher.rb +30 -30
  9. data/lib/remarkable_activerecord/matchers/allow_mass_assignment_of_matcher.rb +59 -59
  10. data/lib/remarkable_activerecord/matchers/allow_values_for_matcher.rb +85 -94
  11. data/lib/remarkable_activerecord/matchers/association_matcher.rb +283 -283
  12. data/lib/remarkable_activerecord/matchers/have_column_matcher.rb +68 -68
  13. data/lib/remarkable_activerecord/matchers/have_default_scope_matcher.rb +38 -38
  14. data/lib/remarkable_activerecord/matchers/have_index_matcher.rb +73 -73
  15. data/lib/remarkable_activerecord/matchers/have_readonly_attributes_matcher.rb +30 -30
  16. data/lib/remarkable_activerecord/matchers/have_scope_matcher.rb +85 -85
  17. data/lib/remarkable_activerecord/matchers/validate_acceptance_of_matcher.rb +50 -50
  18. data/lib/remarkable_activerecord/matchers/validate_associated_matcher.rb +97 -97
  19. data/lib/remarkable_activerecord/matchers/validate_confirmation_of_matcher.rb +44 -44
  20. data/lib/remarkable_activerecord/matchers/validate_exclusion_of_matcher.rb +53 -53
  21. data/lib/remarkable_activerecord/matchers/validate_inclusion_of_matcher.rb +52 -52
  22. data/lib/remarkable_activerecord/matchers/validate_length_of_matcher.rb +150 -150
  23. data/lib/remarkable_activerecord/matchers/validate_numericality_of_matcher.rb +181 -181
  24. data/lib/remarkable_activerecord/matchers/validate_presence_of_matcher.rb +29 -29
  25. data/lib/remarkable_activerecord/matchers/validate_uniqueness_of_matcher.rb +233 -233
  26. data/locale/en.yml +261 -261
  27. data/spec/accept_nested_attributes_for_matcher_spec.rb +1 -1
  28. data/spec/allow_mass_assignment_of_matcher_spec.rb +90 -82
  29. data/spec/allow_values_for_matcher_spec.rb +72 -63
  30. data/spec/association_matcher_spec.rb +612 -612
  31. data/spec/describe_spec.rb +3 -3
  32. data/spec/have_column_matcher_spec.rb +73 -73
  33. data/spec/have_default_scope_matcher_spec.rb +1 -1
  34. data/spec/have_index_matcher_spec.rb +87 -87
  35. data/spec/have_readonly_attributes_matcher_spec.rb +47 -47
  36. data/spec/have_scope_matcher_spec.rb +77 -77
  37. data/spec/model_builder.rb +101 -101
  38. data/spec/rcov.opts +1 -1
  39. data/spec/spec.opts +4 -4
  40. data/spec/spec_helper.rb +27 -27
  41. data/spec/validate_acceptance_of_matcher_spec.rb +68 -68
  42. data/spec/validate_associated_matcher_spec.rb +121 -121
  43. data/spec/validate_confirmation_of_matcher_spec.rb +58 -58
  44. data/spec/validate_length_of_matcher_spec.rb +218 -218
  45. data/spec/validate_numericality_of_matcher_spec.rb +179 -179
  46. data/spec/validate_presence_of_matcher_spec.rb +56 -56
  47. data/spec/validate_uniqueness_of_matcher_spec.rb +164 -164
  48. metadata +5 -5
@@ -1,186 +1,186 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
-
3
- describe 'validate_numericality_of' do
4
- include ModelBuilder
5
-
6
- # Defines a model, create a validation and returns a raw matcher
7
- def define_and_validate(options={})
8
- @model = define_model :product, :price => :integer, :size => :integer do
9
- validates_numericality_of :price, options
10
- end
11
-
12
- validate_numericality_of(:price)
13
- end
14
-
15
- describe 'messages' do
16
- before(:each){ @matcher = define_and_validate }
17
-
18
- # To tests descriptions, we don't need to use mocks neither stubs.
19
- # We just need to define a matcher.
20
- #
21
- it 'should contain a description' do
22
- matcher = validate_numericality_of(:age)
23
- matcher.description.should == 'ensure numericality of age'
24
-
25
- matcher.allow_nil(false)
26
- matcher.description.should == 'ensure numericality of age not allowing nil values'
27
-
28
- matcher.allow_blank
29
- matcher.description.should == 'ensure numericality of age not allowing nil values and allowing blank values'
30
-
31
- matcher = validate_numericality_of(:age, :only_integer => true)
32
- matcher.description.should == 'ensure numericality of age allowing only integer values'
33
-
34
- matcher = validate_numericality_of(:age, :even => true)
35
- matcher.description.should == 'ensure numericality of age allowing only even values'
36
-
37
- matcher = validate_numericality_of(:age, :odd => true)
38
- matcher.description.should == 'ensure numericality of age allowing only odd values'
39
-
40
- matcher = validate_numericality_of(:age, :equal_to => 10)
41
- matcher.description.should == 'ensure numericality of age is equal to 10'
42
-
43
- matcher = validate_numericality_of(:age, :less_than_or_equal_to => 10)
44
- matcher.description.should == 'ensure numericality of age is less than or equal to 10'
45
-
46
- matcher = validate_numericality_of(:age, :greater_than_or_equal_to => 10)
47
- matcher.description.should == 'ensure numericality of age is greater than or equal to 10'
48
-
49
- matcher = validate_numericality_of(:age, :less_than => 10)
50
- matcher.description.should == 'ensure numericality of age is less than 10'
51
-
52
- matcher = validate_numericality_of(:age, :greater_than => 10)
53
- matcher.description.should == 'ensure numericality of age is greater than 10'
54
-
55
- matcher = validate_numericality_of(:age, :greater_than => 10, :less_than => 20)
56
- matcher.description.should == 'ensure numericality of age is greater than 10 and is less than 20'
57
- end
58
-
59
- it 'should set only_numeric_values? message' do
60
- @matcher.should_receive(:only_numeric_values?).and_return(false)
61
- @matcher.matches?(@model)
62
- @matcher.failure_message.should == 'Expected Product to allow only numeric values for price'
63
- @matcher.negative_failure_message.should == 'Did not expect Product to allow only numeric values for price'
64
- end
65
-
66
- it 'should set only_integer_values? message' do
67
- @matcher.should_receive(:only_integer?).and_return([false, { :not => '' }])
68
- @matcher.matches?(@model)
69
- @matcher.failure_message.should == 'Expected Product to allow only integer values for price'
70
- end
71
-
72
- it 'should set only_odd_values? message' do
73
- @matcher.should_receive(:only_odd?).and_return(false)
74
- @matcher.matches?(@model)
75
- @matcher.failure_message.should == 'Expected Product to allow only odd values for price'
76
- end
77
-
78
- it 'should set only_even_values? message' do
79
- @matcher.should_receive(:only_even?).and_return(false)
80
- @matcher.matches?(@model)
81
- @matcher.failure_message.should == 'Expected Product to allow only even values for price'
82
- end
83
-
84
- it 'should set equals_to? message' do
85
- @matcher.should_receive(:equals_to?).and_return([false, { :count => 10 }])
86
- @matcher.matches?(@model)
87
- @matcher.failure_message.should == 'Expected Product to be valid only when price is equal to 10'
88
- end
89
-
90
- it 'should set less_than_minimum? message' do
91
- @matcher.should_receive(:less_than_minimum?).and_return([false, { :count => 10 }])
92
- @matcher.matches?(@model)
93
- @matcher.failure_message.should == 'Expected Product to be invalid when price is less than 10'
94
- end
95
-
96
- it 'should set more_than_maximum? message' do
97
- @matcher.should_receive(:more_than_maximum?).and_return([false, { :count => 10 }])
98
- @matcher.matches?(@model)
99
- @matcher.failure_message.should == 'Expected Product to be invalid when price is greater than 10'
100
- end
101
- end
102
-
103
- describe 'matcher' do
104
- # Wrap specs without options. Usually a couple specs.
105
- describe 'without options' do
106
- before(:each){ define_and_validate }
107
-
108
- it { should validate_numericality_of(:price) }
109
- it { should_not validate_numericality_of(:size) }
110
- end
111
-
112
- # Wrap each option inside a describe group.
113
- describe 'with equal_to option' do
114
- it { should define_and_validate(:equal_to => 100).equal_to(100) }
115
- it { should_not define_and_validate(:equal_to => 100).equal_to(99) }
116
- it { should_not define_and_validate(:equal_to => 100).equal_to(101) }
117
- end
118
-
119
- describe 'with less_than option' do
120
- it { should define_and_validate(:less_than => 100).less_than(100) }
121
- it { should_not define_and_validate(:less_than => 100).less_than(99) }
122
- it { should_not define_and_validate(:less_than => 100).less_than(101) }
123
- end
124
-
125
- describe 'with greater_than option' do
126
- it { should define_and_validate(:greater_than => 100).greater_than(100) }
127
- it { should_not define_and_validate(:greater_than => 100).greater_than(99) }
128
- it { should_not define_and_validate(:greater_than => 100).greater_than(101) }
129
- end
130
-
131
- describe 'with less_than_or_equal_to option' do
132
- it { should define_and_validate(:less_than_or_equal_to => 100).less_than_or_equal_to(100) }
133
- it { should_not define_and_validate(:less_than_or_equal_to => 100).less_than_or_equal_to(99) }
134
- it { should_not define_and_validate(:less_than_or_equal_to => 100).less_than_or_equal_to(101) }
135
- end
136
-
137
- describe 'with greater_than_or_equal_to option' do
138
- it { should define_and_validate(:greater_than_or_equal_to => 100).greater_than_or_equal_to(100) }
139
- it { should_not define_and_validate(:greater_than_or_equal_to => 100).greater_than_or_equal_to(99) }
140
- it { should_not define_and_validate(:greater_than_or_equal_to => 100).greater_than_or_equal_to(101) }
141
- end
142
-
143
- describe "with even option" do
144
- it { should define_and_validate(:even => true).even }
145
- it { should_not define_and_validate.even(true) }
146
- end
147
-
148
- describe "with odd option" do
149
- it { should define_and_validate(:odd => true).odd }
150
- it { should_not define_and_validate.odd(true) }
151
- end
152
-
153
- describe "with several options" do
154
- it { should define_and_validate(:less_than => 100, :greater_than => 10).less_than(100).greater_than(10) }
155
- it { should define_and_validate(:less_than => 100, :message => 'not valid').less_than(100).message('not valid') }
156
- it { should define_and_validate(:less_than_or_equal_to => 100, :greater_than => 1).less_than_or_equal_to(100).greater_than(1) }
157
- end
158
-
159
- # A macro to spec messages
160
- create_message_specs(self)
161
-
162
- # Those are macros to test optionals which accept only boolean values
163
- create_optional_boolean_specs(:allow_nil, self)
164
- create_optional_boolean_specs(:allow_blank, self)
165
- create_optional_boolean_specs(:only_integer, self)
166
- end
167
-
168
- # In macros we include just a few tests to assure that everything works properly
169
- describe 'macros' do
170
- before(:each) { define_and_validate(:less_than => 100000, :greater_than => 9999) }
171
-
172
- should_validate_numericality_of :price
173
- should_validate_numericality_of :price, :less_than => 100000
174
- should_validate_numericality_of :price, :greater_than => 9999
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe 'validate_numericality_of' do
4
+ include ModelBuilder
5
+
6
+ # Defines a model, create a validation and returns a raw matcher
7
+ def define_and_validate(options={})
8
+ @model = define_model :product, :price => :integer, :size => :integer do
9
+ validates_numericality_of :price, options
10
+ end
11
+
12
+ validate_numericality_of(:price)
13
+ end
14
+
15
+ describe 'messages' do
16
+ before(:each){ @matcher = define_and_validate }
17
+
18
+ # To tests descriptions, we don't need to use mocks neither stubs.
19
+ # We just need to define a matcher.
20
+ #
21
+ it 'should contain a description' do
22
+ matcher = validate_numericality_of(:age)
23
+ matcher.description.should == 'ensure numericality of age'
24
+
25
+ matcher.allow_nil(false)
26
+ matcher.description.should == 'ensure numericality of age not allowing nil values'
27
+
28
+ matcher.allow_blank
29
+ matcher.description.should == 'ensure numericality of age not allowing nil values and allowing blank values'
30
+
31
+ matcher = validate_numericality_of(:age, :only_integer => true)
32
+ matcher.description.should == 'ensure numericality of age allowing only integer values'
33
+
34
+ matcher = validate_numericality_of(:age, :even => true)
35
+ matcher.description.should == 'ensure numericality of age allowing only even values'
36
+
37
+ matcher = validate_numericality_of(:age, :odd => true)
38
+ matcher.description.should == 'ensure numericality of age allowing only odd values'
39
+
40
+ matcher = validate_numericality_of(:age, :equal_to => 10)
41
+ matcher.description.should == 'ensure numericality of age is equal to 10'
42
+
43
+ matcher = validate_numericality_of(:age, :less_than_or_equal_to => 10)
44
+ matcher.description.should == 'ensure numericality of age is less than or equal to 10'
45
+
46
+ matcher = validate_numericality_of(:age, :greater_than_or_equal_to => 10)
47
+ matcher.description.should == 'ensure numericality of age is greater than or equal to 10'
48
+
49
+ matcher = validate_numericality_of(:age, :less_than => 10)
50
+ matcher.description.should == 'ensure numericality of age is less than 10'
51
+
52
+ matcher = validate_numericality_of(:age, :greater_than => 10)
53
+ matcher.description.should == 'ensure numericality of age is greater than 10'
54
+
55
+ matcher = validate_numericality_of(:age, :greater_than => 10, :less_than => 20)
56
+ matcher.description.should == 'ensure numericality of age is greater than 10 and is less than 20'
57
+ end
58
+
59
+ it 'should set only_numeric_values? message' do
60
+ @matcher.should_receive(:only_numeric_values?).and_return(false)
61
+ @matcher.matches?(@model)
62
+ @matcher.failure_message.should == 'Expected Product to allow only numeric values for price'
63
+ @matcher.negative_failure_message.should == 'Did not expect Product to allow only numeric values for price'
64
+ end
65
+
66
+ it 'should set only_integer_values? message' do
67
+ @matcher.should_receive(:only_integer?).and_return([false, { :not => '' }])
68
+ @matcher.matches?(@model)
69
+ @matcher.failure_message.should == 'Expected Product to allow only integer values for price'
70
+ end
71
+
72
+ it 'should set only_odd_values? message' do
73
+ @matcher.should_receive(:only_odd?).and_return(false)
74
+ @matcher.matches?(@model)
75
+ @matcher.failure_message.should == 'Expected Product to allow only odd values for price'
76
+ end
77
+
78
+ it 'should set only_even_values? message' do
79
+ @matcher.should_receive(:only_even?).and_return(false)
80
+ @matcher.matches?(@model)
81
+ @matcher.failure_message.should == 'Expected Product to allow only even values for price'
82
+ end
83
+
84
+ it 'should set equals_to? message' do
85
+ @matcher.should_receive(:equals_to?).and_return([false, { :count => 10 }])
86
+ @matcher.matches?(@model)
87
+ @matcher.failure_message.should == 'Expected Product to be valid only when price is equal to 10'
88
+ end
89
+
90
+ it 'should set less_than_minimum? message' do
91
+ @matcher.should_receive(:less_than_minimum?).and_return([false, { :count => 10 }])
92
+ @matcher.matches?(@model)
93
+ @matcher.failure_message.should == 'Expected Product to be invalid when price is less than 10'
94
+ end
95
+
96
+ it 'should set more_than_maximum? message' do
97
+ @matcher.should_receive(:more_than_maximum?).and_return([false, { :count => 10 }])
98
+ @matcher.matches?(@model)
99
+ @matcher.failure_message.should == 'Expected Product to be invalid when price is greater than 10'
100
+ end
101
+ end
102
+
103
+ describe 'matcher' do
104
+ # Wrap specs without options. Usually a couple specs.
105
+ describe 'without options' do
106
+ before(:each){ define_and_validate }
107
+
108
+ it { should validate_numericality_of(:price) }
109
+ it { should_not validate_numericality_of(:size) }
110
+ end
111
+
112
+ # Wrap each option inside a describe group.
113
+ describe 'with equal_to option' do
114
+ it { should define_and_validate(:equal_to => 100).equal_to(100) }
115
+ it { should_not define_and_validate(:equal_to => 100).equal_to(99) }
116
+ it { should_not define_and_validate(:equal_to => 100).equal_to(101) }
117
+ end
118
+
119
+ describe 'with less_than option' do
120
+ it { should define_and_validate(:less_than => 100).less_than(100) }
121
+ it { should_not define_and_validate(:less_than => 100).less_than(99) }
122
+ it { should_not define_and_validate(:less_than => 100).less_than(101) }
123
+ end
124
+
125
+ describe 'with greater_than option' do
126
+ it { should define_and_validate(:greater_than => 100).greater_than(100) }
127
+ it { should_not define_and_validate(:greater_than => 100).greater_than(99) }
128
+ it { should_not define_and_validate(:greater_than => 100).greater_than(101) }
129
+ end
130
+
131
+ describe 'with less_than_or_equal_to option' do
132
+ it { should define_and_validate(:less_than_or_equal_to => 100).less_than_or_equal_to(100) }
133
+ it { should_not define_and_validate(:less_than_or_equal_to => 100).less_than_or_equal_to(99) }
134
+ it { should_not define_and_validate(:less_than_or_equal_to => 100).less_than_or_equal_to(101) }
135
+ end
136
+
137
+ describe 'with greater_than_or_equal_to option' do
138
+ it { should define_and_validate(:greater_than_or_equal_to => 100).greater_than_or_equal_to(100) }
139
+ it { should_not define_and_validate(:greater_than_or_equal_to => 100).greater_than_or_equal_to(99) }
140
+ it { should_not define_and_validate(:greater_than_or_equal_to => 100).greater_than_or_equal_to(101) }
141
+ end
142
+
143
+ describe "with even option" do
144
+ it { should define_and_validate(:even => true).even }
145
+ it { should_not define_and_validate.even(true) }
146
+ end
147
+
148
+ describe "with odd option" do
149
+ it { should define_and_validate(:odd => true).odd }
150
+ it { should_not define_and_validate.odd(true) }
151
+ end
152
+
153
+ describe "with several options" do
154
+ it { should define_and_validate(:less_than => 100, :greater_than => 10).less_than(100).greater_than(10) }
155
+ it { should define_and_validate(:less_than => 100, :message => 'not valid').less_than(100).message('not valid') }
156
+ it { should define_and_validate(:less_than_or_equal_to => 100, :greater_than => 1).less_than_or_equal_to(100).greater_than(1) }
157
+ end
158
+
159
+ # A macro to spec messages
160
+ create_message_specs(self)
161
+
162
+ # Those are macros to test optionals which accept only boolean values
163
+ create_optional_boolean_specs(:allow_nil, self)
164
+ create_optional_boolean_specs(:allow_blank, self)
165
+ create_optional_boolean_specs(:only_integer, self)
166
+ end
167
+
168
+ # In macros we include just a few tests to assure that everything works properly
169
+ describe 'macros' do
170
+ before(:each) { define_and_validate(:less_than => 100000, :greater_than => 9999) }
171
+
172
+ should_validate_numericality_of :price
173
+ should_validate_numericality_of :price, :less_than => 100000
174
+ should_validate_numericality_of :price, :greater_than => 9999
175
175
  should_validate_numericality_of :price, :less_than => 100000, :greater_than => 999
176
176
 
177
- should_not_validate_numericality_of :size
178
- should_not_validate_numericality_of :price, :less_than => 55555
177
+ should_not_validate_numericality_of :size
178
+ should_not_validate_numericality_of :price, :less_than => 55555
179
179
  should_not_validate_numericality_of :price, :greater_than => 55555
180
180
 
181
181
  should_validate_numericality_of :price do |m|
182
182
  m.less_than 100000
183
183
  m.greater_than 999
184
- end
185
- end
186
- end
184
+ end
185
+ end
186
+ end
@@ -1,42 +1,42 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
-
3
- describe 'validate_presence_of' do
4
- include ModelBuilder
5
-
6
- # Defines a model, create a validation and returns a raw matcher
7
- def define_and_validate(options={})
8
- @model = define_model :product, :title => :string, :size => :string, :category => :string do
9
- validates_presence_of :title, :size, options
10
- end
11
-
12
- validate_presence_of(:title, :size)
13
- end
14
-
15
- describe 'messages' do
16
- before(:each){ @matcher = define_and_validate }
17
-
18
- it 'should contain a description' do
19
- @matcher.description.should == 'require title and size to be set'
20
- end
21
-
22
- it 'should set allow_nil? message' do
23
- @matcher = validate_presence_of(:category)
24
- @matcher.matches?(@model)
25
- @matcher.failure_message.should == 'Expected Product to require category to be set'
26
- @matcher.negative_failure_message.should == 'Did not expect Product to require category to be set'
27
- end
28
- end
29
-
30
- describe 'matchers' do
31
- describe 'without options' do
32
- before(:each){ define_and_validate }
33
-
34
- it { should validate_presence_of(:size) }
35
- it { should validate_presence_of(:title) }
36
- it { should validate_presence_of(:title, :size) }
37
- it { should_not validate_presence_of(:category) }
38
- end
39
-
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe 'validate_presence_of' do
4
+ include ModelBuilder
5
+
6
+ # Defines a model, create a validation and returns a raw matcher
7
+ def define_and_validate(options={})
8
+ @model = define_model :product, :title => :string, :size => :string, :category => :string do
9
+ validates_presence_of :title, :size, options
10
+ end
11
+
12
+ validate_presence_of(:title, :size)
13
+ end
14
+
15
+ describe 'messages' do
16
+ before(:each){ @matcher = define_and_validate }
17
+
18
+ it 'should contain a description' do
19
+ @matcher.description.should == 'require title and size to be set'
20
+ end
21
+
22
+ it 'should set allow_nil? message' do
23
+ @matcher = validate_presence_of(:category)
24
+ @matcher.matches?(@model)
25
+ @matcher.failure_message.should == 'Expected Product to require category to be set'
26
+ @matcher.negative_failure_message.should == 'Did not expect Product to require category to be set'
27
+ end
28
+ end
29
+
30
+ describe 'matchers' do
31
+ describe 'without options' do
32
+ before(:each){ define_and_validate }
33
+
34
+ it { should validate_presence_of(:size) }
35
+ it { should validate_presence_of(:title) }
36
+ it { should validate_presence_of(:title, :size) }
37
+ it { should_not validate_presence_of(:category) }
38
+ end
39
+
40
40
  create_message_specs(self)
41
41
 
42
42
  describe 'with belongs to' do
@@ -44,8 +44,8 @@ describe 'validate_presence_of' do
44
44
  define_model :category
45
45
 
46
46
  define_model :product, :category_id => :integer do
47
- belongs_to :category
48
- validates_presence_of :category if validation
47
+ belongs_to :category
48
+ validates_presence_of :category if validation
49
49
  end
50
50
 
51
51
  validate_presence_of(:category)
@@ -60,8 +60,8 @@ describe 'validate_presence_of' do
60
60
  define_model :stocks, :product_id => :integer
61
61
 
62
62
  define_model :product do
63
- has_many :stocks
64
- validates_presence_of :stocks if validation
63
+ has_many :stocks
64
+ validates_presence_of :stocks if validation
65
65
  end
66
66
 
67
67
  validate_presence_of :stocks
@@ -69,16 +69,16 @@ describe 'validate_presence_of' do
69
69
 
70
70
  it { should define_and_validate(true) }
71
71
  it { should_not define_and_validate(false) }
72
- end
73
- end
74
-
75
- describe 'macros' do
76
- before(:each){ define_and_validate }
77
-
78
- should_validate_presence_of(:size)
79
- should_validate_presence_of(:title)
80
- should_validate_presence_of(:size, :title)
81
- should_not_validate_presence_of(:category)
82
- end
83
- end
84
-
72
+ end
73
+ end
74
+
75
+ describe 'macros' do
76
+ before(:each){ define_and_validate }
77
+
78
+ should_validate_presence_of(:size)
79
+ should_validate_presence_of(:title)
80
+ should_validate_presence_of(:size, :title)
81
+ should_not_validate_presence_of(:category)
82
+ end
83
+ end
84
+