cloudfactory 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/cf.gemspec +1 -0
  2. data/features/error_custom_task_form.feature +117 -0
  3. data/features/error_form_field.feature +58 -0
  4. data/features/error_task_form.feature +64 -0
  5. data/features/errors.feature +192 -0
  6. data/features/run.feature +136 -121
  7. data/features/support/cli_steps.rb +44 -0
  8. data/features/support/env.rb +2 -2
  9. data/lib/cf.rb +3 -4
  10. data/lib/cf/account.rb +12 -1
  11. data/lib/cf/cli.rb +2 -2
  12. data/lib/cf/cli/config.rb +2 -2
  13. data/lib/cf/cli/form.rb +5 -5
  14. data/lib/cf/cli/line.rb +40 -16
  15. data/lib/cf/cli/production.rb +50 -18
  16. data/lib/cf/cli/templates/sample-line/form.css +41 -17
  17. data/lib/cf/cli/templates/sample-line/form.html +27 -18
  18. data/lib/cf/cli/templates/sample-line/form.js +12 -3
  19. data/lib/cf/cli/templates/sample-line/line.yml.erb +42 -32
  20. data/lib/cf/client.rb +3 -3
  21. data/lib/cf/custom_task_form.rb +21 -91
  22. data/lib/cf/department.rb +1 -10
  23. data/lib/cf/final_output.rb +2 -16
  24. data/lib/cf/form_field.rb +11 -6
  25. data/lib/cf/human_worker.rb +93 -1
  26. data/lib/cf/input_format.rb +10 -62
  27. data/lib/cf/line.rb +46 -37
  28. data/lib/cf/robot_worker.rb +63 -2
  29. data/lib/cf/run.rb +37 -66
  30. data/lib/cf/station.rb +42 -104
  31. data/lib/cf/task_form.rb +17 -56
  32. data/lib/cf/version.rb +2 -2
  33. data/lib/generators/cf/form/form_generator.rb +3 -3
  34. data/lib/generators/cf/install/install_generator.rb +3 -3
  35. data/spec/custom_task_form_spec.rb +169 -1
  36. data/spec/generators/form_generator_spec.rb +2 -2
  37. data/spec/generators/install_generator_spec.rb +2 -2
  38. data/spec/run_spec.rb +3 -3
  39. data/spec/spec_helper.rb +1 -0
  40. data/spec/station_spec.rb +13 -1
  41. data/spec/task_form_spec.rb +38 -6
  42. metadata +63 -44
@@ -5,8 +5,8 @@ require 'generator_spec/test_case'
5
5
 
6
6
  require 'generators/cf/form/form_generator'
7
7
 
8
- module Cf
9
- module Generators
8
+ module Cf # :nodoc: all
9
+ module Generators # :nodoc: all
10
10
  describe FormGenerator, "Passing both the Labels and Field:Type" do
11
11
  include GeneratorSpec::TestCase
12
12
  destination File.expand_path("../tmp", __FILE__)
@@ -5,8 +5,8 @@ require 'generator_spec/test_case'
5
5
 
6
6
  require 'generators/cf/install/install_generator'
7
7
 
8
- module Cf
9
- module Generators
8
+ module Cf # :nodoc: all
9
+ module Generators # :nodoc: all
10
10
  describe InstallGenerator, "using custom matcher" do
11
11
  include GeneratorSpec::TestCase
12
12
  destination File.expand_path("../tmp", __FILE__)
data/spec/run_spec.rb CHANGED
@@ -250,8 +250,8 @@ module CF
250
250
  end
251
251
 
252
252
  it "should create production run with invalid data" do
253
- # WebMock.allow_net_connect!
254
- VCR.use_cassette "run/block/create-run-invalid-file", :record => :new_episodes do
253
+ WebMock.allow_net_connect!
254
+ # VCR.use_cassette "run/block/create-run-invalid-file", :record => :new_episodes do
255
255
  line = CF::Line.create("media_splitting_robot_4","Digitization") do |l|
256
256
  CF::InputFormat.new({:line => l, :name => "url", :valid_type => "url", :required => "true"})
257
257
  CF::Station.create({:line => l, :type => "work"}) do |s|
@@ -261,7 +261,7 @@ module CF
261
261
  run = CF::Run.create(line, "media_splitting_robot_run_4", File.expand_path("../../fixtures/input_data/media_converter_robot.csv", __FILE__))
262
262
  run.errors.should eql(["Extra Headers in file: [url_1]", "Insufficient Headers in file: [url]"])
263
263
 
