amee 4.2.0 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/spec/rails_spec.rb CHANGED
@@ -5,6 +5,18 @@ require 'spec_helper.rb'
5
5
  require 'amee/rails'
6
6
  require 'active_record'
7
7
 
8
+ class Rails
9
+ def self.env
10
+ 'test'
11
+ end
12
+ def self.root
13
+ File.join(File.dirname(__FILE__),'fixtures')
14
+ end
15
+ def self.logger
16
+ nil
17
+ end
18
+ end
19
+
8
20
  describe AMEE::Rails do
9
21
 
10
22
  class AMEETest < ActiveRecord::Base
@@ -43,4 +55,15 @@ describe AMEE::Rails do
43
55
 
44
56
  end
45
57
 
58
+ describe "loads configuration file correctly" do
59
+
60
+ it "should autoload config file when AMEE::Rails.connection is accessed" do
61
+ x = AMEE::Rails.connection(:authenticate => false)
62
+ x.server.should eql 'stage.amee.com'
63
+ x.username.should eql 'username'
64
+ x.password.should eql 'password'
65
+ end
66
+
67
+ end
68
+
46
69
  end
@@ -69,12 +69,25 @@ describe AMEE::Admin::ItemDefinition, "with an authenticated v3 connection" do
69
69
  @list.first.drill?.should be_false
70
70
  @list.first.data?.should be_true
71
71
  @list.first.versions.should == ['1.0', '2.0']
72
- @list.second.versions.should == ['2.0']
73
- @list.second.optional?('usageOne').should be_true
74
- @list.second.ignored?('usageTwo').should be_true
75
- @list.second.default.should be_nil
72
+ @list[1].versions.should == ['2.0']
73
+ @list[1].optional?('usageOne').should be_true
74
+ @list[1].ignored?('usageTwo').should be_true
75
+ @list[1].default.should be_nil
76
76
  @list.last.uid.should=='2B0A0E540D4C'
77
77
  end
78
+
79
+
80
+ it "should be able to load an item value definition list with only one usage" do
81
+ connection = flexmock "connection"
82
+ connection.should_receive(:v3_get).with("/#{AMEE::Connection.api_version}/definitions/B4DA9E4AD5F2;full", {}).and_return(fixture('itemdef_B4DA9E4AD5F2.xml')).once
83
+ connection.should_receive(:retries).and_return(0).once
84
+ connection.should_receive(:v3_get).with("/#{AMEE::Connection.api_version}/definitions/B4DA9E4AD5F2/values;full", {:resultStart => 0, :resultLimit => 10}).and_return(fixture('ivdlist_one_usage.xml')).once
85
+ @data = AMEE::Admin::ItemDefinition.load(connection,"B4DA9E4AD5F2")
86
+ @data.uid.should == "B4DA9E4AD5F2"
87
+ @list=@data.item_value_definition_list
88
+ @list.first.ignored?('default').should be_true
89
+ @list.first.compulsory?('default').should be_false
90
+ end
78
91
 
79
92
  it "should fail gracefully with incorrect data" do
80
93
  connection = flexmock "connection"
@@ -25,14 +25,14 @@ HERE
25
25
  <ItemValueDefinition>
26
26
  <WikiDoc>Mass of carbon per distance</WikiDoc>
27
27
  <Usages>
28
- <Usage>
29
- <Name>usageTwo</Name>
30
- <Type>IGNORED</Type>
31
- </Usage>
32
28
  <Usage>
33
29
  <Name>usageOne</Name>
34
30
  <Type>FORBIDDEN</Type>
35
31
  </Usage>
32
+ <Usage>
33
+ <Name>usageTwo</Name>
34
+ <Type>IGNORED</Type>
35
+ </Usage>
36
36
  </Usages>
37
37
  </ItemValueDefinition>
38
38
  EOF
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amee
3
3
  version: !ruby/object:Gem::Version
4
- hash: 55
4
+ hash: 51
5
5
  prerelease:
6
6
  segments:
7
7
  - 4
8
- - 2
8
+ - 3
9
9
  - 0
10
- version: 4.2.0
10
+ version: 4.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - James Smith
@@ -18,28 +18,40 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2011-11-17 00:00:00 +00:00
22
- default_executable: ameesh
21
+ date: 2011-12-23 00:00:00 Z
23
22
  dependencies:
24
23
  - !ruby/object:Gem::Dependency
25
- prerelease: false
26
- type: :runtime
27
24
  requirement: &id001 !ruby/object:Gem::Requirement
