osm 0.0.17 → 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,10 +23,11 @@ describe "Event" do
23
23
  event.section_id.should == 2
24
24
  event.name.should == 'Event name'
25
25
  event.start.should == DateTime.new(2001, 1, 2, 12, 0, 0)
26
- event.end.should == nil
26
+ event.finish.should == nil
27
27
  event.cost.should == 'Free'
28
28
  event.location.should == 'Somewhere'
29
29
  event.notes.should == 'None'
30
+ event.valid?.should be_true
30
31
  end
31
32
 
32
33
  end
@@ -16,6 +16,7 @@ describe "Grouping" do
16
16
  patrol.name.should == 'Patrol Name'
17
17
  patrol.active.should == true
18
18
  patrol.points.should == 2
19
+ patrol.valid?.should be_true
19
20
  end
20
21
 
21
22
  end
@@ -71,6 +71,7 @@ describe "Member" do
71
71
  member.joined.should == Date.new(2006, 1, 7)
72
72
  member.age.should == '06/07'
73
73
  member.joined_years.should == 1
74
+ member.valid?.should be_true
74
75
  end
75
76
 
76
77
 
@@ -29,6 +29,7 @@ describe "Register Data" do
29
29
  Date.new(2012, 01, 10) => 'Yes',
30
30
  Date.new(2012, 01, 24) => 'No'
31
31
  }
32
+ rd.valid?.should be_true
32
33
  end
33
34
 
34
35
  end
@@ -18,6 +18,7 @@ describe "Register Field" do
18
18
  field.id.should == 'machine_name'
19
19
  field.name.should == 'Human name'
20
20
  field.tooltip.should == 'Tooltip'
21
+ field.valid?.should be_true
21
22
  end
22
23
 
23
24
  end
@@ -8,6 +8,9 @@ class DummySection
8
8
  def initialize(options={})
9
9
  options.each { |k,v| instance_variable_set("@#{k}", v) }
10
10
  end
11
+ def valid?
12
+ true
13
+ end
11
14
  end
12
15
 
13
16
 
@@ -17,12 +20,12 @@ describe "Role" do
17
20
  data = {
18
21
  'sectionid' => 1,
19
22
  'sectionname' => 'A Section',
20
- 'sectionConfig' => '{}',
23
+ 'sectionConfig' => '{"subscription_expires":"2000-01-02","numscouts":0}',
21
24
  'groupname' => 'A Group',
22
25
  'groupid' => '2',
23
26
  'groupNormalised' => '3',
24
27
  'isDefault' => '1',
25
- 'permissions' => {}
28
+ 'permissions' => {'something' => 100}
26
29
  }
27
30
  role = Osm::Role.from_api(data)
28
31
 
@@ -30,6 +33,7 @@ describe "Role" do
30
33
  role.section.name.should == 'A Section'
31
34
  role.group_id.should == 2
32
35
  role.group_name.should == 'A Group'
36
+ role.valid?.should be_true
33
37
  end
34
38
 
35
39
 
@@ -78,6 +78,8 @@ describe "Section" do
78
78
  section.flexi_records[1].id.should == 2
79
79
  section.flexi_records[1].name.should == 'Name 2'
80
80
  section.role.should == role
81
+
82
+ section.valid?.should be_true
81
83
  end
82
84
 
83
85
  it "Create has sensible defaults" do
@@ -10,7 +10,7 @@ describe "Term" do
10
10
  :section_id => 2,
11
11
  :name => 'Term name',
12
12
  :start => Date.new(2001, 01, 01),
13
- :end => Date.new(2001, 03, 31)
13
+ :finish => Date.new(2001, 03, 31)
14
14
  }
15
15
  end
16
16
 
@@ -28,7 +28,8 @@ describe "Term" do
28
28
  term.section_id.should == 2
29
29
  term.name.should == 'Term name'
30
30
  term.start.should == Date.new(2001, 1, 1)
31
- term.end.should == Date.new(2001, 3, 31)
31
+ term.finish.should == Date.new(2001, 3, 31)
32
+ term.valid?.should be_true
32
33
  end
33
34
 
34
35
 
@@ -46,11 +47,11 @@ describe "Term" do
46
47
 
47
48
 
48
49
  it "Sorts by Section ID, Start date and then Term ID" do
49
- term1 = Osm::Term.new(@attributes.merge(:section_id => 1, :term => 11, :start => (Date.today - 60), :end => (Date.today - 1)))
50
- term2 = Osm::Term.new(@attributes.merge(:section_id => 1, :term => 12, :start => (Date.today - 0), :end => (Date.today + 0)))
51
- term3 = Osm::Term.new(@attributes.merge(:section_id => 1, :term => 13, :start => (Date.today + 1), :end => (Date.today + 60)))
52
- term4 = Osm::Term.new(@attributes.merge(:section_id => 2, :term => 1, :start => (Date.today + 1), :end => (Date.today + 60)))
53
- term5 = Osm::Term.new(@attributes.merge(:section_id => 2, :term => 2, :start => (Date.today + 1), :end => (Date.today + 60)))
50
+ term1 = Osm::Term.new(@attributes.merge(:section_id => 1, :term => 11, :start => (Date.today - 60), :finish => (Date.today - 1)))
51
+ term2 = Osm::Term.new(@attributes.merge(:section_id => 1, :term => 12, :start => (Date.today - 0), :finish => (Date.today + 0)))
52
+ term3 = Osm::Term.new(@attributes.merge(:section_id => 1, :term => 13, :start => (Date.today + 1), :finish => (Date.today + 60)))
53
+ term4 = Osm::Term.new(@attributes.merge(:section_id => 2, :term => 1, :start => (Date.today + 1), :finish => (Date.today + 60)))
54
+ term5 = Osm::Term.new(@attributes.merge(:section_id => 2, :term => 2, :start => (Date.today + 1), :finish => (Date.today + 60)))
54
55
 