264
- end
264
+ # end
265
265
  end
266
266
 
267
267
  it "should create production run with used title data" do
data/spec/spec_helper.rb CHANGED
@@ -2,6 +2,7 @@ require 'cf'
2
2
  require 'vcr'
3
3
  require 'webmock'
4
4
  require 'ruby-debug'
5
+ require 'rails'
5
6
 
6
7
  RSpec.configure do |config|
7
8
  config.before(:suite) do
data/spec/station_spec.rb CHANGED
@@ -222,7 +222,7 @@ describe CF::Station do
222
222
  end
223
223
  end
224
224
 
225
- context "create a station without passing station type" do
225
+ context "create a station with errors" do
226
226
  it "in plain ruby way and it should display an error message" do
227
227
  # WebMock.allow_net_connect!
228
228
  VCR.use_cassette "stations/plain-ruby/create-without-type", :record => :new_episodes do
@@ -252,5 +252,17 @@ describe CF::Station do
252
252
  line.stations.first.errors.should eql("Input formats not assigned for the line #{line.title.downcase}")
253
253
  end
254
254
  end
255
+
256
+ it "Tournament station displaying errors due to invalid settings" do
257
+ # WebMock.allow_net_connect!
258
+ VCR.use_cassette "stations/block/tournament-station-error", :record => :new_episodes do
259
+ line = CF::Line.create("Digitized-91", "Digitization") do
260
+ CF::InputFormat.new({:line => self, :name => "image_url", :required => true, :valid_type => "url"})
261
+ CF::Station.new({:line => self, :type => "tournament"})
262
+ end
263
+ line.stations.first.type.should eq("Tournament")
264
+ line.stations.first.errors.should eql("[\"Jury worker can't be blank\"]")
265
+ end
266
+ end
255
267
  end
256
268
  end
@@ -25,7 +25,7 @@ describe CF::TaskForm do
25
25
  end
26
26
  end
27
27
 
28
- xit "with invalid data" do
28
+ it "with blank data" do
29
29
  WebMock.allow_net_connect!
30
30
  # VCR.use_cassette "task_form/block/create", :record => :new_episodes do
31
31
  line = CF::Line.create("Digiti-ard-2", "Digitization") do
@@ -35,12 +35,44 @@ describe CF::TaskForm do
35
35
  CF::TaskForm.new({:station => station})
36
36
  end
37
37
  end
38
- # debugger
39
38
  form = line.stations[0].form
40
- form.instruction.should eq("Describe")
41
- form.form_fields.first.label.should eq("First Name")
42
- form.form_fields.first.field_type.should eq("SA")
43
- form.form_fields.first.required.should eq(true)
39
+ form.errors.should eql("[\"Title can't be blank\", \"Instruction can't be blank\"]")
40
+ form.instruction.should eq(nil)
41
+ form.form_fields.should eq([])
42
+ # end
43
+ end
44
+
45
+ it "without Title" do
46
+ WebMock.allow_net_connect!
47
+ # VCR.use_cassette "task_form/block/create", :record => :new_episodes do
48
+ line = CF::Line.create("Digiti-ard-21", "Digitization") do
49
+ CF::InputFormat.new({:line => self, :name => "image_url", :required => true, :valid_type => "url"})
50
+ CF::Station.create({:line => self, :type => "work"}) do |station|
51
+ CF::HumanWorker.new({:station => station, :number => 2, :reward => 20})
52
+ CF::TaskForm.new({:station => station, :instruction => "describe"})
53
+ end
54
+ end
55
+ form = line.stations[0].form
56
+ form.errors.should eql("[\"Title can't be blank\"]")
57
+ form.instruction.should eq("describe")
58
+ form.form_fields.should eq([])
59
+ # end
60
+ end
61
+
62
+ it "without Instruction" do
63
+ WebMock.allow_net_connect!
64
+ # VCR.use_cassette "task_form/block/create", :record => :new_episodes do
65
+ line = CF::Line.create("Digiti-ard-22", "Digitization") do
66
+ CF::InputFormat.new({:line => self, :name => "image_url", :required => true, :valid_type => "url"})
67
+ CF::Station.create({:line => self, :type => "work"}) do |station|
68
+ CF::HumanWorker.new({:station => station, :number => 2, :reward => 20})
69
+ CF::TaskForm.new({:station => station, :title => "title"})
70
+ end
71
+ end
72
+ form = line.stations[0].form
73
+ form.errors.should eql("[\"Instruction can't be blank\"]")
74
+ form.title.should eq("title")
75
+ form.form_fields.should eq([])
44
76
  # end