28
25
  none: false
29
26
  requirements:
30
- - - ~>
27
+ - - ">="
31
28
  - !ruby/object:Gem::Version
32
- hash: 7
29
+ hash: 3
33
30
  segments:
34
- - 3
35
31
  - 0
36
- version: "3.0"
37
- name: activesupport
32
+ version: "0"
38
33
  version_requirements: *id001
39
- - !ruby/object:Gem::Dependency
34
+ name: appraisal
40
35
  prerelease: false
41
36
  type: :runtime
37
+ - !ruby/object:Gem::Dependency
42
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 21
44
+ segments:
45
+ - 2
46
+ - 3
47
+ - 11
48
+ version: 2.3.11
49
+ version_requirements: *id002
50
+ name: activesupport
51
+ prerelease: false
52
+ type: :runtime
53
+ - !ruby/object:Gem::Dependency
54
+ requirement: &id003 !ruby/object:Gem::Requirement
43
55
  none: false
44
56
  requirements:
45
57
  - - ">="
@@ -48,12 +60,12 @@ dependencies:
48
60
  segments:
49
61
  - 0
50
62
  version: "0"
63
+ version_requirements: *id003
51
64
  name: json
52
- version_requirements: *id002
53
- - !ruby/object:Gem::Dependency
54
65
  prerelease: false
55
66
  type: :runtime
56
- requirement: &id003 !ruby/object:Gem::Requirement
67
+ - !ruby/object:Gem::Dependency
68
+ requirement: &id004 !ruby/object:Gem::Requirement
57
69
  none: false
58
70
  requirements:
59
71
  - - ">="
@@ -62,12 +74,12 @@ dependencies:
62
74
  segments:
63
75
  - 0
64
76
  version: "0"
77
+ version_requirements: *id004
65
78
  name: log4r
66
- version_requirements: *id003
67
- - !ruby/object:Gem::Dependency
68
79
  prerelease: false
69
80
  type: :runtime
70
- requirement: &id004 !ruby/object:Gem::Requirement
81
+ - !ruby/object:Gem::Dependency
82
+ requirement: &id005 !ruby/object:Gem::Requirement
71
83
  none: false
72
84
  requirements:
73
85
  - - ~>
@@ -78,12 +90,12 @@ dependencies:
78
90
  - 4
79
91
  - 4
80
92
  version: 1.4.4
93
+ version_requirements: *id005
81
94
  name: nokogiri
82
- version_requirements: *id004
83
- - !ruby/object:Gem::Dependency
84
95
  prerelease: false
85
- type: :development
86
- requirement: &id005 !ruby/object:Gem::Requirement
96
+ type: :runtime
97
+ - !ruby/object:Gem::Dependency
98
+ requirement: &id006 !ruby/object:Gem::Requirement
87
99
  none: false
88
100
  requirements:
89
101
  - - ~>
@@ -94,12 +106,12 @@ dependencies:
94
106
  - 0
95
107
  - 0
96
108
  version: 1.0.0
109
+ version_requirements: *id006
97
110
  name: bundler
98
- version_requirements: *id005
99
- - !ruby/object:Gem::Dependency
100
111
  prerelease: false
101
112
  type: :development
102
- requirement: &id006 !ruby/object:Gem::Requirement
113
+ - !ruby/object:Gem::Dependency
114
+ requirement: &id007 !ruby/object:Gem::Requirement
103
115
  none: false
104
116
  requirements:
105
117
  - - ~>
@@ -110,12 +122,12 @@ dependencies:
110
122
  - 6
111
123
  - 4
112
124
  version: 1.6.4
125
+ version_requirements: *id007
113
126
  name: jeweler
114
- version_requirements: *id006
115
- - !ruby/object:Gem::Dependency
116
127
  prerelease: false
117
128
  type: :development
118
- requirement: &id007 !ruby/object:Gem::Requirement
129
+ - !ruby/object:Gem::Dependency
130
+ requirement: &id008 !ruby/object:Gem::Requirement
119
131
  none: false
120
132
  requirements:
121
133
  - - "="
@@ -126,12 +138,12 @@ dependencies:
126
138
  - 6
127
139
  - 0
128
140
  version: 2.6.0
141
+ version_requirements: *id008
129
142
  name: rspec
130
- version_requirements: *id007
131
- - !ruby/object:Gem::Dependency
132
143
  prerelease: false
133
144
  type: :development
134
- requirement: &id008 !ruby/object:Gem::Requirement
145
+ - !ruby/object:Gem::Dependency
146
+ requirement: &id009 !ruby/object:Gem::Requirement
135
147
  none: false
