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.
- checksums.yaml +8 -8
- data/CHANGELOG.md +35 -0
- data/gemfiles/rails3 +1 -1
- data/lib/hash_validator.rb +12 -4
- data/lib/osm/api.rb +5 -6
- data/lib/osm/member.rb +503 -171
- data/lib/osm/section.rb +1 -26
- data/lib/validity_validator.rb +11 -0
- data/osm.gemspec +1 -1
- data/spec/array_of_validator_spec.rb +1 -1
- data/spec/hash_validator_spec.rb +133 -0
- data/spec/osm/activity_spec.rb +7 -7
- data/spec/osm/api_access_spec.rb +1 -1
- data/spec/osm/api_spec.rb +4 -4
- data/spec/osm/badge_spec.rb +62 -62
- data/spec/osm/badges_spec.rb +4 -4
- data/spec/osm/budget_spec.rb +8 -8
- data/spec/osm/event_spec.rb +42 -42
- data/spec/osm/flexi_record_spec.rb +18 -18
- data/spec/osm/giftaid_spec.rb +7 -7
- data/spec/osm/grouping_spec.rb +5 -5
- data/spec/osm/invoice_spec.rb +32 -32
- data/spec/osm/meeting_spec.rb +10 -10
- data/spec/osm/member_spec.rb +316 -167
- data/spec/osm/model_spec.rb +31 -31
- data/spec/osm/register_spec.rb +15 -15
- data/spec/osm/section_spec.rb +28 -71
- data/spec/osm/sms_spec.rb +1 -1
- data/spec/osm/term_spec.rb +31 -31
- data/spec/validity_validator_spec.rb +32 -0
- data/version.rb +1 -1
- metadata +13 -10
data/spec/osm/sms_spec.rb
CHANGED
@@ -156,7 +156,7 @@ describe "SMS" do
|
|
156
156
|
report.last_updated.should == DateTime.new(2000, 1, 2, 3, 5, 6)
|
157
157
|
report.credits.should == 7
|
158
158
|
report.status.should == :delivered
|
159
|
-
report.valid?.should
|
159
|
+
report.valid?.should == true
|
160
160
|
end
|
161
161
|
|
162
162
|
describe "Status helpers" do
|
data/spec/osm/term_spec.rb
CHANGED
@@ -22,7 +22,7 @@ describe "Term" do
|
|
22
22
|
term.name.should == 'Term name'
|
23
23
|
term.start.should == Date.new(2001, 1, 1)
|
24
24
|
term.finish.should == Date.new(2001, 3, 31)
|
25
|
-
term.valid?.should
|
25
|
+
term.valid?.should == true
|
26
26
|
end
|
27
27
|
|
28
28
|
it "Compares two matching terms" do
|
@@ -53,9 +53,9 @@ describe "Term" do
|
|
53
53
|
term2 = Osm::Term.new(@attributes.merge(:start => (Date.today - 0), :finish => (Date.today + 0)))
|
54
54
|
term3 = Osm::Term.new(@attributes.merge(:start => (Date.today + 1), :finish => (Date.today + 60)))
|
55
55
|
|
56
|
-
term1.before?(Date.today).should
|
57
|
-
term2.before?(Date.today).should
|
58
|
-
term3.before?(Date.today).should
|
56
|
+
term1.before?(Date.today).should == true
|
57
|
+
term2.before?(Date.today).should == false
|
58
|
+
term3.before?(Date.today).should == false
|
59
59
|
end
|
60
60
|
|
61
61
|
it "Works out if it is completly after a date" do
|
@@ -63,9 +63,9 @@ describe "Term" do
|
|
63
63
|
term2 = Osm::Term.new(@attributes.merge(:start => (Date.today - 0), :finish => (Date.today + 0)))
|
64
64
|
term3 = Osm::Term.new(@attributes.merge(:start => (Date.today + 1), :finish => (Date.today + 60)))
|
65
65
|
|
66
|
-
term1.after?(Date.today).should
|
67
|
-
term2.after?(Date.today).should
|
68
|
-
term3.after?(Date.today).should
|
66
|
+
term1.after?(Date.today).should == false
|
67
|
+
term2.after?(Date.today).should == false
|
68
|
+
term3.after?(Date.today).should == true
|
69
69
|
end
|
70
70
|
|
71
71
|
it "Works out if it has passed" do
|
@@ -73,9 +73,9 @@ describe "Term" do
|
|
73
73
|
term2 = Osm::Term.new(@attributes.merge(:start => (Date.today - 0), :finish => (Date.today + 0)))
|
74
74
|
term3 = Osm::Term.new(@attributes.merge(:start => (Date.today + 1), :finish => (Date.today + 60)))
|
75
75
|
|
76
|
-
term1.past?().should
|
77
|
-
term2.past?().should
|
78
|
-
term3.past?().should
|
76
|
+
term1.past?().should == true
|
77
|
+
term2.past?().should == false
|
78
|
+
term3.past?().should == false
|
79
79
|
end
|
80
80
|
|
81
81
|
it "Works out if it is in the future" do
|
@@ -83,9 +83,9 @@ describe "Term" do
|
|
83
83
|
term2 = Osm::Term.new(@attributes.merge(:start => (Date.today - 0), :finish => (Date.today + 0)))
|
84
84
|
term3 = Osm::Term.new(@attributes.merge(:start => (Date.today + 1), :finish => (Date.today + 60)))
|
85
85
|
|
86
|
-
term1.future?().should
|
87
|
-
term2.future?().should
|
88
|
-
term3.future?().should
|
86
|
+
term1.future?().should == false
|
87
|
+
term2.future?().should == false
|
88
|
+
term3.future?().should == true
|
89
89
|
end
|
90
90
|
|
91
91
|
it "Works out if it is the current term" do
|
@@ -93,9 +93,9 @@ describe "Term" do
|
|
93
93
|
term2 = Osm::Term.new(@attributes.merge(:start=> (Date.today - 0), :finish => (Date.today + 0)))
|
94
94
|
term3 = Osm::Term.new(@attributes.merge(:start => (Date.today + 1), :finish => (Date.today + 60)))
|
95
95
|
|
96
|
-
term1.current?().should
|
97
|
-
term2.current?().should
|
98
|
-
term3.current?().should
|
96
|
+
term1.current?().should == false
|
97
|
+
term2.current?().should == true
|
98
|
+
term3.current?().should == false
|
99
99
|
end
|
100
100
|
|
101
101
|
it "Works out if it contains a date" do
|
@@ -103,19 +103,19 @@ describe "Term" do
|
|
103
103
|
term2 = Osm::Term.new(@attributes.merge(:start => (Date.today - 0), :finish => (Date.today + 0)))
|
104
104
|
term3 = Osm::Term.new(@attributes.merge(:start => (Date.today + 1), :finish => (Date.today + 60)))
|
105
105
|
|
106
|
-
term1.contains_date?(Date.today).should
|
107
|
-
term2.contains_date?(Date.today).should
|
108
|
-
term3.contains_date?(Date.today).should
|
106
|
+
term1.contains_date?(Date.today).should == false
|
107
|
+
term2.contains_date?(Date.today).should == true
|
108
|
+
term3.contains_date?(Date.today).should == false
|
109
109
|
end
|
110
110
|
|
111
111
|
it "Date helpers return false for nil dates" do
|
112
112
|
term = Osm::Term.new
|
113
|
-
term.before?(Date.today).should
|
114
|
-
term.after?(Date.today).should
|
115
|
-
term.past?.should
|
116
|
-
term.future?.should
|
117
|
-
term.current?.should
|
118
|
-
term.contains_date?(Date.today).should
|
113
|
+
term.before?(Date.today).should == false
|
114
|
+
term.after?(Date.today).should == false
|
115
|
+
term.past?.should == false
|
116
|
+
term.future?.should == false
|
117
|
+
term.current?.should == false
|
118
|
+
term.contains_date?(Date.today).should == false
|
119
119
|
end
|
120
120
|
|
121
121
|
|
@@ -147,7 +147,7 @@ describe "Term" do
|
|
147
147
|
terms.size.should == 3
|
148
148
|
terms.map{ |i| i.id }.should == [1, 2, 3]
|
149
149
|
term = terms[0]
|
150
|
-
term.is_a?(Osm::Term).should
|
150
|
+
term.is_a?(Osm::Term).should == true
|
151
151
|
term.id.should == 1
|
152
152
|
term.name.should == 'Term 1'
|
153
153
|
term.start.should == (Date.today + 31)
|
@@ -169,7 +169,7 @@ describe "Term" do
|
|
169
169
|
|
170
170
|
it "Gets a term" do
|
171
171
|
term = Osm::Term.get(@api, 2)
|
172
|
-
term.is_a?(Osm::Term).should
|
172
|
+
term.is_a?(Osm::Term).should == true
|
173
173
|
term.id.should == 2
|
174
174
|
end
|
175
175
|
|
@@ -220,7 +220,7 @@ describe "Term" do
|
|
220
220
|
:name => 'A Term',
|
221
221
|
:start => Date.new(2010, 01, 01),
|
222
222
|
:finish => Date.new(2010, 12, 31),
|
223
|
-
}).should
|
223
|
+
}).should == true
|
224
224
|
end
|
225
225
|
|
226
226
|
it "Create a term (failed)" do
|
@@ -244,7 +244,7 @@ describe "Term" do
|
|
244
244
|
:name => 'A Term',
|
245
245
|
:start => Date.new(2010, 01, 01),
|
246
246
|
:finish => Date.new(2010, 12, 31),
|
247
|
-
}).should
|
247
|
+
}).should == false
|
248
248
|
end
|
249
249
|
|
250
250
|
it "Update a term" do
|
@@ -263,7 +263,7 @@ describe "Term" do
|
|
263
263
|
HTTParty.should_receive(:post).with(url, {:body => post_data}) { OsmTest::DummyHttpResult.new(:response=>{:code=>'200', :body=>'{"terms":{}}'}) }
|
264
264
|
|
265
265
|
term = Osm::Term.new(:id=>2, :section_id=>1, :name=>'A Term', :start=>Date.new(2010, 01, 01), :finish=>Date.new(2010, 12, 31))
|
266
|
-
term.update(@api).should
|
266
|
+
term.update(@api).should == true
|
267
267
|
end
|
268
268
|
|
269
269
|
it "Update a term (failed)" do
|
@@ -282,7 +282,7 @@ describe "Term" do
|
|
282
282
|
HTTParty.should_receive(:post).with(url, {:body => post_data}) { OsmTest::DummyHttpResult.new(:response=>{:code=>'200', :body=>'{}'}) }
|
283
283
|
|
284
284
|
term = Osm::Term.new(:id=>2, :section_id=>1, :name=>'A Term', :start=>Date.new(2010, 01, 01), :finish=>Date.new(2010, 12, 31))
|
285
|
-
term.update(@api).should
|
285
|
+
term.update(@api).should == false
|
286
286
|
end
|
287
287
|
|
288
288
|
it "Update a term (invalid term)" do
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
|
5
|
+
class TestItem
|
6
|
+
include ActiveAttr::Model
|
7
|
+
attribute :validity
|
8
|
+
validates_inclusion_of :validity, :in => [true]
|
9
|
+
end
|
10
|
+
|
11
|
+
class TestModel
|
12
|
+
include ActiveAttr::Model
|
13
|
+
attribute :item
|
14
|
+
validates :item, :validity => true
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "validity validator" do
|
18
|
+
|
19
|
+
it "Item is valid" do
|
20
|
+
model = TestModel.new(item: TestItem.new(validity: true))
|
21
|
+
model.valid?.should == true
|
22
|
+
model.errors.count.should == 0
|
23
|
+
end
|
24
|
+
|
25
|
+
it "Item is invalid" do
|
26
|
+
model = TestModel.new(item: TestItem.new(validity: false))
|
27
|
+
model.valid?.should == false
|
28
|
+
model.errors.count.should == 2
|
29
|
+
model.errors.messages.should == {:item => ['must be valid', 'validity attribute is invalid: is not included in the list']}
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
data/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: osm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.18.dev
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Gauld
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -110,22 +110,22 @@ dependencies:
|
|
110
110
|
name: rspec
|
111
111
|
requirement: !ruby/object:Gem::Requirement
|
112
112
|
requirements:
|
113
|
-
- - ~>
|
114
|
-
- !ruby/object:Gem::Version
|
115
|
-
version: '2.0'
|
116
113
|
- - ! '>='
|
117
114
|
- !ruby/object:Gem::Version
|
118
115
|
version: 2.14.1
|
116
|
+
- - <
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '4'
|
119
119
|
type: :development
|
120
120
|
prerelease: false
|
121
121
|
version_requirements: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
|
-
- - ~>
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '2.0'
|
126
123
|
- - ! '>='
|
127
124
|
- !ruby/object:Gem::Version
|
128
125
|
version: 2.14.1
|
126
|
+
- - <
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '4'
|
129
129
|
- !ruby/object:Gem::Dependency
|
130
130
|
name: fakeweb
|
131
131
|
requirement: !ruby/object:Gem::Requirement
|
@@ -241,8 +241,10 @@ files:
|
|
241
241
|
- lib/osm/section.rb
|
242
242
|
- lib/osm/sms.rb
|
243
243
|
- lib/osm/term.rb
|
244
|
+
- lib/validity_validator.rb
|
244
245
|
- osm.gemspec
|
245
246
|
- spec/array_of_validator_spec.rb
|
247
|
+
- spec/hash_validator_spec.rb
|
246
248
|
- spec/osm/activity_spec.rb
|
247
249
|
- spec/osm/api_access_spec.rb
|
248
250
|
- spec/osm/api_spec.rb
|
@@ -263,6 +265,7 @@ files:
|
|
263
265
|
- spec/osm/sms_spec.rb
|
264
266
|
- spec/osm/term_spec.rb
|
265
267
|
- spec/spec_helper.rb
|
268
|
+
- spec/validity_validator_spec.rb
|
266
269
|
- version.rb
|
267
270
|
homepage: https://github.com/robertgauld/osm
|
268
271
|
licenses:
|
@@ -279,9 +282,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
279
282
|
version: '0'
|
280
283
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
281
284
|
requirements:
|
282
|
-
- - ! '
|
285
|
+
- - ! '>'
|
283
286
|
- !ruby/object:Gem::Version
|
284
|
-
version:
|
287
|
+
version: 1.3.1
|
285
288
|
requirements: []
|
286
289
|
rubyforge_project: osm
|
287
290
|
rubygems_version: 2.2.2
|