45
77
  end
46
78
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudfactory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
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: 2011-08-10 00:00:00.000000000Z
12
+ date: 2011-08-12 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: i18n
16
- requirement: &2154589380 !ruby/object:Gem::Requirement
16
+ requirement: &2156538240 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2154589380
24
+ version_requirements: *2156538240
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activesupport
27
- requirement: &2154588880 !ruby/object:Gem::Requirement
27
+ requirement: &2156537740 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 3.0.3
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2154588880
35
+ version_requirements: *2156537740
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: hashie
38
- requirement: &2154588380 !ruby/object:Gem::Requirement
38
+ requirement: &2156537240 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.0.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2154588380
46
+ version_requirements: *2156537240
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rest-client
49
- requirement: &2154588000 !ruby/object:Gem::Requirement
49
+ requirement: &2156536860 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2154588000
57
+ version_requirements: *2156536860
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: json
60
- requirement: &2154587540 !ruby/object:Gem::Requirement
60
+ requirement: &2156684620 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *2154587540
68
+ version_requirements: *2156684620
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: thor
71
- requirement: &2154587040 !ruby/object:Gem::Requirement
71
+ requirement: &2156684120 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 0.14.6
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *2154587040
79
+ version_requirements: *2156684120
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: highline
82
- requirement: &2154586620 !ruby/object:Gem::Requirement
82
+ requirement: &2156683700 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *2154586620
90
+ version_requirements: *2156683700
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: httparty
93
- requirement: &2154586080 !ruby/object:Gem::Requirement
93
+ requirement: &2156683160 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: 0.7.8
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *2154586080
101
+ version_requirements: *2156683160
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: terminal-table
104
- requirement: &2154585580 !ruby/object:Gem::Requirement
104
+ requirement: &2156682660 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ~>
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: 1.4.2
110
110
  type: :runtime
111
111
  prerelease: false
112
- version_requirements: *2154585580
112
+ version_requirements: *2156682660
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: millisami-csv-hash
115
- requirement: &2154585200 !ruby/object:Gem::Requirement
115
+ requirement: &2156682280 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: '0'
121
121
  type: :runtime
122
122
  prerelease: false
123
- version_requirements: *2154585200
123
+ version_requirements: *2156682280
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: ruby-debug19
126
- requirement: &2154584740 !ruby/object:Gem::Requirement
126
+ requirement: &2156681820 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ! '>='
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
- version_requirements: *2154584740
134
+ version_requirements: *2156681820
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: aruba
137
- requirement: &2154584320 !ruby/object:Gem::Requirement
137
+ requirement: &2156681400 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ! '>='
@@ -142,10 +142,10 @@ dependencies:
142
142
  version: '0'
143
143
  type: :development
144
144
  prerelease: false
145
- version_requirements: *2154584320
145
+ version_requirements: *2156681400
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: rails
148
- requirement: &2154583820 !ruby/object:Gem::Requirement
148
+ requirement: &2156680900 !ruby/object:Gem::Requirement
149
149
  none: false
150
150
  requirements:
151
151
  - - ~>
@@ -153,10 +153,10 @@ dependencies:
153
153
  version: 3.0.3
154
154
  type: :development
155
155
  prerelease: false
156
- version_requirements: *2154583820
156
+ version_requirements: *2156680900
157
157
  - !ruby/object:Gem::Dependency
158
158
  name: bundler
159
- requirement: &2154583320 !ruby/object:Gem::Requirement
159
+ requirement: &2156680400 !ruby/object:Gem::Requirement
160
160
  none: false
161
161
  requirements:
162
162
  - - ~>
@@ -164,10 +164,10 @@ dependencies:
164
164
  version: 1.0.0
165
165
  type: :development
166
166
  prerelease: false
167
- version_requirements: *2154583320
167
+ version_requirements: *2156680400
168
168
  - !ruby/object:Gem::Dependency
169
169
  name: generator_spec
170
- requirement: &2154582860 !ruby/object:Gem::Requirement
170
+ requirement: &2156679940 !ruby/object:Gem::Requirement
171
171
  none: false
172
172
  requirements:
173
173
  - - ~>
@@ -175,10 +175,10 @@ dependencies:
175
175
  version: 0.8.3
176
176
  type: :development
177
177
  prerelease: false
178
- version_requirements: *2154582860
178
+ version_requirements: *2156679940
179
179
  - !ruby/object:Gem::Dependency
180
180
  name: rspec-rails
