osm 1.2.17 → 1.2.18.dev

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.
data/lib/osm/section.rb CHANGED
@@ -15,14 +15,6 @@ module Osm
15
15
  # @return [Date] when the section's subscription to OSM expires
16
16
  # @!attribute [rw] type
17
17
  # @return [Symbol] the section type (:beavers, :cubs, :scouts, :exporers, :network, :adults, :waiting, :unknown)
18
- # @!attribute [rw] column_names
19
- # @return [Hash] custom names to use for the data columns
20
- # @!attribute [rw] fields
21
- # @return [Hash] which columns are shown in OSM
22
- # @!attribute [rw] intouch_fields
23
- # @return [Hash] which columns are shown in OSM's in touch reports
24
- # @!attribute [rw] mobile_fields
25
- # @return [Hash] which columns are shown in the OSM mobile app
26
18
  # @!attribute [rw] flexi_records
27
19
  # @return [Array<FlexiRecord>] list of the extra records the section has
28
20
  # @!attribute [rw] gocardless
@@ -83,10 +75,6 @@ module Osm
83
75
  attribute :subscription_level, :default => 1
84
76
  attribute :subscription_expires, :type => Date
85
77
  attribute :type, :default => :unknown
86
- attribute :column_names, :default => {}
87
- attribute :fields, :default => {}
88
- attribute :intouch_fields, :default => {}
89
- attribute :mobile_fields, :default => {}
90
78
  attribute :flexi_records, :default => []
91
79
  attribute :gocardless, :type => Boolean
92
80
  attribute :myscout_events_expires, :type => Date
@@ -116,7 +104,7 @@ module Osm
116
104
 
117
105
  if ActiveModel::VERSION::MAJOR < 4
118
106
  attr_accessible :id, :name, :group_id, :group_name, :subscription_level, :subscription_expires,
119
- :type, :column_names, :fields, :intouch_fields, :mobile_fields, :flexi_records,
107
+ :type, :flexi_records,
120
108
  :gocardless, :myscout_events_expires, :myscout_badges_expires,
121
109
  :myscout_programme_expires, :myscout_details_expires, :myscout_events,
122
110
  :myscout_badges, :myscout_programme, :myscout_payments, :myscout_details,
@@ -136,16 +124,11 @@ module Osm
136
124
  validates_numericality_of :myscout_payment_reminder_frequency, :only_integer=>true, :greater_than_or_equal_to=>-1
137
125
  validates_numericality_of :sms_messages_sent, :only_integer=>true, :greater_than_or_equal_to=>0
138
126
  validates_numericality_of :sms_messages_remaining, :only_integer=>true, :greater_than_or_equal_to=>0
139
-
140
127
  validates_presence_of :name
141
128
  validates_presence_of :group_name
142
129
  validates_presence_of :subscription_level
143
130
  validates_presence_of :subscription_expires
144
131
  validates_presence_of :type
145
- # validates_presence_of :column_names, :unless => Proc.new { |a| a.column_names == {} }
146
- # validates_presence_of :fields, :unless => Proc.new { |a| a.fields == {} }
147
- # validates_presence_of :intouch_fields, :unless => Proc.new { |a| a.intouch_fields == {} }
148
- # validates_presence_of :mobile_fields, :unless => Proc.new { |a| a.mobile_fields == {} }
149
132
  # validates_presence_of :flexi_records, :unless => Proc.new { |a| a.flexi_records == [] }
150
133
 
151
134
  validates_inclusion_of :subscription_level, :in => (1..3), :message => 'is not a valid subscription level'
@@ -161,10 +144,6 @@ module Osm
161
144
  validates_inclusion_of :myscout_programme_show, :in => [-2, -1, 0, 5, 10, 15, 20]
162
145
  validates_inclusion_of :sms_sent_test, :in => [true, false]
163
146
 
164
- validates :column_names, :hash => {:key_type => Symbol, :value_type => String}
165
- validates :fields, :hash => {:key_type => Symbol, :value_in => [true, false]}
166
- validates :intouch_fields, :hash => {:key_type => Symbol, :value_in => [true, false]}
167
- validates :mobile_fields, :hash => {:key_type => Symbol, :value_in => [true, false]}
168
147
  validates :myscout_emails, :hash => {:key_in => [:email1, :email2, :email3, :email4], :value_in => [true, false]}
169
148
  validates :flexi_records, :array_of => {:item_type => Osm::FlexiRecord, :item_valid => true}
170
149
 
@@ -223,10 +202,6 @@ module Osm
223
202
  :subscription_expires => Osm::parse_date(section_data['subscription_expires']),