55
56
  data = [term5, term3, term2, term4, term1]
56
57
  data.sort.should == [term1, term2, term3, term4, term5]
@@ -58,9 +59,9 @@ describe "Term" do
58
59
 
59
60
 
60
61
  it "Works out if it is completly before a date" do
61
- term1 = Osm::Term.new(@attributes.merge(:start => (Date.today - 60), :end => (Date.today - 1)))
62
- term2 = Osm::Term.new(@attributes.merge(:start => (Date.today - 0), :end => (Date.today + 0)))
63
- term3 = Osm::Term.new(@attributes.merge(:start => (Date.today + 1), :end => (Date.today + 60)))
62
+ term1 = Osm::Term.new(@attributes.merge(:start => (Date.today - 60), :finish => (Date.today - 1)))
63
+ term2 = Osm::Term.new(@attributes.merge(:start => (Date.today - 0), :finish => (Date.today + 0)))
64
+ term3 = Osm::Term.new(@attributes.merge(:start => (Date.today + 1), :finish => (Date.today + 60)))
64
65
 
65
66
  term1.before?(Date.today).should == true
66
67
  term2.before?(Date.today).should == false
@@ -69,9 +70,9 @@ describe "Term" do
69
70
 
70
71
 
71
72
  it "Works out if it is completly after a date" do
72
- term1 = Osm::Term.new(@attributes.merge(:start => (Date.today - 60), :end => (Date.today - 1)))
73
- term2 = Osm::Term.new(@attributes.merge(:start => (Date.today - 0), :end => (Date.today + 0)))
74
- term3 = Osm::Term.new(@attributes.merge(:start => (Date.today + 1), :end => (Date.today + 60)))
73
+ term1 = Osm::Term.new(@attributes.merge(:start => (Date.today - 60), :finish => (Date.today - 1)))
74
+ term2 = Osm::Term.new(@attributes.merge(:start => (Date.today - 0), :finish => (Date.today + 0)))
75
+ term3 = Osm::Term.new(@attributes.merge(:start => (Date.today + 1), :finish => (Date.today + 60)))
75
76
 
76
77
  term1.after?(Date.today).should == false
77
78
  term2.after?(Date.today).should == false
@@ -80,9 +81,9 @@ describe "Term" do
80
81
 
81
82
 
82
83
  it "Works out if it has passed" do
83
- term1 = Osm::Term.new(@attributes.merge(:start => (Date.today - 60), :end => (Date.today - 1)))
84
- term2 = Osm::Term.new(@attributes.merge(:start => (Date.today - 0), :end => (Date.today + 0)))
85
- term3 = Osm::Term.new(@attributes.merge(:start => (Date.today + 1), :end => (Date.today + 60)))
84
+ term1 = Osm::Term.new(@attributes.merge(:start => (Date.today - 60), :finish => (Date.today - 1)))
85
+ term2 = Osm::Term.new(@attributes.merge(:start => (Date.today - 0), :finish => (Date.today + 0)))
86
+ term3 = Osm::Term.new(@attributes.merge(:start => (Date.today + 1), :finish => (Date.today + 60)))
86
87
 
87
88
  term1.past?().should == true
88
89
  term2.past?().should == false
@@ -91,9 +92,9 @@ describe "Term" do
91
92
 
92
93
 
93
94
  it "Works out if it is in the future" do
94
- term1 = Osm::Term.new(@attributes.merge(:start => (Date.today - 60), :end => (Date.today - 1)))
95
- term2 = Osm::Term.new(@attributes.merge(:start => (Date.today - 0), :end => (Date.today + 0)))
96
- term3 = Osm::Term.new(@attributes.merge(:start => (Date.today + 1), :end => (Date.today + 60)))
95
+ term1 = Osm::Term.new(@attributes.merge(:start => (Date.today - 60), :finish => (Date.today - 1)))
96
+ term2 = Osm::Term.new(@attributes.merge(:start => (Date.today - 0), :finish => (Date.today + 0)))
97
+ term3 = Osm::Term.new(@attributes.merge(:start => (Date.today + 1), :finish => (Date.today + 60)))
97
98
 
98
99
  term1.future?().should == false
99
100
  term2.future?().should == false
@@ -102,9 +103,9 @@ describe "Term" do
102
103
 
103
104
 
