active_attr 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of active_attr might be problematic. Click here for more details.

Files changed (45) hide show
  1. data/.travis.yml +11 -1
  2. data/CHANGELOG.md +9 -0
  3. data/Gemfile +4 -6
  4. data/README.md +29 -11
  5. data/active_attr.gemspec +3 -3
  6. data/gemfiles/rails_3_2.gemfile +11 -0
  7. data/gemfiles/rails_head.gemfile +3 -0
  8. data/lib/active_attr.rb +0 -1
  9. data/lib/active_attr/mass_assignment.rb +30 -2
  10. data/lib/active_attr/matchers/have_attribute_matcher.rb +17 -4
  11. data/lib/active_attr/model.rb +2 -2
  12. data/lib/active_attr/typecasting/big_decimal_typecaster.rb +2 -0
  13. data/lib/active_attr/typecasting/date_typecaster.rb +1 -1
  14. data/lib/active_attr/version.rb +1 -1
  15. data/spec/functional/active_attr/attribute_defaults_spec.rb +12 -12
  16. data/spec/functional/active_attr/attributes_spec.rb +12 -12
  17. data/spec/functional/active_attr/chainable_initialization_spec.rb +3 -3
  18. data/spec/functional/active_attr/mass_assignment_spec.rb +125 -0
  19. data/spec/functional/active_attr/matchers/have_attribute_matcher_spec.rb +147 -66
  20. data/spec/functional/active_attr/model_spec.rb +27 -19
  21. data/spec/functional/active_attr/serialization_spec.rb +5 -5
  22. data/spec/functional/active_attr/typecasted_attributes_spec.rb +45 -45
  23. data/spec/support/mass_assignment_shared_examples.rb +12 -12
  24. data/spec/unit/active_attr/attribute_defaults_spec.rb +6 -6
  25. data/spec/unit/active_attr/attribute_definition_spec.rb +6 -6
  26. data/spec/unit/active_attr/attributes_spec.rb +38 -38
  27. data/spec/unit/active_attr/logger_spec.rb +16 -16
  28. data/spec/unit/active_attr/mass_assignment_spec.rb +1 -1
  29. data/spec/unit/active_attr/matchers_spec.rb +3 -4
  30. data/spec/unit/active_attr/query_attributes_spec.rb +75 -75
  31. data/spec/unit/active_attr/typecasted_attributes_spec.rb +10 -10
  32. data/spec/unit/active_attr/typecasting/big_decimal_typecaster_spec.rb +9 -7
  33. data/spec/unit/active_attr/typecasting/boolean_typecaster_spec.rb +27 -25
  34. data/spec/unit/active_attr/typecasting/date_time_typecaster_spec.rb +12 -10
  35. data/spec/unit/active_attr/typecasting/date_typecaster_spec.rb +14 -12
  36. data/spec/unit/active_attr/typecasting/float_typecaster_spec.rb +6 -4
  37. data/spec/unit/active_attr/typecasting/integer_typecaster_spec.rb +8 -6
  38. data/spec/unit/active_attr/typecasting/object_typecaster_spec.rb +3 -1
  39. data/spec/unit/active_attr/typecasting/string_typecaster_spec.rb +5 -3
  40. data/spec/unit/active_attr/typecasting_spec.rb +3 -5
  41. data/spec/unit/active_attr/version_spec.rb +5 -5
  42. metadata +20 -17
  43. data/lib/active_attr/mass_assignment_security.rb +0 -54
  44. data/spec/functional/active_attr/mass_assignment_security_spec.rb +0 -45
  45. data/spec/unit/active_attr/mass_assignment_security_spec.rb +0 -67
@@ -3,7 +3,7 @@ require "active_attr/attributes"
3
3
 
4
4
  module ActiveAttr
5
5
  describe Attributes do
6
- subject { model_class.new }
6
+ subject(:model) { model_class.new }
7
7
  let(:last_name) { "Poweski" }
8
8
 
9
9
  let :model_class do
@@ -69,23 +69,23 @@ module ActiveAttr
69
69
  end
70
70
 
71
71
  it "defines an attribute reader that calls #attribute" do
72
- subject.should_receive(:attribute).with("first_name")
73
- subject.first_name
72
+ model.should_receive(:attribute).with("first_name")
73
+ model.first_name
74
74
  end
75
75
 
76
76
  it "defines an attribute reader that can be called via super" do
77
- subject.should_receive(:attribute).with("amount")
78
- subject.amount
77
+ model.should_receive(:attribute).with("amount")
78
+ model.amount
79
79
  end