224
203
  :type => !section_data['sectionType'].nil? ? section_data['sectionType'].to_sym : (!section_data['section'].nil? ? section_data['section'].to_sym : :unknown),
225
204
  :num_scouts => section_data['numscouts'],
226
- :column_names => section_data['columnNames'].is_a?(Hash) ? Osm::symbolize_hash(section_data['columnNames']) : {},
227
- :fields => section_data['fields'].is_a?(Hash) ? Osm::symbolize_hash(section_data['fields']) : {},
228
- :intouch_fields => section_data['intouch'].is_a?(Hash) ? Osm::symbolize_hash(section_data['intouch']) : {},
229
- :mobile_fields => section_data['mobFields'].is_a?(Hash) ? Osm::symbolize_hash(section_data['mobFields']) : {},
230
205
  :flexi_records => flexi_records.sort,
231
206
  :group_id => role_data['groupid'],
232
207
  :group_name => role_data['groupname'],
@@ -0,0 +1,11 @@
1
+ class ValidityValidator < ActiveModel::EachValidator
2
+ def validate_each(record, attribute, value)
3
+ record.errors.add(attribute, "must be valid") unless value.try('valid?')
4
+ error_messages = (value.try(:errors).try(:messages) || {})
5
+ error_messages.each do |attr, messages|
6
+ messages.each do |message|
7
+ record.errors.add(attribute, "#{attr} attribute is invalid: #{message}")
8
+ end # each message
9
+ end # each attribute
10
+ end
11
+ end
data/osm.gemspec CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
  s.add_runtime_dependency 'dirty_hashy', '~> 0.2.1' # Used to track changed data in Badge::Data and FlexiRecord::Data
27
27
 
28
28
  s.add_development_dependency 'rake', '~> 10.0'
29
- s.add_development_dependency 'rspec', '~> 2.0', '>= 2.14.1'
29
+ s.add_development_dependency 'rspec', '>= 2.14.1', '< 4'
30
30
  s.add_development_dependency 'fakeweb', '~> 1.3'
31
31
  s.add_development_dependency 'guard-rspec', '~> 4.2', '>= 4.2.5'
32
32
  s.add_development_dependency 'rb-inotify', '~> 0.9'
@@ -32,7 +32,7 @@ class NovalidTestModel < Osm::Model
32
32
  end
33
33
 
34
34
 
35
- describe "array_of validator" do
35
+ describe "Array of validator" do
36
36
 
37
37
  it "Allows an empty array" do
38
38
  i = FixnumTestModel.new(array: [])