104
105
  it "Works out if it is the current term" do
105
- term1 = Osm::Term.new(@attributes.merge(:start => (Date.today - 60), :end => (Date.today - 1)))
106
- term2 = Osm::Term.new(@attributes.merge(:start=> (Date.today - 0), :end => (Date.today + 0)))
107
- term3 = Osm::Term.new(@attributes.merge(:start => (Date.today + 1), :end => (Date.today + 60)))
106
+ term1 = Osm::Term.new(@attributes.merge(:start => (Date.today - 60), :finish => (Date.today - 1)))
107
+ term2 = Osm::Term.new(@attributes.merge(:start=> (Date.today - 0), :finish => (Date.today + 0)))
108
+ term3 = Osm::Term.new(@attributes.merge(:start => (Date.today + 1), :finish => (Date.today + 60)))
108
109
 
109
110
  term1.current?().should == false
110
111
  term2.current?().should == true
@@ -113,9 +114,9 @@ describe "Term" do
113
114
 
114
115
 
115
116
  it "Works out if it contains a date" do
116
- term1 = Osm::Term.new(@attributes.merge(:start => (Date.today - 60), :end => (Date.today - 1)))
117
- term2 = Osm::Term.new(@attributes.merge(:start => (Date.today - 0), :end => (Date.today + 0)))
118
- term3 = Osm::Term.new(@attributes.merge(:start => (Date.today + 1), :end => (Date.today + 60)))
117
+ term1 = Osm::Term.new(@attributes.merge(:start => (Date.today - 60), :finish => (Date.today - 1)))
118
+ term2 = Osm::Term.new(@attributes.merge(:start => (Date.today - 0), :finish => (Date.today + 0)))
119
+ term3 = Osm::Term.new(@attributes.merge(:start => (Date.today + 1), :finish => (Date.today + 60)))
119
120
 
120
121
  term1.contains_date?(Date.today).should == false
121
122
  term2.contains_date?(Date.today).should == true
@@ -1,6 +1,8 @@
1
1
  require 'fakeweb'
2
2
  require 'httparty'
3
3
  require 'active_support'
4
+ require 'active_attr/rspec'
5
+ require 'active_model'
4
6
 
5
7
  require 'osm'
6
8
 
data/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Osm
2
- VERSION = "0.0.17"
2
+ VERSION = "0.0.18"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: osm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.18
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-04 00:00:00.000000000Z
12
+ date: 2012-09-12 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &76908740 !ruby/object:Gem::Requirement
16
+ requirement: &83140270 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '3.2'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *76908740
24
+ version_requirements: *83140270
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: httparty
27
- requirement: &76900500 !ruby/object:Gem::Requirement
27
+ requirement: &83124630 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,32 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *76900500
35
+ version_requirements: *83124630
36
+ - !ruby/object:Gem::Dependency
37
+ name: active_attr
38
+ requirement: &83124090 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *83124090
47
+ - !ruby/object:Gem::Dependency
48
+ name: activemodel
49
+ requirement: &83123540 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *83123540
36
58
  - !ruby/object:Gem::Dependency
37
59
  name: rake
38
- requirement: &76900110 !ruby/object:Gem::Requirement
60
+ requirement: &83123160 !ruby/object:Gem::Requirement
39
61
  none: false
40
62
  requirements:
41
63
  - - ! '>='
@@ -43,10 +65,10 @@ dependencies:
43
65
  version: '0'
44
66
  type: :development
45
67
  prerelease: false
46
- version_requirements: *76900110
68
+ version_requirements: *83123160
47
69
  - !ruby/object:Gem::Dependency
48
70
  name: rspec
49
- requirement: &76899880 !ruby/object:Gem::Requirement
71
+ requirement: &83122830 !ruby/object:Gem::Requirement
50
72
  none: false
51
73
  requirements:
52
74
  - - ! '>='
@@ -54,10 +76,10 @@ dependencies:
54
76
  version: '0'
55
77
  type: :development
56
78
  prerelease: false
57
- version_requirements: *76899880
79
+ version_requirements: *83122830
58
80
  - !ruby/object:Gem::Dependency
59
81
  name: fakeweb
60
- requirement: &76899670 !ruby/object:Gem::Requirement
82
+ requirement: &83122500 !ruby/object:Gem::Requirement
61
83
  none: false
62
84
  requirements:
63
85
  - - ! '>='
@@ -65,7 +87,7 @@ dependencies:
65
87
  version: '0'
66
88
  type: :development
67
89
  prerelease: false
68
- version_requirements: *76899670
90
+ version_requirements: *83122500
69
91
  description: Use the Online Scout Manager API (https://www.onlinescoutmanager.co.uk)
70
92
  to retrieve and save data.
71
93
  email:
@@ -82,6 +104,8 @@ files:
82
104
  - LICENSE.rdoc
83
105
  - README.md
84
106
  - Rakefile
107
+ - lib/array_of_validator.rb
108
+ - lib/hash_validator.rb
85
109
  - lib/osm.rb
86
110
  - lib/osm/activity.rb
87
111
  - lib/osm/api.rb