136
148
  requirements:
137
149
  - - ">"
@@ -142,12 +154,12 @@ dependencies:
142
154
  - 8
143
155
  - 6
144
156
  version: 0.8.6
157
+ version_requirements: *id009
145
158
  name: flexmock
146
- version_requirements: *id008
147
- - !ruby/object:Gem::Dependency
148
159
  prerelease: false
149
160
  type: :development
150
- requirement: &id009 !ruby/object:Gem::Requirement
161
+ - !ruby/object:Gem::Dependency
162
+ requirement: &id010 !ruby/object:Gem::Requirement
151
163
  none: false
152
164
  requirements:
153
165
  - - ">="
@@ -156,12 +168,12 @@ dependencies:
156
168
  segments:
157
169
  - 0
158
170
  version: "0"
171
+ version_requirements: *id010
159
172
  name: memcache-client
160
- version_requirements: *id009
161
- - !ruby/object:Gem::Dependency
162
173
  prerelease: false
163
174
  type: :development
164
- requirement: &id010 !ruby/object:Gem::Requirement
175
+ - !ruby/object:Gem::Dependency
176
+ requirement: &id011 !ruby/object:Gem::Requirement
165
177
  none: false
166
178
  requirements:
167
179
  - - ">="
@@ -170,12 +182,12 @@ dependencies:
170
182
  segments:
171
183
  - 0
172
184
  version: "0"
185
+ version_requirements: *id011
173
186
  name: rcov
174
- version_requirements: *id010
175
- - !ruby/object:Gem::Dependency
176
187
  prerelease: false
177
188
  type: :development
178
- requirement: &id011 !ruby/object:Gem::Requirement
189
+ - !ruby/object:Gem::Dependency
190
+ requirement: &id012 !ruby/object:Gem::Requirement
179
191
  none: false
180
192
  requirements:
181
193
  - - ">="
@@ -184,23 +196,26 @@ dependencies:
184
196
  segments:
185
197
  - 0
186
198
  version: "0"
199
+ version_requirements: *id012
187
200
  name: rdoc
188
- version_requirements: *id011
189
- - !ruby/object:Gem::Dependency
190
201
  prerelease: false
191
202
  type: :development
192
- requirement: &id012 !ruby/object:Gem::Requirement
203
+ - !ruby/object:Gem::Dependency
204
+ requirement: &id013 !ruby/object:Gem::Requirement
193
205
  none: false
194
206
  requirements:
195
- - - ~>
207
+ - - ">="
196
208
  - !ruby/object:Gem::Version
197
- hash: 7
209
+ hash: 21
198
210
  segments:
211
+ - 2
199
212
  - 3
200
- - 0
201
- version: "3.0"
213
+ - 11
214
+ version: 2.3.11
215
+ version_requirements: *id013
202
216
  name: activerecord
203
- version_requirements: *id012
217
+ prerelease: false
218
+ type: :development
204
219
  description:
205
220
  email: james@floppy.org.uk
206
221
  executables:
@@ -211,6 +226,8 @@ extra_rdoc_files:
211
226
  - LICENSE.txt
212
227
  - README.txt
213
228
  files:
229
+ - .rvmrc
230
+ - Appraisals
214
231
  - CHANGELOG.txt
215
232
  - Gemfile
216
233
  - Gemfile.lock
@@ -218,7 +235,6 @@ files:
218
235
  - README.txt
219
236
  - Rakefile
220
237
  - VERSION
221
- - amee-ruby.gemspec
222
238
  - amee.example.yml
223
239
  - amee.gemspec
224
240
  - bin/ameesh
@@ -229,6 +245,13 @@ files:
229
245
  - examples/view_data_category.rb
230
246
  - examples/view_data_item.rb
231
247
  - examples/view_profile_item.rb
248
+ - gemfiles/rails2.3.gemfile
249
+ - gemfiles/rails2.3.gemfile.lock
250
+ - gemfiles/rails3.0.gemfile
251
+ - gemfiles/rails3.0.gemfile.lock
252
+ - gemfiles/rails3.1.gemfile
253
+ - gemfiles/rails3.1.gemfile.lock
254
+ - init.rb
232
255
  - lib/amee.rb
233
256
  - lib/amee/collection.rb
234
257
  - lib/amee/config.rb
@@ -263,6 +286,7 @@ files:
263
286
  - lib/amee/v3/item_value_definition_list.rb