@@ -0,0 +1,133 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+
5
+ class KeyTypeTestModel
6
+ include ActiveAttr::Model
7
+ attribute :hash_attr
8
+ validates :hash_attr, :hash => {:key_type => Fixnum}
9
+ end
10
+
11
+ class KeyInTestModel
12
+ include ActiveAttr::Model
13
+ attribute :hash_attr
14
+ validates :hash_attr, :hash => {:key_in => [1, 2]}
15
+ end
16
+
17
+ class ValueTypeTestModel
18
+ include ActiveAttr::Model
19
+ attribute :hash_attr
20
+ validates :hash_attr, :hash => {:value_type => Fixnum}
21
+ end
22
+
23
+ class ValueInTestModel
24
+ include ActiveAttr::Model
25
+ attribute :hash_attr
26
+ validates :hash_attr, :hash => {:value_in => [1, 2]}
27
+ end
28
+
29
+
30
+ describe "Hash validator" do
31
+
32
+
33
+ describe "Key type option" do
34
+
35
+ it "Has only correct keys" do
36
+ model = KeyTypeTestModel.new(hash_attr: {1=>'1', 2=>'2'})
37
+ model.valid?.should == true
38
+ model.errors.count.should == 0
39
+ end
40
+
41
+ it "Has an incorrect key" do
42
+ model = KeyTypeTestModel.new(hash_attr: {1=>'1', 2=>'2', '3'=>'3'})
43
+ model.valid?.should == false
44
+ model.errors.count.should == 1
45
+ model.errors.messages.should == {hash_attr: ['keys must be a Fixnum ("3" is not).']}
46
+ end
47
+
48
+ it "Has several incorrect keys" do
49
+ model = KeyTypeTestModel.new(hash_attr: {1=>'1', 2=>'2', '3'=>'3', '4'=>'4'})
50
+ model.valid?.should == false
51
+ model.errors.count.should == 2
52
+ model.errors.messages.should == {hash_attr: ['keys must be a Fixnum ("3" is not).', 'keys must be a Fixnum ("4" is not).']}
53
+ end
54
+
55
+ end
56
+
57
+
58
+ describe "Key in option" do
59
+
60
+ it "Has only correct keys" do
61
+ model = KeyInTestModel.new(hash_attr: {1=>'1', 2=>'2'})
62
+ model.valid?.should == true
63
+ model.errors.count.should == 0
64
+ end
65
+
66
+ it "Has an incorrect key" do
67
+ model = KeyInTestModel.new(hash_attr: {1=>'1', 2=>'2', 3=>'3'})
68
+ model.valid?.should == false
69
+ model.errors.count.should == 1
70
+ model.errors.messages.should == {hash_attr: ['keys must be in [1, 2] (3 is not).']}
71
+ end
72
+
73
+ it "Has several incorrect keys" do
74
+ model = KeyInTestModel.new(hash_attr: {1=>'1', 2=>'2', 3=>'3', 4=>'4'})
75
+ model.valid?.should == false
76
+ model.errors.count.should == 2
77
+ model.errors.messages.should == {hash_attr: ['keys must be in [1, 2] (3 is not).', 'keys must be in [1, 2] (4 is not).']}
78
+ end
79
+
80
+ end
81
+
82
+
83
+ describe "Value type option" do
84
+
85
+ it "Has only correct keys" do
86
+ model = ValueTypeTestModel.new(hash_attr: {'1'=>1, '2'=>2})
87
+ model.valid?.should == true
88
+ model.errors.count.should == 0
89
+ end
90
+
91
+ it "Has an incorrect key" do
92
+ model = ValueTypeTestModel.new(hash_attr: {'1'=>1, '2'=>2, '3'=>'3'})
93
+ model.valid?.should == false
94
+ model.errors.count.should == 1
95
+ model.errors.messages.should == {hash_attr: ['values must be a Fixnum ("3" for key "3" is not).']}
96
+ end
97
+
98
+ it "Has several incorrect keys" do
99
+ model = ValueTypeTestModel.new(hash_attr: {'1'=>1, '2'=>2, '3'=>'3', '4'=>'4'})
100
+ model.valid?.should == false
101
+ model.errors.count.should == 2
102
+ model.errors.messages.should == {hash_attr: ['values must be a Fixnum ("3" for key "3" is not).', 'values must be a Fixnum ("4" for key "4" is not).']}
103
+ end
104
+
105
+ end
106
+
107
+
108
+ describe "Value in option" do
109
+
110
+ it "Has only correct keys" do
111
+ model = ValueInTestModel.new(hash_attr: {'1'=>1, '2'=>2})
112
+ model.valid?.should == true
113
+ model.errors.count.should == 0
114
+ end
115
+
116
+ it "Has an incorrect key" do
117
+ model = ValueInTestModel.new(hash_attr: {'1'=>1, '2'=>2, '3'=>'3'})
118
+ model.valid?.should == false
119
+ model.errors.count.should == 1
120
+ model.errors.messages.should == {hash_attr: ['values must be in [1, 2] ("3" for key "3" is not).']}
121
+ end
122
+
123
+ it "Has several incorrect keys" do
124
+ model = ValueInTestModel.new(hash_attr: {'1'=>1, '2'=>2, '3'=>'3', '4'=>'4'})
125
+ model.valid?.should == false
126
+ model.errors.count.should == 2
127
+ model.errors.messages.should == {hash_attr: ['values must be in [1, 2] ("3" for key "3" is not).', 'values must be in [1, 2] ("4" for key "4" is not).']}
128
+ end
129
+
130
+ end
131
+
132
+
133
+ end
@@ -125,8 +125,8 @@ describe "Activity" do
125
125
  activity.location.should == :indoors
126
126
  activity.shared.should == 0
127
127
  activity.rating.should == 4
128
- activity.editable.should be_true
129
- activity.deletable.should be_false
128
+ activity.editable.should == true
129
+ activity.deletable.should == false
130
130
  activity.used.should == 3
131
131
  activity.versions[0].version.should == 0
132
132
  activity.versions[0].created_by.should == 1
@@ -146,7 +146,7 @@ describe "Activity" do
146
146
  activity.badges[0].requirement_id.should == 93384
147
147
  activity.badges[0].requirement_label.should == 'B: Fire drill'
148
148
  activity.badges[0].data.should == 'Yes'
149
- activity.valid?.should be_true
149
+ activity.valid?.should == true
150
150
  end
151
151
 
152
152
 
@@ -165,13 +165,13 @@ describe "Activity" do
165
165
 
166
166
  HTTParty.should_receive(:post).with(url, {:body => post_data}) { OsmTest::DummyHttpResult.new(:response=>{:code=>'200', :body=>'{"result":0}'}) }