80
80
 
81
81
  it "defines an attribute writer that calls #attribute=" do
82
- subject.should_receive(:attribute=).with("first_name", "Ben")
83
- subject.first_name = "Ben"
82
+ model.should_receive(:attribute=).with("first_name", "Ben")
83
+ model.first_name = "Ben"
84
84
  end
85
85
 
86
86
  it "defines an attribute writer that can be called via super" do
87
- subject.should_receive(:attribute=).with("amount", 1)
88
- subject.amount = 1
87
+ model.should_receive(:attribute=).with("amount", 1)
88
+ model.amount = 1
89
89
  end
90
90
 
91
91
  it "defining an attribute twice does not give the class two attribute definitions" do
@@ -121,17 +121,17 @@ module ActiveAttr
121
121
 
122
122
  it "defines an attribute reader that calls #attribute" do
123
123
  attributeless.attribute! :first_name
124
- instance = attributeless.new
124
+ model = attributeless.new
125
125
  result = mock
126
- instance.should_receive(:attribute).with("first_name").and_return(result)
127
- instance.first_name.should equal result
126
+ model.should_receive(:attribute).with("first_name").and_return(result)
127
+ model.first_name.should equal result
128
128
  end
129
129
 
130
130
  it "defines an attribute writer that calls #attribute=" do
131
131
  attributeless.attribute! :first_name
132
- instance = attributeless.new
133
- instance.should_receive(:attribute=).with("first_name", "Ben")
134
- instance.first_name = "Ben"
132
+ model = attributeless.new
133
+ model.should_receive(:attribute=).with("first_name", "Ben")
134
+ model.first_name = "Ben"
135
135
  end
136
136
  end
137
137
 
@@ -186,32 +186,32 @@ module ActiveAttr
186
186
 
187
187
  context "when an attribute is defined" do
188
188
  it "returns the key value pairs" do
189
- subject.first_name = "Ben"
190
- subject.attributes.should include("first_name" => "Ben")
189
+ model.first_name = "Ben"
190
+ model.attributes.should include("first_name" => "Ben")
191
191
  end
192
192
 
193
193
  it "returns a new Hash " do
194
- subject.attributes.merge!("first_name" => "Bob")
195
- subject.attributes.should_not include("first_name" => "Bob")
194
+ model.attributes.merge!("first_name" => "Bob")
195
+ model.attributes.should_not include("first_name" => "Bob")
196
196
  end
197
197
 
198
198
  it "returns all attributes" do
199
- subject.attributes.keys.should =~ %w(amount first_name last_name)
199
+ model.attributes.keys.should =~ %w(amount first_name last_name)
200
200
  end
201
201
  end
202
202
 
203
203
  context "when a getter is overridden" do
204
204
  it "uses the overridden implementation" do
205
- subject.attributes.should include("last_name" => last_name)
205
+ model.attributes.should include("last_name" => last_name)
206
206
  end
207
207
  end
208
208
  end
209
209
 
210
210
  describe "#inspect" do
211
- before { subject.first_name = "Ben" }
211
+ before { model.first_name = "Ben" }
212
212
 
213
213
  it "includes the class name and all attribute values in alphabetical order by attribute name" do