264
287
  - lib/amee/v3/meta_helper.rb
265
288
  - lib/amee/v3/return_value_definition.rb
289
+ - rails/init.rb
266
290
  - spec/amee_config_spec.rb
267
291
  - spec/amee_spec.rb
268
292
  - spec/cache_spec.rb
@@ -276,6 +300,7 @@ files:
276
300
  - spec/fixtures/AD63A83B4D41.json
277
301
  - spec/fixtures/AD63A83B4D41.xml
278
302
  - spec/fixtures/BD88D30D1214.xml
303
+ - spec/fixtures/config/amee.yml
279
304
  - spec/fixtures/create_item.json
280
305
  - spec/fixtures/create_item.xml
281
306
  - spec/fixtures/data.json
@@ -288,10 +313,12 @@ files:
288
313
  - spec/fixtures/empty_return_value_definition_list.xml
289
314
  - spec/fixtures/itemdef.xml
290
315
  - spec/fixtures/itemdef_441BF4BEA15B.xml
316
+ - spec/fixtures/itemdef_B4DA9E4AD5F2.xml
291
317
  - spec/fixtures/itemdef_no_usages.xml
292
318
  - spec/fixtures/itemdef_one_usage.xml
293
319
  - spec/fixtures/ivdlist.xml
294
320
  - spec/fixtures/ivdlist_BD88D30D1214.xml
321
+ - spec/fixtures/ivdlist_one_usage.xml
295
322
  - spec/fixtures/parse_test.xml
296
323
  - spec/fixtures/rails_config.yml
297
324
  - spec/fixtures/return_value_definition.xml
@@ -316,7 +343,6 @@ files:
316
343
  - spec/v3/item_definition_spec.rb
317
344
  - spec/v3/item_value_definition_spec.rb
318
345
  - spec/v3/return_value_definition_spec.rb
319
- has_rdoc: true
320
346
  homepage: http://github.com/AMEE/amee-ruby
321
347
  licenses:
322
348
  - BSD 3-Clause
@@ -346,7 +372,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
346
372
  requirements: []
347
373
 
348
374
  rubyforge_project:
349
- rubygems_version: 1.6.2
375
+ rubygems_version: 1.8.10
350
376
  signing_key:
351
377
  specification_version: 3
352
378
  summary: Ruby interface to the AMEE carbon calculator