167
167
  activity = Osm::Activity.new(:id => 2)
168
- activity.add_to_programme(@api, 1, Date.new(2000, 1, 2), 'Notes').should be_true
168
+ activity.add_to_programme(@api, 1, Date.new(2000, 1, 2), 'Notes').should == true
169
169
  end
170
170
 
171
171
  it "Add activity to programme (failed)" do
172
172
  HTTParty.should_receive(:post) { OsmTest::DummyHttpResult.new(:response=>{:code=>'200', :body=>'{"result":1}'}) }
173
173
  activity = Osm::Activity.new(:id => 2)
174
- activity.add_to_programme(@api, 1, Date.new(2000, 1, 2), 'Notes').should be_false
174
+ activity.add_to_programme(@api, 1, Date.new(2000, 1, 2), 'Notes').should == false
175
175
  end
176
176
 
177
177
 
@@ -223,7 +223,7 @@ describe "Activity" do
223
223
  :shared => 0,
224
224
  :section_id => 1,
225
225
  )
226
- activity.update(@api, 1, true).should be_true
226
+ activity.update(@api, 1, true).should == true
227
227
  end
228
228
 
229
229
  it "Update activity in OSM (failed)" do
@@ -237,7 +237,7 @@ describe "Activity" do
237
237
  :location => :indoors,
238
238
  :running_time => 0,
239
239
  )
240
- activity.update(@api, 1, true).should be_false
240
+ activity.update(@api, 1, true).should == false
241
241
  end
242
242
 
243
243
  end
@@ -15,7 +15,7 @@ describe "API Access" do
15
15
  api_access.id.should == 1
16
16
  api_access.name.should == 'Name'
17
17
  api_access.permissions.should == {:permission => [:read]}
18
- api_access.valid?.should be_true
18
+ api_access.valid?.should == true
19
19
  end
20
20
 
21
21
  it "Sorts by id" do
data/spec/osm/api_spec.rb CHANGED
@@ -26,11 +26,11 @@ describe "API" do
26
26
  end
27
27
 
28
28
  it "Exposes the debug option seperatly too" do
29
- Osm::Api.debug.should be_false
29
+ Osm::Api.debug.should == false
30
30
  Osm::Api.debug = true
31
- Osm::Api.debug.should be_true
31
+ Osm::Api.debug.should == true
32
32
  Osm::Api.debug = false
33
- Osm::Api.debug.should be_false
33
+ Osm::Api.debug.should == false
34
34
  end
35
35
 
36
36
 
@@ -60,7 +60,7 @@ describe "API" do
60
60
  end
61
61
 
62
62
  it "sets a new API user" do
63
- @api.set_user('1', '2').is_a?(Osm::Api).should be_true
63
+ @api.set_user('1', '2').is_a?(Osm::Api).should == true
64
64
 