181
- requirement: &2156141760 !ruby/object:Gem::Requirement
181
+ requirement: &2156679560 !ruby/object:Gem::Requirement
182
182
  none: false
183
183
  requirements:
184
184
  - - ! '>='
@@ -186,10 +186,10 @@ dependencies:
186
186
  version: '0'
187
187
  type: :development
188
188
  prerelease: false
189
- version_requirements: *2156141760
189
+ version_requirements: *2156679560
190
190
  - !ruby/object:Gem::Dependency
191
191
  name: cucumber
192
- requirement: &2156141300 !ruby/object:Gem::Requirement
192
+ requirement: &2156679100 !ruby/object:Gem::Requirement
193
193
  none: false
194
194
  requirements:
195
195
  - - ! '>='
@@ -197,10 +197,10 @@ dependencies:
197
197
  version: '0'
198
198
  type: :development
199
199
  prerelease: false
200
- version_requirements: *2156141300
200
+ version_requirements: *2156679100
201
201
  - !ruby/object:Gem::Dependency
202
202
  name: rdoc
203
- requirement: &2156140800 !ruby/object:Gem::Requirement
203
+ requirement: &2156678600 !ruby/object:Gem::Requirement
204
204
  none: false
205
205
  requirements:
206
206
  - - ~>
@@ -208,10 +208,10 @@ dependencies:
208
208
  version: 3.5.3
209
209
  type: :development
210
210
  prerelease: false
211
- version_requirements: *2156140800
211
+ version_requirements: *2156678600
212
212
  - !ruby/object:Gem::Dependency
213
213
  name: vcr
214
- requirement: &2156140380 !ruby/object:Gem::Requirement
214
+ requirement: &2156678180 !ruby/object:Gem::Requirement
215
215
  none: false
216
216
  requirements:
217
217
  - - ! '>='
@@ -219,10 +219,10 @@ dependencies:
219
219
  version: '0'
220
220
  type: :development
221
221
  prerelease: false
222
- version_requirements: *2156140380
222
+ version_requirements: *2156678180
223
223
  - !ruby/object:Gem::Dependency
224
224
  name: rake
225
- requirement: &2156139920 !ruby/object:Gem::Requirement
225
+ requirement: &2156677720 !ruby/object:Gem::Requirement
226
226
  none: false
227
227
  requirements:
228
228
  - - ! '>='
@@ -230,10 +230,10 @@ dependencies:
230
230
  version: '0'
231
231
  type: :development
232
232
  prerelease: false
233
- version_requirements: *2156139920
233
+ version_requirements: *2156677720
234
234
  - !ruby/object:Gem::Dependency
235
235
  name: webmock
236
- requirement: &2156139500 !ruby/object:Gem::Requirement
236
+ requirement: &2156677300 !ruby/object:Gem::Requirement
237
237
  none: false
238
238
  requirements:
239
239
  - - ! '>='
@@ -241,7 +241,18 @@ dependencies:
241
241
  version: '0'
242
242
  type: :development
243
243
  prerelease: false
244
- version_requirements: *2156139500
244
+ version_requirements: *2156677300
245
+ - !ruby/object:Gem::Dependency
246
+ name: timecop
247
+ requirement: &2156676880 !ruby/object:Gem::Requirement
248
+ none: false
249
+ requirements:
250
+ - - ! '>='
251
+ - !ruby/object:Gem::Version
252
+ version: '0'
253
+ type: :development
254
+ prerelease: false
255
+ version_requirements: *2156676880
245
256
  description: A Ruby wrapper and CLI for to interact with Cloudfactory.com REST API
246
257
  email:
247
258
  - info@cloudfactory.com
@@ -257,6 +268,10 @@ files:
257
268
  - Rakefile
258
269
  - bin/cf
259
270
  - cf.gemspec
271
+ - features/error_custom_task_form.feature
272
+ - features/error_form_field.feature
273
+ - features/error_task_form.feature
274
+ - features/errors.feature
260
275
  - features/form_generation.feature
261
276
  - features/form_preview.feature
262
277
  - features/line_creation.feature
@@ -372,6 +387,10 @@ signing_key:
372
387
  specification_version: 3
373
388
  summary: A Ruby wrapper and CLI for Cloudfactory.com
374
389
  test_files:
390
+ - features/error_custom_task_form.feature
391
+ - features/error_form_field.feature
392
+ - features/error_task_form.feature
393
+ - features/errors.feature
375
394
  - features/form_generation.feature
376
395
  - features/form_preview.feature
377
396
  - features/line_creation.feature