data/amee-ruby.gemspec DELETED
@@ -1,147 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{amee-ruby}
8
- s.version = "2.7.0"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["James Smith"]
12
- s.date = %q{2011-08-09}
13
- s.default_executable = %q{ameesh}
14
- s.email = %q{james@floppy.org.uk}
15
- s.executables = ["ameesh"]
16
- s.extra_rdoc_files = [
17
- "README"
18
- ]
19
- s.files = [
20
- "CHANGELOG",
21
- "COPYING",
22
- "Gemfile",
23
- "README",
24
- "Rakefile",
25
- "VERSION",
26
- "amee-ruby.gemspec",
27
- "amee.example.yml",
28
- "bin/ameesh",
29
- "cacert.pem",
30
- "examples/create_profile.rb",
31
- "examples/create_profile_item.rb",
32
- "examples/list_profiles.rb",
33
- "examples/view_data_category.rb",
34
- "examples/view_data_item.rb",
35
- "examples/view_profile_item.rb",
36
- "init.rb",
37
- "lib/amee.rb",
38
- "lib/amee/collection.rb",
39
- "lib/amee/connection.rb",
40
- "lib/amee/data_category.rb",
41
- "lib/amee/data_item.rb",
42
- "lib/amee/data_item_value.rb",
43
- "lib/amee/data_item_value_history.rb",
44
- "lib/amee/data_object.rb",
45
- "lib/amee/drill_down.rb",
46
- "lib/amee/exceptions.rb",
47
- "lib/amee/item_definition.rb",
48
- "lib/amee/item_value_definition.rb",
49
- "lib/amee/logger.rb",
50
- "lib/amee/object.rb",
51
- "lib/amee/pager.rb",
52
- "lib/amee/parse_helper.rb",
53
- "lib/amee/profile.rb",
54
- "lib/amee/profile_category.rb",
55
- "lib/amee/profile_item.rb",
56
- "lib/amee/profile_item_value.rb",
57
- "lib/amee/profile_object.rb",
58
- "lib/amee/rails.rb",
59
- "lib/amee/shell.rb",
60
- "lib/amee/user.rb",
61
- "rails/init.rb",
62
- "spec/amee_spec.rb",
63
- "spec/cache_spec.rb",
64
- "spec/connection_spec.rb",
65
- "spec/data_category_spec.rb",
66
- "spec/data_item_spec.rb",
67
- "spec/data_item_value_history_spec.rb",
68
- "spec/data_item_value_spec.rb",
69
- "spec/data_object_spec.rb",
70
- "spec/drill_down_spec.rb",
71
- "spec/fixtures/AD63A83B4D41.json",
72
- "spec/fixtures/AD63A83B4D41.xml",
73
- "spec/fixtures/create_item.json",
74
- "spec/fixtures/create_item.xml",
75
- "spec/fixtures/data.json",
76
- "spec/fixtures/data.xml",
77
- "spec/fixtures/data_home_energy_quantity.xml",
78
- "spec/fixtures/data_home_energy_quantity_biodiesel.xml",
79
- "spec/fixtures/data_transport_car_generic_drill_fuel_diesel.xml",
80
- "spec/fixtures/empty.json",
81
- "spec/fixtures/empty.xml",
82
- "spec/fixtures/parse_test.xml",
83
- "spec/fixtures/v0_data_transport_transport_drill_transportType_Car1.xml",
84
- "spec/item_definition_spec.rb",
85
- "spec/item_value_definition_spec.rb",
86
- "spec/logger_spec.rb",
87
- "spec/object_spec.rb",
88
- "spec/parse_helper_spec.rb",
89
- "spec/profile_category_spec.rb",
90
- "spec/profile_item_spec.rb",
91
- "spec/profile_item_value_spec.rb",
92
- "spec/profile_object_spec.rb",
93
- "spec/profile_spec.rb",
94
- "spec/rails_spec.rb",
95
- "spec/spec.opts",
96
- "spec/spec_helper.rb",
97
- "spec/user_spec.rb"
98
- ]
99
- s.homepage = %q{http://github.com/Floppy/amee-ruby}
100
- s.licenses = ["MIT"]
101
- s.require_paths = ["lib"]
102
- s.rubygems_version = %q{1.6.2}
103
- s.summary = %q{Ruby interface to the AMEE carbon calculator}
104
-
105
- if s.respond_to? :specification_version then
106
- s.specification_version = 3
107
-
108
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
109
- s.add_runtime_dependency(%q<activesupport>, ["~> 2.3.5"])
110
- s.add_runtime_dependency(%q<json>, [">= 0"])
111
- s.add_runtime_dependency(%q<log4r>, [">= 0"])
112
- s.add_runtime_dependency(%q<nokogiri>, ["~> 1.4.3.1"])
113
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
114
- s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
115
- s.add_development_dependency(%q<rspec>, ["= 1.3.0"])
116
- s.add_development_dependency(%q<rcov>, [">= 0"])
117
- s.add_development_dependency(%q<rspec_spinner>, ["= 1.1.3"])
118
- s.add_development_dependency(%q<activerecord>, ["~> 2.3.5"])
119
- s.add_development_dependency(%q<flexmock>, [">= 0"])
120
- else
121
- s.add_dependency(%q<activesupport>, ["~> 2.3.5"])
122
- s.add_dependency(%q<json>, [">= 0"])
123
- s.add_dependency(%q<log4r>, [">= 0"])
124
- s.add_dependency(%q<nokogiri>, ["~> 1.4.3.1"])
125
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
126
- s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
127
- s.add_dependency(%q<rspec>, ["= 1.3.0"])
128
- s.add_dependency(%q<rcov>, [">= 0"])
129
- s.add_dependency(%q<rspec_spinner>, ["= 1.1.3"])
130
- s.add_dependency(%q<activerecord>, ["~> 2.3.5"])
131
- s.add_dependency(%q<flexmock>, [">= 0"])
132
- end
133
- else
134
- s.add_dependency(%q<activesupport>, ["~> 2.3.5"])
135
- s.add_dependency(%q<json>, [">= 0"])
136
- s.add_dependency(%q<log4r>, [">= 0"])
137
- s.add_dependency(%q<nokogiri>, ["~> 1.4.3.1"])
138
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
139
- s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
140
- s.add_dependency(%q<rspec>, ["= 1.3.0"])
141
- s.add_dependency(%q<rcov>, [">= 0"])
142
- s.add_dependency(%q<rspec_spinner>, ["= 1.1.3"])
143
- s.add_dependency(%q<activerecord>, ["~> 2.3.5"])
144
- s.add_dependency(%q<flexmock>, [">= 0"])
145
- end
146
- end
147
-