65
65
  HTTParty.should_receive(:post).with("https://www.onlinescoutmanager.co.uk/test", {:body => {
66
66
  'apiid' => @CONFIGURATION[:api][:osm][:id],
@@ -35,7 +35,7 @@ describe "Badge" do
35
35
  badge.id.should == 12
36
36
  badge.version.should == 3
37
37
  badge.group_name.should == ''
38
- badge.latest.should be_true
38
+ badge.latest.should == true
39
39
  badge.sharing.should == :draft
40
40
  badge.user_id.should == 4
41
41
  badge.levels.should == [1, 2, 3]
@@ -48,25 +48,25 @@ describe "Badge" do
48
48
  badge.level_requirement.should == 8
49
49
  badge.requires_modules.should == [['A'], ['B', 'C']]
50
50
  badge.show_level_letters.should == true
51
- badge.valid?.should be_true
51
+ badge.valid?.should == true
52
52
  end
53
53
 
54
54
  it "Valid with nil for levels" do
55
55
  badge = Osm::Badge.new(@badge_options.merge(levels: nil))
56
56
  badge.levels.should be_nil
57
- badge.valid?.should be_true
57
+ badge.valid?.should == true
58
58
  end
59
59
 
60
60
  it "Valid with nil for level_requirement" do
61
61
  badge = Osm::Badge.new(@badge_options.merge(level_requirement: nil))
62
62
  badge.level_requirement.should be_nil
63
- badge.valid?.should be_true
63
+ badge.valid?.should == true
64
64
  end
65
65
 
66
66
  it "Valid with nil for add_columns_to_module" do
67
67
  badge = Osm::Badge.new(@badge_options.merge(add_columns_to_module: nil))
68
68
  badge.add_columns_to_module.should be_nil
69
- badge.valid?.should be_true
69
+ badge.valid?.should == true
70
70
  end
71
71
 
72
72
  end
@@ -86,9 +86,9 @@ describe "Badge" do
86
86
  requirement.description.should == 'description'
87
87
  requirement.mod.should == m
88
88
  requirement.id.should == 1
89
- requirement.editable.should be_true
89
+ requirement.editable.should == true
90
90
  requirement.badge.identifier.should == 'key'
91
- requirement.valid?.should be_true
91
+ requirement.valid?.should == true
92
92
  end
93
93
 
94
94
  it "Create RequirementModule" do
@@ -112,12 +112,12 @@ describe "Badge" do
112
112
  m.completed_into_column.should == 3
113
113
  m.numeric_into_column.should == 4
114
114
  m.add_column_id_to_numeric.should == 5
115
- m.valid?.should be_true
115
+ m.valid?.should == true
116
116
  end
117
117
 
118
118
  it "Works out if we add columns to this badge" do
119
- Osm::Badge.new(add_columns_to_module: 123).add_columns?.should be_true
120
- Osm::Badge.new(add_columns_to_module: nil).add_columns?.should be_false
119
+ Osm::Badge.new(add_columns_to_module: 123).add_columns?.should == true
120
+ Osm::Badge.new(add_columns_to_module: nil).add_columns?.should == false
121
121
  end
122
122
 
123
123
  it "Produces a map of module letter <-> module id" do
@@ -174,7 +174,7 @@ describe "Badge" do
174
174
  data.requirements.should == {}
175
175
  data.section_id.should == 2
176
176
  data.badge.identifier.should == 'key'
177
- data.valid?.should be_true
177
+ data.valid?.should == true
178
178
  end
179
179
 
180
180
 
@@ -215,14 +215,14 @@ describe "Badge" do
215
215
 
216
216
 
217
217
  it "Works out if a requirement has been met" do
218
- data = Osm::Badge::Data.new(requirements: {1 => ''}).requirement_met?(1).should be_false
219
- data = Osm::Badge::Data.new(requirements: {1 => 'xStuff'}).requirement_met?(1).should be_false
220
- data = Osm::Badge::Data.new(requirements: {1 => '0'}).requirement_met?(1).should be_false
221
- data = Osm::Badge::Data.new(requirements: {1 => 0}).requirement_met?(1).should be_false
222
- data = Osm::Badge::Data.new(requirements: {}).requirement_met?(1).should be_false
223
- data = Osm::Badge::Data.new(requirements: {1 => 'Stuff'}).requirement_met?(1).should be_true
224
- data = Osm::Badge::Data.new(requirements: {1 => '1'}).requirement_met?(1).should be_true
225
- data = Osm::Badge::Data.new(requirements: {1 => 1}).requirement_met?(1).should be_true
218
+ data = Osm::Badge::Data.new(requirements: {1 => ''}).requirement_met?(1).should == false
219
+ data = Osm::Badge::Data.new(requirements: {1 => 'xStuff'}).requirement_met?(1).should == false
220
+ data = Osm::Badge::Data.new(requirements: {1 => '0'}).requirement_met?(1).should == false
221
+ data = Osm::Badge::Data.new(requirements: {1 => 0}).requirement_met?(1).should == false
222
+ data = Osm::Badge::Data.new(requirements: {}).requirement_met?(1).should == false
223
+ data = Osm::Badge::Data.new(requirements: {1 => 'Stuff'}).requirement_met?(1).should == true
224
+ data = Osm::Badge::Data.new(requirements: {1 => '1'}).requirement_met?(1).should == true
225
+ data = Osm::Badge::Data.new(requirements: {1 => 1}).requirement_met?(1).should == true
226
226
  end
227
227
 
228
228
 
@@ -308,13 +308,13 @@ describe "Badge" do
308
308
  data = Osm::Badge::Data.new(:awarded => 2, :badge => badge)
309
309
 
310
310
  data.stub(:earnt) { 1 }
311
- data.earnt?.should be_false
311
+ data.earnt?.should == false
312
312
 
313
313
  data.stub(:earnt) { 2 }
314
- data.earnt?.should be_false
314
+ data.earnt?.should == false
315
315
 
316
316
  data.stub(:earnt) { 3 }
317
- data.earnt?.should be_true
317
+ data.earnt?.should == true
318
318
  end
319
319
 
320
320
  it "Non staged" do
@@ -339,10 +339,10 @@ describe "Badge" do
339
339
  )
340
340
 
341
341
  data = Osm::Badge::Data.new(:due => 1, :awarded => 1, :badge => badge)
342
- data.earnt?.should be_false
342
+ data.earnt?.should == false
343
343
 
344
344
  data = Osm::Badge::Data.new(:due => 1, :awarded => 0, :badge => badge)
345
- data.earnt?.should be_true
345
+ data.earnt?.should == true
346
346
 
347
347
 
348
348
  # Number of modules required
@@ -350,10 +350,10 @@ describe "Badge" do
350
350
  this_badge.min_modules_required = 2
351
351
 
352
352
  data = Osm::Badge::Data.new(:requirements => {10=>'y', 11=>'y', 20=>'y'}, :due => 0, :awarded => 0, :badge => this_badge)
353
- data.earnt?.should be_true
353
+ data.earnt?.should == true
354
354
 
355
355
  data = Osm::Badge::Data.new(:requirements => {10=>'y', 11=>'y', 20=>'x'}, :due => 0, :awarded => 0, :badge => this_badge)
356
- data.earnt?.should be_false
356
+ data.earnt?.should == false
357
357
 
358
358
 
359
359
  # Number of requirements needed
@@ -362,13 +362,13 @@ describe "Badge" do
362
362
  this_badge.min_requirements_required = 2
363
363
 
364
364
  data = Osm::Badge::Data.new(:requirements => {10=>'y', 11=>'y', 20=>'y'}, :due => 0, :awarded => 0, :badge => this_badge)
365
- data.earnt?.should be_true
365
+ data.earnt?.should == true
366
366
 
367
367
  data = Osm::Badge::Data.new(:requirements => {10=>'y', 11=>'x', 20=>'y'}, :due => 0, :awarded => 0, :badge => this_badge)
368
- data.earnt?.should be_true
368
+ data.earnt?.should == true
369
369
 
370
370
  data = Osm::Badge::Data.new(:requirements => {10=>'y', 11=>'x', 20=>'x'}, :due => 0, :awarded => 0, :badge => this_badge)
371
- data.earnt?.should be_false
371
+ data.earnt?.should == false
372
372
 
373
373
 
374
374
  # Module combinations
@@ -376,16 +376,16 @@ describe "Badge" do
376
376
  this_badge.requires_modules = [['a'], ['b', 'c']]
377
377
 
378
378
  data = Osm::Badge::Data.new(:requirements => {10=>'x', 11=>'x', 20=>'x', 30=>'x'}, :due => 0, :awarded => 0, :badge => this_badge)
379
- data.earnt?.should be_false
379
+ data.earnt?.should == false
380
380
 
381
381
  data = Osm::Badge::Data.new(:requirements => {10=>'y', 11=>'y', 20=>'x', 30=>'x'}, :due => 0, :awarded => 0, :badge => this_badge)
382
- data.earnt?.should be_false
382
+ data.earnt?.should == false
383
383
 
384
384
  data = Osm::Badge::Data.new(:requirements => {10=>'y', 11=>'y', 20=>'y', 30=>'x'}, :due => 0, :awarded => 0, :badge => this_badge)
385
- data.earnt?.should be_true
385
+ data.earnt?.should == true
386
386
 
387
387
  data = Osm::Badge::Data.new(:requirements => {10=>'y', 11=>'y', 20=>'x', 30=>'y'}, :due => 0, :awarded => 0, :badge => this_badge)
388
- data.earnt?.should be_true
388
+ data.earnt?.should == true
389
389
 
390
390
  # Requirements from another badge
391
391
  this_badge = badge.clone
@@ -395,23 +395,23 @@ describe "Badge" do
395
395
  # Simply met
396
396
  this_badge.other_requirements_required = [{id: 100, min: 0}]
397
397
  data = Osm::Badge::Data.new(:requirements => {10=>'y'}, :due => 0, :awarded => 0, :badge => this_badge)
398
- data.earnt?.should be_true # Assume met if not in requirements Hash
398
+ data.earnt?.should == true # Assume met if not in requirements Hash
399
399
  data = Osm::Badge::Data.new(:requirements => {10=>'y', 100=>'x'}, :due => 0, :awarded => 0, :badge => this_badge)
400
- data.earnt?.should be_false
400
+ data.earnt?.should == false
401
401
  data = Osm::Badge::Data.new(:requirements => {10=>'y', 100=>'y'}, :due => 0, :awarded => 0, :badge => this_badge)
402
- data.earnt?.should be_true
402
+ data.earnt?.should == true
403
403
  # Minimum value
404
404
  this_badge.other_requirements_required = [{id: 100, min: 2}]
405
405
  data = Osm::Badge::Data.new(:requirements => {10=>'y'}, :due => 0, :awarded => 0, :badge => this_badge)
406
- data.earnt?.should be_true # Assume met if not in requirements Hash
406
+ data.earnt?.should == true # Assume met if not in requirements Hash
407
407
  data = Osm::Badge::Data.new(:requirements => {10=>'y', 100=>'x'}, :due => 0, :awarded => 0, :badge => this_badge)
408
- data.earnt?.should be_false
408
+ data.earnt?.should == false
409
409
  data = Osm::Badge::Data.new(:requirements => {10=>'y', 100=>'1'}, :due => 0, :awarded => 0, :badge => this_badge)
410
- data.earnt?.should be_false
410
+ data.earnt?.should == false
411
411
  data = Osm::Badge::Data.new(:requirements => {10=>'y', 100=>'2'}, :due => 0, :awarded => 0, :badge => this_badge)
412
- data.earnt?.should be_true
412
+ data.earnt?.should == true
413
413
  data = Osm::Badge::Data.new(:requirements => {10=>'y', 100=>'3'}, :due => 0, :awarded => 0, :badge => this_badge)
414
- data.earnt?.should be_true
414
+ data.earnt?.should == true
415
415
  end
416
416
  end
417
417
 
@@ -485,10 +485,10 @@ describe "Badge" do
485
485
  end
486
486
 
487
487
  it "Works out if the badge has been started" do
488
- Osm::Badge::Data.new(:badge => Osm::CoreBadge.new, :requirements => {1 => 'Yes', 2 => ''}).started?.should be_true
489
- Osm::Badge::Data.new(:badge => Osm::CoreBadge.new, :requirements => {1 => 'Yes', 2 => ''}, :due => 1).started?.should be_false
490
- Osm::Badge::Data.new(:badge => Osm::CoreBadge.new, :requirements => {1 => 'xNo', 2 => ''}).started?.should be_false
491
- Osm::Badge::Data.new(:badge => Osm::CoreBadge.new, :requirements => {1 => '', 2 => ''}).started?.should be_false
488
+ Osm::Badge::Data.new(:badge => Osm::CoreBadge.new, :requirements => {1 => 'Yes', 2 => ''}).started?.should == true
489
+ Osm::Badge::Data.new(:badge => Osm::CoreBadge.new, :requirements => {1 => 'Yes', 2 => ''}, :due => 1).started?.should == false
490
+ Osm::Badge::Data.new(:badge => Osm::CoreBadge.new, :requirements => {1 => 'xNo', 2 => ''}).started?.should == false
491
+ Osm::Badge::Data.new(:badge => Osm::CoreBadge.new, :requirements => {1 => '', 2 => ''}).started?.should == false
492
492
 
493
493
  # Staged Activity Badge
494
494
  Osm::Badge::Data.new(
@@ -503,7 +503,7 @@ describe "Badge" do
503
503
  ),
504
504
  :requirements => {1000 => 'Yes', 2000 => 'Yes', 2001 => ''},
505
505
  :due => 1,
506
- ).started?.should be_true
506
+ ).started?.should == true
507
507
 