214
- subject.inspect.should == %{#<Foo amount: nil, first_name: "Ben", last_name: "#{last_name}">}
214
+ model.inspect.should == %{#<Foo amount: nil, first_name: "Ben", last_name: "#{last_name}">}
215
215
  end
216
216
 
217
217
  it "doesn't format the inspection string for attributes if the model does not have any" do
@@ -220,7 +220,7 @@ module ActiveAttr
220
220
 
221
221
  context "when a getter is overridden" do
222
222
  it "uses the overridden implementation" do
223
- subject.inspect.should include %{last_name: "#{last_name}"}
223
+ model.inspect.should include %{last_name: "#{last_name}"}
224
224
  end
225
225
  end
226
226
  end
@@ -229,33 +229,33 @@ module ActiveAttr
229
229
  describe "##{method}" do
230
230
  context "when an attribute is not set" do
231
231
  it "returns nil" do
232
- subject.send(method, :first_name).should be_nil
232
+ model.send(method, :first_name).should be_nil
233
233
  end
234
234
  end
235
235
 
236
236
  context "when an attribute is set" do
237
237
  let(:first_name) { "Bob" }
238
238
 
239
- before { subject.write_attribute(:first_name, first_name) }
239
+ before { model.write_attribute(:first_name, first_name) }
240
240
 
241
241
  it "returns the attribute using a Symbol" do
242
- subject.send(method, :first_name).should == first_name
242
+ model.send(method, :first_name).should == first_name
243
243
  end
244
244
 
245
245
  it "returns the attribute using a String" do
246
- subject.send(method, 'first_name').should == first_name
246
+ model.send(method, 'first_name').should == first_name
247
247
  end
248
248
  end
249
249
 
250
250
  context "when the getter is overridden" do
251
251
  it "uses the overridden implementation" do
252
- subject.send(method, :last_name).should == last_name
252
+ model.send(method, :last_name).should == last_name
253
253
  end
254
254
  end
255
255
 
256
256
  it "raises when getting an undefined attribute" do
257
257
  expect do
258
- subject.send(method, :initials)
258
+ model.send(method, :initials)
259
259
  end.to raise_error UnknownAttributeError, "unknown attribute: initials"
260
260
  end
261
261
  end
@@ -264,33 +264,33 @@ module ActiveAttr
264
264
  [:[]=, :write_attribute].each do |method|
265
265
  describe "##{method}" do
266
266
  it "raises ArgumentError with one argument" do
267
- expect { subject.send(method, :first_name) }.to raise_error(ArgumentError)
267
+ expect { model.send(method, :first_name) }.to raise_error(ArgumentError)
268
268
  end
269
269
 
270
270
  it "raises ArgumentError with no arguments" do
271
- expect { subject.send(method) }.to raise_error(ArgumentError)
271
+ expect { model.send(method) }.to raise_error(ArgumentError)
272
272
  end
273
273
 
274
274
  it "sets an attribute using a Symbol and value" do
275
- expect { subject.send(method, :first_name, "Ben") }.to change { subject.attributes["first_name"] }.from(nil).to("Ben")
275
+ expect { model.send(method, :first_name, "Ben") }.to change { model.attributes["first_name"] }.from(nil).to("Ben")
276
276
  end
277
277
 
278
278
  it "sets an attribute using a String and value" do
279
- expect { subject.send(method, 'first_name', "Ben") }.to change { subject.attributes["first_name"] }.from(nil).to("Ben")
279
+ expect { model.send(method, 'first_name', "Ben") }.to change { model.attributes["first_name"] }.from(nil).to("Ben")
280
280
  end
281
281
 
282
282
  it "is able to set an attribute to nil" do
283
- subject.first_name = "Ben"
284
- expect { subject.send(method, :first_name, nil) }.to change { subject.attributes["first_name"] }.from("Ben").to(nil)
283
+ model.first_name = "Ben"
284
+ expect { model.send(method, :first_name, nil) }.to change { model.attributes["first_name"] }.from("Ben").to(nil)
285
285
  end
286
286
 
287
287
  it "uses the overridden implementation when the setter is overridden" do
288
- subject.send(method, :last_name, "poweski").should == "POWESKI"
288
+ model.send(method, :last_name, "poweski").should == "POWESKI"
289
289
  end
290
290
 
291
291
  it "raises when setting an undefined attribute" do
292
292
  expect do
293
- subject.send(method, :initials, "BP")
293
+ model.send(method, :initials, "BP")
294
294
  end.to raise_error UnknownAttributeError, "unknown attribute: initials"
295
295
  end
296
296
  end
@@ -3,7 +3,7 @@ require "active_attr/logger"
3
3
 
4
4
  module ActiveAttr
5
5
  describe Logger do
6
- subject { model_class.new }
6
+ subject(:model) { model_class.new }
7
7
  let(:logger) { double "logger" }
8
8
  let(:child_class) { Class.new(parent_class) }
9
9
  let(:parent_class) { model_class }
@@ -32,11 +32,11 @@ module ActiveAttr
32
32
  end
33
33
 
34
34
  it "#logger is nil" do
35
- subject.logger.should be_nil
35
+ model.logger.should be_nil
36
36
  end
37
37
 
38
38
  it "#logger? is false" do
39
- subject.logger?.should == false
39
+ model.logger?.should == false
40
40
  end
41
41
  end
42
42
 
@@ -61,11 +61,11 @@ module ActiveAttr
61
61
  end
62
62
 
63
63
  it "#logger is the logger" do
64
- subject.logger.should == logger
64
+ model.logger.should == logger
65
65
  end
66
66
 
67
67
  it "#logger? is true" do
68
- subject.logger?.should == true
68
+ model.logger?.should == true
69
69
  end
70
70
  end
71
71
 
@@ -89,17 +89,17 @@ module ActiveAttr
89
89
  end
90
90
 
91
91
  it "#logger is the logger" do
92
- subject.logger.should == logger
92
+ model.logger.should == logger
93
93
  end
94
94
 
95
95
  it "#logger? is true" do
96
- subject.logger?.should == true
96
+ model.logger?.should == true
97
97
  end
98
98
  end
99
99
 
100
100
  context "when the logger is set on a parent class" do
101
101
  before { parent_class.logger = logger }
102
- subject { child_class.new }
102
+ subject(:model) { child_class.new }
103
103
 
104
104
  it "#{described_class}.logger is nil" do
105
105
  described_class.logger.should be_nil
@@ -118,17 +118,17 @@ module ActiveAttr
118
118
  end
119
119
 
120
120
  it "#logger is the logger" do
121
- subject.logger.should == logger
121
+ model.logger.should == logger
122
122
  end
123
123
 
124
124
  it "#logger? is true" do
125
- subject.logger?.should == true
125
+ model.logger?.should == true
126
126
  end
127
127
  end
128
128
 
129
129
  context "when the logger is set on a child class" do
130
130
  before { child_class.logger = logger }
131
- subject { parent_class.new }
131
+ subject(:model) { parent_class.new }
132
132
 
133
133
  it "#{described_class}.logger is nil" do
134
134
  described_class.logger.should be_nil
@@ -147,16 +147,16 @@ module ActiveAttr
147
147
  end
148
148
 
149
149
  it "#logger is nil" do
150
- subject.logger.should be_nil
150
+ model.logger.should be_nil
151
151
  end
152
152
 
153
153
  it "#logger? is false" do
154
- subject.logger?.should == false
154
+ model.logger?.should == false
155
155
  end
156
156
  end
157
157
 
158
158
  context "when the logger is set on the instance" do
159
- before { subject.logger = logger }
159
+ before { model.logger = logger }
160
160
 
161
161
  it "#{described_class}.logger is nil" do
162
162
  described_class.logger.should be_nil
@@ -175,11 +175,11 @@ module ActiveAttr
175
175
  end
176
176
 
177
177
  it "#logger is the logger" do
178
- subject.logger.should == logger
178
+ model.logger.should == logger
179
179
  end
180
180
 
181
181
  it "#logger? is true" do
182
- subject.logger?.should == true
182
+ model.logger?.should == true
183
183
  end
184
184
  end
185
185
  end
@@ -3,7 +3,7 @@ require "active_attr/mass_assignment"
3
3
 
4
4
  module ActiveAttr
5
5
  describe MassAssignment, :mass_assignment do
6
- subject do
6
+ before do
7
7
  model_class.class_eval do
8
8
  include MassAssignment
9
9
  end
@@ -3,20 +3,19 @@ require "active_attr/matchers"
3
3
 
4
4
  module ActiveAttr
5
5
  describe Matchers do
6
- let(:dsl) { Object.new.extend described_class }
7
- subject { dsl }
6
+ subject(:dsl) { Object.new.extend described_class }
8
7
 
9
8
  it { should respond_to(:have_attribute).with(1).argument }
10
9
 
11
10
  describe "#have_attribute" do
12
- subject { dsl.have_attribute(:first_name) }
11
+ subject(:matcher) { dsl.have_attribute(:first_name) }
13
12
 
14
13
  it "builds a HaveAttributeMatcher" do
15
14
  should be_a_kind_of Matchers::HaveAttributeMatcher
16
15
  end
17
16
 
18
17
  it "uses the given attribute name to construct the matcher" do
19
- subject.send(:attribute_name).should == :first_name
18
+ matcher.send(:attribute_name).should == :first_name
20
19
  end
21
20
  end
22
21
  end
@@ -4,7 +4,7 @@ require "bigdecimal"
4
4
 
5
5
  module ActiveAttr
6
6
  describe QueryAttributes do
7
- subject { model_class.new }
7
+ subject(:model) { model_class.new }
8
8
 
9
9
  let :model_class do
10
10
  Class.new do
@@ -29,196 +29,196 @@ module ActiveAttr
29
29
 
30
30
  describe ".attribute" do
31
31
  it "defines an attribute predicate method that calls #attribute?" do
32
- subject.should_receive(:attribute?).with("value")
33
- subject.value?
32
+ model.should_receive(:attribute?).with("value")
33
+ model.value?
34
34
  end
35
35
 
36
36
  it "defines an attribute reader that can be called via super" do
37
- subject.should_receive(:attribute?).with("overridden")
38
- subject.overridden?
37
+ model.should_receive(:attribute?).with("overridden")
38
+ model.overridden?
39
39
  end
40
40
  end
41
41
 
42
42
  describe "#query_attribute" do
43
43
  it "raises ArgumentError when called with two arguments" do
44
- expect { subject.query_attribute(:a, :b) }.to raise_error ArgumentError
44
+ expect { model.query_attribute(:a, :b) }.to raise_error ArgumentError
45
45
  end
46
46
 
47
47
  it "does not raise when called with a single argument" do
48
- expect { subject.query_attribute(:a) }.not_to raise_error ArgumentError
48
+ expect { model.query_attribute(:a) }.not_to raise_error ArgumentError
49
49
  end
50
50
 
51
51
  it "raises ArgumentError when called with no arguments" do
52
- expect { subject.query_attribute }.to raise_error ArgumentError
52
+ expect { model.query_attribute }.to raise_error ArgumentError
53
53
  end
54
54
 
55
55
  it "calls the predicate method if defined" do
56
- subject.query_attribute(:true).should eq true
57
- subject.query_attribute(:false).should == false
56
+ model.query_attribute(:true).should eq true
57
+ model.query_attribute(:false).should == false
58
58
  end
59
59
 
60
60
  it "raises when getting an undefined attribute" do
61
- expect { subject.query_attribute(:initials) }.to raise_error UnknownAttributeError, "unknown attribute: initials"
61
+ expect { model.query_attribute(:initials) }.to raise_error UnknownAttributeError, "unknown attribute: initials"
62
62
  end
63
63
 
64
64
  it "is false when the attribute is false" do
65
- subject.value = false
66
- subject.value?.should == false
65
+ model.value = false
66
+ model.value?.should == false
67
67
  end
68
68
 
69
69
  it "is true when the attribute is true" do
70
- subject.value = true
71
- subject.value?.should == true
70
+ model.value = true
71
+ model.value?.should == true
72
72
  end
73
73
 
74
74
  it "is false when the attribute is nil" do
75
- subject.value = nil
76
- subject.value?.should == false
75
+ model.value = nil
76
+ model.value?.should == false
77
77
  end
78
78
 
79
79
  it "is true when the attribute is an Object" do
80
- subject.value = Object.new
81
- subject.value?.should == true
80
+ model.value = Object.new
81
+ model.value?.should == true
82
82
  end
83
83
 
84
84
  it "is false when the attribute is an empty string" do
85
- subject.value = ""
86
- subject.value?.should == false
85
+ model.value = ""
86
+ model.value?.should == false
87
87
  end
88
88
 
89
89
  it "is true when the attribute is a non-empty string" do
90
- subject.value = "Chris"
91
- subject.value?.should == true
90
+ model.value = "Chris"
91
+ model.value?.should == true
92
92
  end
93
93
 
94
94
  it "is false when the attribute is 0" do
95
- subject.value = 0
96
- subject.value?.should == false
95
+ model.value = 0
96
+ model.value?.should == false
97
97
  end
98
98
 
99
99
  it "is true when the attribute is 1" do
100
- subject.value = 1
101
- subject.value?.should == true
100
+ model.value = 1
101
+ model.value?.should == true
102
102
  end
103
103
 
104
104
  it "is false when the attribute is 0.0" do
105
- subject.value = 0.0
106
- subject.value?.should == false
105
+ model.value = 0.0
106
+ model.value?.should == false
107
107
  end
108
108
 
109
109
  it "is true when the attribute is 0.1" do
110
- subject.value = 0.1
111
- subject.value?.should == true
110
+ model.value = 0.1
111
+ model.value?.should == true
112
112
  end
113
113
 
114
114
  it "is false when the attribute is a zero BigDecimal" do
115
- subject.value = BigDecimal.new("0.0")
116
- subject.value?.should == false
115
+ model.value = BigDecimal.new("0.0")
116
+ model.value?.should == false
117
117
  end
118
118
 
119
119
  it "is true when the attribute is a non-zero BigDecimal" do
120
- subject.value = BigDecimal.new("0.1")
121
- subject.value?.should == true
120
+ model.value = BigDecimal.new("0.1")
121
+ model.value?.should == true
122
122
  end
123
123
 
124
124
  it "is true when the attribute is -1" do
125
- subject.value = -1
126
- subject.value?.should == true
125
+ model.value = -1
126
+ model.value?.should == true
127
127
  end
128
128
 
129
129
  it "is false when the attribute is -0.0" do
130
- subject.value = -0.0
131
- subject.value?.should == false
130
+ model.value = -0.0
131
+ model.value?.should == false
132
132
  end
133
133
 
134
134
  it "is true when the attribute is -0.1" do
135
- subject.value = -0.1
136
- subject.value?.should == true
135
+ model.value = -0.1
136
+ model.value?.should == true
137
137
  end
138
138
 
139
139
  it "is false when the attribute is a negative zero BigDecimal" do
140
- subject.value = BigDecimal.new("-0.0")
141
- subject.value?.should == false
140
+ model.value = BigDecimal.new("-0.0")
141
+ model.value?.should == false
142
142
  end
143
143
 
144
144
  it "is true when the attribute is a negative BigDecimal" do
145
- subject.value = BigDecimal.new("-0.1")
146
- subject.value?.should == true
145
+ model.value = BigDecimal.new("-0.1")
146
+ model.value?.should == true
147
147
  end
148
148
 
149
149
  it "is false when the attribute is '0'" do
150
- subject.value = "0"
151
- subject.value?.should == false
150
+ model.value = "0"
151
+ model.value?.should == false
152
152
  end
153
153
 
154
154
  it "is true when the attribute is '1'" do
155
- subject.value = "1"
156
- subject.value?.should == true
155
+ model.value = "1"
156
+ model.value?.should == true
157
157
  end
158
158
 
159
159
  it "is false when the attribute is '0.0'" do
160
- subject.value = "0.0"
161
- subject.value?.should == false
160
+ model.value = "0.0"
161
+ model.value?.should == false
162
162
  end
163
163
 
164
164
  it "is true when the attribute is '0.1'" do
165
- subject.value = "0.1"
166
- subject.value?.should == true
165
+ model.value = "0.1"
166
+ model.value?.should == true
167
167
  end
168
168
 
169
169
  it "is true when the attribute is '-1'" do
170
- subject.value = "-1"
171
- subject.value?.should == true
170
+ model.value = "-1"
171
+ model.value?.should == true
172
172
  end
173
173
 
174
174
  it "is false when the attribute is '-0.0'" do
175
- subject.value = "-0.0"
176
- subject.value?.should == false
175
+ model.value = "-0.0"
176
+ model.value?.should == false
177
177
  end
178
178
 
179
179
  it "is true when the attribute is '-0.1'" do
180
- subject.value = "-0.1"
181
- subject.value?.should == true
180
+ model.value = "-0.1"
181
+ model.value?.should == true
182
182
  end
183
183
 
184
184
  it "is true when the attribute is 'true'" do
185
- subject.value = "true"
186
- subject.value?.should == true
185
+ model.value = "true"
186
+ model.value?.should == true
187
187
  end
188
188
 
189
189
  it "is false when the attribute is 'false'" do
190
- subject.value = "false"
191
- subject.value?.should == false
190
+ model.value = "false"
191
+ model.value?.should == false
192
192
  end
193
193
 
194
194
  it "is true when the attribute is 't'" do
195
- subject.value = "t"
196
- subject.value?.should == true
195
+ model.value = "t"
196
+ model.value?.should == true
197
197
  end
198
198
 
199
199
  it "is false when the attribute is 'f'" do
200
- subject.value = "f"
201
- subject.value?.should == false
200
+ model.value = "f"
201
+ model.value?.should == false
202
202
  end
203
203
 
204
204
  it "is true when the attribute is 'T'" do
205
- subject.value = "T"
206
- subject.value?.should == true
205
+ model.value = "T"
206
+ model.value?.should == true
207
207
  end
208
208
 
209
209
  it "is false when the attribute is 'F'" do
210
- subject.value = "F"
211
- subject.value?.should == false
210
+ model.value = "F"
211
+ model.value?.should == false
212
212
  end
213
213
 
214
214
  it "is true when the attribute is 'TRUE'" do
215
- subject.value = "TRUE"
216
- subject.value?.should == true
215
+ model.value = "TRUE"
216
+ model.value?.should == true
217
217
  end
218
218
 
219
219
  it "is false when the attribute is 'FALSE" do
220
- subject.value = "FALSE"
221
- subject.value?.should == false
220
+ model.value = "FALSE"
221
+ model.value?.should == false
222
222
  end
223
223
  end
224
224
  end