508
508
  # Staged Count Badge
509
509
  Osm::Badge::Data.new(
@@ -511,13 +511,13 @@ describe "Badge" do
511
511
  :requirements => {1000 => 5, 2000 => '5', 3000 => ''},
512
512
  :due => 5,
513
513
  :awarded => 4,
514
- ).started?.should be_false # Finished lvl 5 & not started lvl 10
514
+ ).started?.should == false # Finished lvl 5 & not started lvl 10
515
515
  Osm::Badge::Data.new(
516
516
  :badge => Osm::StagedBadge.new(:levels => [0,1,2,3,4,5,10,15,20], :show_level_letters => false, :level_requirement => 1000),
517
517
  :requirements => {1000 => 6, 2000 => '6', 3000 => ''},
518
518
  :due => 5,
519
519
  :awarded => 3,
520
- ).started?.should be_true # Finished lvl 5 & started lvl 10
520
+ ).started?.should == true # Finished lvl 5 & started lvl 10
521
521
  end
522
522
 
523
523
  it "Works out what stage of the badge has been started" do
@@ -660,7 +660,7 @@ describe "Badge" do
660
660
  badge.identifier.should == '123_0'
661
661
  badge.id.should == 123
662
662
  badge.version.should == 0
663
- badge.latest.should be_true
663
+ badge.latest.should == true
664
664
  badge.user_id.should == 0
665
665
  badge.sharing.should == :default_locked
666
666
  badge.requirements.size.should == 1
@@ -672,7 +672,7 @@ describe "Badge" do
672
672
  badge.other_requirements_required.should == []
673
673
  badge.badges_required.should == []
674
674
  badge.show_level_letters.should == true
675
- badge.valid?.should be_true
675
+ badge.valid?.should == true
676
676
  badge.modules.size.should == 1
677
677
  m = badge.modules[0]
678
678
  m.badge.id.should == 123
@@ -684,15 +684,15 @@ describe "Badge" do
684
684
  m.completed_into_column.should == nil
685
685
  m.numeric_into_column.should == nil
686
686
  m.add_column_id_to_numeric.should == nil
687
- m.valid?.should be_true
687
+ m.valid?.should == true
688
688
  requirement = badge.requirements[0]
689
689
  requirement.name.should == 'r_name'
690
690
  requirement.description.should == 'r_description'
691
691
  requirement.id.should == 2345
692
692
  requirement.mod.should == m
693
- requirement.editable.should be_true
693
+ requirement.editable.should == true
694
694
  requirement.badge.should == badge
695
- requirement.valid?.should be_true
695
+ requirement.valid?.should == true
696
696
  end
697
697
  end
698
698
 
@@ -774,7 +774,7 @@ describe "Badge" do
774
774
  @data.due = 1
775
775
  @data.awarded = 1
776
776
  @data.awarded_date = date
777
- @data.update(@api).should be_true
777
+ @data.update(@api).should == true
778
778
  end
779
779
 
780
780
  it "Success (just requirement)" do
@@ -785,7 +785,7 @@ describe "Badge" do
785
785
  @data.should_not_receive(:mark_due)
786
786
 
787
787
  @data.requirements[2345] = '2'
788
- @data.update(@api).should be_true
788
+ @data.update(@api).should == true
789
789
  end
790
790
 
791
791
  it "Success (just due)" do
@@ -796,7 +796,7 @@ describe "Badge" do
796
796
  @data.should_receive(:mark_due).with(@api, 1) { true }
797
797
 
798
798
  @data.due = 1
799
- @data.update(@api).should be_true
799
+ @data.update(@api).should == true
800
800
  end
801
801
 
802
802
  it "Success (just awarded)" do
@@ -808,7 +808,7 @@ describe "Badge" do
808
808
 
809
809
  @data.awarded = 1
810
810
  @data.awarded_date = date
811
- @data.update(@api).should be_true
811
+ @data.update(@api).should == true
812
812
  end
813
813
 
814
814
  it "Failed (requirement)" do
@@ -823,7 +823,7 @@ describe "Badge" do
823
823
  @data.due = 1
824
824
  @data.awarded = 1
825
825
  @data.awarded_date = date
826
- @data.update(@api).should be_false
826
+ @data.update(@api).should == false
827
827
  end
828
828
 
829
829
  it "Failed (due)" do
@@ -837,7 +837,7 @@ describe "Badge" do
837
837
  @data.due = 1
838
838
  @data.awarded = 1
839
839
  @data.awarded_date = date
840
- @data.update(@api).should be_false
840
+ @data.update(@api).should == false
841
841
  end
842
842
 
843
843
  it "Failed (awarded)" do
@@ -851,7 +851,7 @@ describe "Badge" do
851
851
  @data.due = 1
852
852
  @data.awarded = 1
853
853
  @data.awarded_date = date
854
- @data.update(@api).should be_false
854
+ @data.update(@api).should == false
855
855
  end
856
856
 
857
857
  end
@@ -883,7 +883,7 @@ describe "Badge" do
883
883
  HTTParty.should_receive(:post).with(awarded_url, {:body => awarded_post_data}) { OsmTest::DummyHttpResult.new(:response=>{:code=>'200', :body=>awarded_body_data.to_json}) }
884
884
  Osm::Section.stub(:get) { Osm::Section.new(:id => 2, :type => :beavers) }
885
885
 
886
- data.mark_awarded(@api, Date.new(2000, 1, 2), 1).should be_true
886
+ data.mark_awarded(@api, Date.new(2000, 1, 2), 1).should == true
887
887
  end
888
888
 
889
889
  it "Mark badge due" do
@@ -914,7 +914,7 @@ describe "Badge" do
914
914
  HTTParty.should_receive(:post).with(awarded_url, {:body => awarded_post_data}) { OsmTest::DummyHttpResult.new(:response=>{:code=>'200', :body=>awarded_body_data.to_json}) }
915
915
  Osm::Section.stub(:get) { Osm::Section.new(:id => 2, :type => :beavers) }
916
916
 
917
- data.mark_due(@api, 1).should be_true
917
+ data.mark_due(@api, 1).should == true
918
918
  end
919
919
 
920
920
  it "Get summary data for a section" do