cloudfactory 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +7 -0
- data/lib/cf/cli.rb +41 -41
- data/lib/cf/cli/line.rb +24 -4
- data/lib/cf/cli/line_yaml_validator.rb +3 -1
- data/lib/cf/cli/templates/sample-line/sample-line.csv +2 -2
- data/lib/cf/line.rb +20 -7
- data/lib/cf/station.rb +35 -12
- data/lib/cf/version.rb +1 -1
- data/spec/badge_spec.rb +6 -6
- data/spec/concept_tagging_robot_spec.rb +2 -0
- data/spec/content_scraping_robot_spec.rb +6 -4
- data/spec/custom_task_form_spec.rb +11 -11
- data/spec/entity_extraction_robot_spec.rb +12 -10
- data/spec/form_field_spec.rb +6 -6
- data/spec/google_translate_robot_spec.rb +4 -3
- data/spec/human_worker_spec.rb +8 -8
- data/spec/image_processing_robot_spec.rb +2 -0
- data/spec/input_format_spec.rb +2 -3
- data/spec/keyword_matching_and_text_extraction_robot_spec.rb +2 -0
- data/spec/line_spec.rb +21 -21
- data/spec/mailer_robot_spec.rb +8 -6
- data/spec/media_converter_robot_spec.rb +8 -7
- data/spec/media_splitting_robot_spec.rb +2 -0
- data/spec/robot_worker_spec.rb +1 -1
- data/spec/run_spec.rb +31 -20
- data/spec/sentiment_robot_spec.rb +2 -0
- data/spec/station_spec.rb +11 -14
- data/spec/task_form_spec.rb +9 -9
- data/spec/term_extraction_robot_spec.rb +6 -4
- data/spec/text_appending_robot_spec.rb +2 -2
- metadata +48 -48
data/spec/mailer_robot_spec.rb
CHANGED
@@ -9,15 +9,16 @@ module CF
|
|
9
9
|
VCR.use_cassette "robot_worker/mailer_robot/block/create-worker-single-station", :record => :new_episodes do
|
10
10
|
@template = "<html><body><h1>Hello {{to}} Welcome to CLoudfactory!!!!</h1><p>Thanks for using!!!!</p></body></html>"
|
11
11
|
line = CF::Line.create("mailer_robot","Digitization") do |l|
|
12
|
-
CF::InputFormat.new({:line => l, :name => "to", :
|
12
|
+
CF::InputFormat.new({:line => l, :name => "to", :required => "true"})
|
13
13
|
CF::Station.create({:line => l, :type => "work"}) do |s|
|
14
14
|
CF::RobotWorker.create({:station => s, :type => "mailer_robot", :settings => {:to => ["manish.das@sprout-technology.com"], :template => @template}})
|
15
15
|
end
|
16
16
|
end
|
17
17
|
run = CF::Run.create(line, "mailer_robot_run", [{"to"=> "manish.das@sprout-technology.com"}])
|
18
|
+
# sleep 20
|
18
19
|
output = run.final_output
|
19
|
-
output.first['recipients_of_to'].should eql([
|
20
|
-
output.first['sent_message_for_to'].should eql(
|
20
|
+
output.first['recipients_of_to'].should eql(["manish.das@sprout-technology.com"])
|
21
|
+
output.first['sent_message_for_to'].should eql("<html><body><h1>Hello manish.das@sprout-technology.com Welcome to CLoudfactory!!!!</h1><p>Thanks for using!!!!</p></body></html>")
|
21
22
|
line.stations.first.worker.class.should eql(CF::RobotWorker)
|
22
23
|
line.stations.first.worker.reward.should eql(0.01)
|
23
24
|
line.stations.first.worker.number.should eql(1)
|
@@ -31,7 +32,7 @@ module CF
|
|
31
32
|
VCR.use_cassette "robot_worker/mailer_robot/plain-ruby/create-worker-in-first-station", :record => :new_episodes do
|
32
33
|
@template = "<html><body><h1>Hello {{to}} Welcome to CLoudfactory!!!!</h1><p>Thanks for using!!!!</p></body></html>"
|
33
34
|
line = CF::Line.new("mailer_robot_1","Digitization")
|
34
|
-
input_format = CF::InputFormat.new({:name => "to", :required => "true"
|
35
|
+
input_format = CF::InputFormat.new({:name => "to", :required => "true"})
|
35
36
|
line.input_formats input_format
|
36
37
|
|
37
38
|
station = CF::Station.new({:type => "work"})
|
@@ -41,9 +42,10 @@ module CF
|
|
41
42
|
line.stations.first.worker = worker
|
42
43
|
|
43
44
|
run = CF::Run.create(line, "mailer_robot_run_1", [{"to"=> "manish.das@sprout-technology.com"}])
|
45
|
+
# sleep 20
|
44
46
|
output = run.final_output
|
45
|
-
output.first['recipients_of_to'].should eql([
|
46
|
-
output.first['sent_message_for_to'].should eql(
|
47
|
+
output.first['recipients_of_to'].should eql(["manish.das@sprout-technology.com"])
|
48
|
+
output.first['sent_message_for_to'].should eql("<html><body><h1>Hello manish.das@sprout-technology.com Welcome to CLoudfactory!!!!</h1><p>Thanks for using!!!!</p></body></html>")
|
47
49
|
line.stations.first.worker.class.should eql(CF::RobotWorker)
|
48
50
|
line.stations.first.worker.reward.should eql(0.01)
|
49
51
|
line.stations.first.worker.number.should eql(1)
|
@@ -11,13 +11,13 @@ module CF
|
|
11
11
|
input_format = CF::InputFormat.new({:name => "url", :required => true, :valid_type => "url"})
|
12
12
|
line.input_formats input_format
|
13
13
|
|
14
|
-
input_format_1 = CF::InputFormat.new({:name => "to", :required => false
|
14
|
+
input_format_1 = CF::InputFormat.new({:name => "to", :required => false})
|
15
15
|
line.input_formats input_format_1
|
16
16
|
|
17
|
-
input_format_2 = CF::InputFormat.new({:name => "audio_quality", :required => false
|
17
|
+
input_format_2 = CF::InputFormat.new({:name => "audio_quality", :required => false})
|
18
18
|
line.input_formats input_format_2
|
19
19
|
|
20
|
-
input_format_3 = CF::InputFormat.new({:name => "video_quality", :required => false
|
20
|
+
input_format_3 = CF::InputFormat.new({:name => "video_quality", :required => false})
|
21
21
|
line.input_formats input_format_3
|
22
22
|
|
23
23
|
station = CF::Station.new({:type => "work"})
|
@@ -33,6 +33,7 @@ module CF
|
|
33
33
|
line.stations.first.form.form_fields form_fields
|
34
34
|
|
35
35
|
run = CF::Run.create(line, "media_converter_robot_run", [{"url"=> "http://media-robot.s3.amazonaws.com/media_robot/media/upload/8/ten.mov", "to" => "mpg", "audio_quality" => "320", "video_quality" => "3"}])
|
36
|
+
# sleep 20
|
36
37
|
@final_output = run.final_output
|
37
38
|
line.stations.first.worker.number.should eq(1)
|
38
39
|
converted_url = @final_output.first['converted_file_from_url']
|
@@ -45,16 +46,16 @@ module CF
|
|
45
46
|
VCR.use_cassette "robot_worker/media_converter_robot/block/create-worker-block-dsl-way", :record => :new_episodes do
|
46
47
|
line = CF::Line.create("media_converter_robot_1","Digitization") do |l|
|
47
48
|
CF::InputFormat.new({:line => l, :name => "url", :required => true, :valid_type => "url"})
|
48
|
-
CF::InputFormat.new({:line => l, :name => "to", :required => false
|
49
|
-
CF::InputFormat.new({:line => l, :name => "audio_quality", :required => false
|
50
|
-
CF::InputFormat.new({:line => l, :name => "video_quality", :required => false
|
49
|
+
CF::InputFormat.new({:line => l, :name => "to", :required => false})
|
50
|
+
CF::InputFormat.new({:line => l, :name => "audio_quality", :required => false})
|
51
|
+
CF::InputFormat.new({:line => l, :name => "video_quality", :required => false})
|
51
52
|
CF::Station.create({:line => l, :type => "work"}) do |s|
|
52
53
|
CF::RobotWorker.create({:station => s, :type => "media_converter_robot", :settings => {:url => ["{{url}}"], :to => "{{to}}", :audio_quality => "{{audio_quality}}", :video_quality => "{{video_quality}}"}})
|
53
54
|
end
|
54
55
|
end
|
55
56
|
|
56
57
|
run = CF::Run.create(line, "media_converter_robot_run_1", [{"url"=> "http://media-robot.s3.amazonaws.com/media_robot/media/upload/8/ten.mov", "to" => "mpg", "audio_quality" => "320", "video_quality" => "3"}])
|
57
|
-
|
58
|
+
# sleep 20
|
58
59
|
@final_output = run.final_output
|
59
60
|
line.stations.first.worker.number.should eq(1)
|
60
61
|
converted_url = @final_output.first['converted_file_from_url']
|
@@ -14,6 +14,7 @@ module CF
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
run = CF::Run.create(line, "media_splitting_robot_run", [{"url"=> "http://media-robot.s3.amazonaws.com/media_robot/media/upload/8/ten.mov"}])
|
17
|
+
# sleep 20
|
17
18
|
output = run.final_output
|
18
19
|
converted_url_1= output.first['splits_of_url'].first
|
19
20
|
converted_url_2= output.first['splits_of_url'].last
|
@@ -41,6 +42,7 @@ module CF
|
|
41
42
|
line.stations.first.worker = worker
|
42
43
|
|
43
44
|
run = CF::Run.create(line, "media_splitting_robot_run_1", [{"url"=> "http://media-robot.s3.amazonaws.com/media_robot/media/upload/8/ten.mov"}])
|
45
|
+
# sleep 20
|
44
46
|
output = run.final_output
|
45
47
|
converted_url_1= output.first['splits_of_url'].first
|
46
48
|
converted_url_2= output.first['splits_of_url'].last
|
data/spec/robot_worker_spec.rb
CHANGED
@@ -6,7 +6,7 @@ describe CF::RobotWorker do
|
|
6
6
|
VCR.use_cassette "robot_worker/block/display-to_s", :record => :new_episodes do
|
7
7
|
# WebMock.allow_net_connect!
|
8
8
|
line = CF::Line.create("display_entity_extraction_robot","Digitization") do |l|
|
9
|
-
CF::InputFormat.new({:line => l, :name => "text", :
|
9
|
+
CF::InputFormat.new({:line => l, :name => "text", :required => "true"})
|
10
10
|
CF::Station.create({:line => l, :type => "work"}) do |s|
|
11
11
|
CF::RobotWorker.create({:station => s, :type => "entity_extraction_robot", :settings => {:document => ["Franz Kafka and George Orwell are authors. Ludwig Von Beethoven and Mozart are musicians. China and Japan are countries"]}})
|
12
12
|
end
|
data/spec/run_spec.rb
CHANGED
@@ -107,7 +107,7 @@ module CF
|
|
107
107
|
it "for a line in a plain ruby way" do
|
108
108
|
VCR.use_cassette "run/plain-ruby/create-run", :record => :new_episodes do
|
109
109
|
line = CF::Line.new("Digitize--ard1", "Digitization")
|
110
|
-
input_format_1 = CF::InputFormat.new({:name => "Company", :required => true
|
110
|
+
input_format_1 = CF::InputFormat.new({:name => "Company", :required => true})
|
111
111
|
input_format_2 = CF::InputFormat.new({:name => "Website", :required => true, :valid_type => "url"})
|
112
112
|
line.input_formats input_format_1
|
113
113
|
line.input_formats input_format_2
|
@@ -158,11 +158,11 @@ module CF
|
|
158
158
|
it "should fetch result" do
|
159
159
|
VCR.use_cassette "run/block/create-run-fetch-result", :record => :new_episodes do
|
160
160
|
line = CF::Line.create("Digarde-00111111111","Digitization") do |l|
|
161
|
-
CF::InputFormat.new({:line => l, :name => "Company", :required => true
|
161
|
+
CF::InputFormat.new({:line => l, :name => "Company", :required => true})
|
162
162
|
CF::InputFormat.new({:line => l, :name => "Website", :required => true, :valid_type => "url"})
|
163
163
|
CF::Station.create({:line => l, :type => "work"}) do |s|
|
164
164
|
CF::HumanWorker.new({:station => s, :number => 1, :reward => 20})
|
165
|
-
CF::TaskForm.create({:station => s, :title => "Enter about CEO from
|
165
|
+
CF::TaskForm.create({:station => s, :title => "Enter about CEO from card1", :instruction => "Describe"}) do |i|
|
166
166
|
CF::FormField.new({:form => i, :label => "First Name", :field_type => "short_answer", :required => "true"})
|
167
167
|
CF::FormField.new({:form => i, :label => "Middle Name", :field_type => "short_answer"})
|
168
168
|
CF::FormField.new({:form => i, :label => "Last Name", :field_type => "short_answer", :required => "true"})
|
@@ -190,6 +190,7 @@ module CF
|
|
190
190
|
end
|
191
191
|
end
|
192
192
|
run = CF::Run.create(line, "keyword_matching_robot_run_result", [{"url"=> "http://techcrunch.com/2011/07/26/with-v2-0-assistly-brings-a-simple-pricing-model-rewards-and-a-bit-of-free-to-customer-service-software"}, {"url"=> "http://techcrunch.com/2011/07/26/buddytv-iphone/"}])
|
193
|
+
# sleep 30
|
193
194
|
output = run.final_output
|
194
195
|
output.first['included_keywords_count_in_contents_of_url'].should eql(["3", "2", "2"])
|
195
196
|
output.first['keyword_included_in_contents_of_url'].should eql(["SaaS", "see", "additional"])
|
@@ -265,6 +266,7 @@ module CF
|
|
265
266
|
end
|
266
267
|
end
|
267
268
|
run = CF::Run.create(line, "media_splitting_robot_run_6", [{"url"=> "http://media-robot.s3.amazonaws.com/media_robot/media/upload/8/ten.mov"}])
|
269
|
+
sleep 10
|
268
270
|
found_run = CF::Run.find("media_splitting_robot_run_6")
|
269
271
|
found_run.code.should eql(200)
|
270
272
|
found_run.title.should eql("media_splitting_robot_run_6")
|
@@ -286,7 +288,7 @@ module CF
|
|
286
288
|
run = CF::Run.create(line, "media_splitting_robot_run_7", [{"url"=> "http://media-robot.s3.amazonaws.com/media_robot/media/upload/8/ten.mov"}])
|
287
289
|
found_run = CF::Run.find("unused_title")
|
288
290
|
found_run.code.should eql(404)
|
289
|
-
found_run.errors.should eql("Run document not found using selector: {:
|
291
|
+
found_run.errors.should eql("Run document not found using selector: {:title=>\"unused_title\"}")
|
290
292
|
end
|
291
293
|
end
|
292
294
|
end
|
@@ -302,6 +304,7 @@ module CF
|
|
302
304
|
end
|
303
305
|
end
|
304
306
|
run = CF::Run.create(line, "progress_run", [{"url"=> "http://www.sprout-technology.com"}])
|
307
|
+
# sleep 20
|
305
308
|
progress = run.progress
|
306
309
|
progress_1 = CF::Run.progress("progress_run")
|
307
310
|
progress.should eql(progress_1)
|
@@ -319,6 +322,7 @@ module CF
|
|
319
322
|
end
|
320
323
|
end
|
321
324
|
run = CF::Run.create(line, "progress_run_1", [{"url"=> "http://www.sprout-technology.com"}])
|
325
|
+
# sleep 20
|
322
326
|
progress = run.progress_details
|
323
327
|
progress_1 = CF::Run.progress_details("progress_run_1")
|
324
328
|
progress.should eql(progress_1)
|
@@ -340,6 +344,7 @@ module CF
|
|
340
344
|
end
|
341
345
|
end
|
342
346
|
run = CF::Run.create(line, "progress_run_2", [{"url"=> "http://techcrunch.com/2011/07/26/with-v2-0-assistly-brings-a-simple-pricing-model-rewards-and-a-bit-of-free-to-customer-service-software"}])
|
347
|
+
# sleep 30
|
343
348
|
progress = run.progress_details
|
344
349
|
progress_1 = CF::Run.progress_details("progress_run_2")
|
345
350
|
progress.should eql(progress_1)
|
@@ -360,7 +365,7 @@ module CF
|
|
360
365
|
end
|
361
366
|
end
|
362
367
|
run = CF::Run.create(line, "progress_run_3", [{"url"=> "http://www.sprout-technology.com"}])
|
363
|
-
|
368
|
+
# sleep 10
|
364
369
|
line_1 = CF::Line.create("progress_run_line_31","Digitization") do |l|
|
365
370
|
CF::InputFormat.new({:line => l, :name => "url", :valid_type => "url", :required => "true"})
|
366
371
|
CF::Station.create({:line => l, :type => "work"}) do |s|
|
@@ -368,7 +373,7 @@ module CF
|
|
368
373
|
end
|
369
374
|
end
|
370
375
|
run_1 = CF::Run.create(line_1, "progress_run_31", [{"url"=> "http://www.sprout-technology.com"}])
|
371
|
-
|
376
|
+
# sleep 10
|
372
377
|
line_2 = CF::Line.create("progress_run_line_32","Digitization") do |l|
|
373
378
|
CF::InputFormat.new({:line => l, :name => "url", :valid_type => "url", :required => "true"})
|
374
379
|
CF::Station.create({:line => l, :type => "work"}) do |s|
|
@@ -376,10 +381,10 @@ module CF
|
|
376
381
|
end
|
377
382
|
end
|
378
383
|
run_2 = CF::Run.create(line_2, "progress_run_32", [{"url"=> "http://www.sprout-technology.com"}])
|
379
|
-
|
384
|
+
# sleep 10
|
380
385
|
got_run = CF::Run.all
|
381
386
|
got_run['runs'].class.should eql(Array)
|
382
|
-
got_run['runs'].first['progress'].should eql(
|
387
|
+
got_run['runs'].first['progress'].should eql(0)
|
383
388
|
got_run['runs'].first['status'].should eql("active")
|
384
389
|
end
|
385
390
|
end
|
@@ -394,8 +399,11 @@ module CF
|
|
394
399
|
end
|
395
400
|
end
|
396
401
|
run = CF::Run.create(line, "progress_run_11", [{"url"=> "http://www.sprout-technology.com"}])
|
402
|
+
# sleep 10
|
397
403
|
run_1 = CF::Run.create(line, "progress_run_12", [{"url"=> "http://www.sprout-technology.com"}])
|
404
|
+
# sleep 10
|
398
405
|
run_2 = CF::Run.create(line, "progress_run_13", [{"url"=> "http://www.sprout-technology.com"}])
|
406
|
+
# sleep 10
|
399
407
|
got_run = CF::Run.all({:line_title => "progress_run_line_11"})
|
400
408
|
got_run['runs'][0]['title'].should eql("progress_run_11")
|
401
409
|
got_run['runs'][1]['title'].should eql("progress_run_12")
|
@@ -408,7 +416,7 @@ module CF
|
|
408
416
|
# WebMock.allow_net_connect!
|
409
417
|
run = CF::Run.all({:page => 1})
|
410
418
|
run['runs'].class.should eql(Array)
|
411
|
-
run['runs'].first['progress'].should eql(
|
419
|
+
run['runs'].first['progress'].should eql(0)
|
412
420
|
run['runs'].first['status'].should eql("active")
|
413
421
|
end
|
414
422
|
end
|
@@ -438,7 +446,7 @@ module CF
|
|
438
446
|
# WebMock.allow_net_connect!
|
439
447
|
# change account available_balance to 10 cents
|
440
448
|
line = CF::Line.create("resume_run_line","Digitization") do |l|
|
441
|
-
CF::InputFormat.new({:line => l, :name => "Company", :required => true
|
449
|
+
CF::InputFormat.new({:line => l, :name => "Company", :required => true})
|
442
450
|
CF::InputFormat.new({:line => l, :name => "Website", :required => true, :valid_type => "url"})
|
443
451
|
CF::Station.create({:line => l, :type => "work"}) do |s|
|
444
452
|
CF::HumanWorker.new({:station => s, :number => 1, :reward => 20})
|
@@ -450,7 +458,7 @@ module CF
|
|
450
458
|
end
|
451
459
|
end
|
452
460
|
run = CF::Run.create(line, "resume_run", [{"Company"=>"Apple,Inc","Website"=>"Apple.com"},{"Company"=>"Google","Website"=>"google.com"}])
|
453
|
-
|
461
|
+
# sleep 10
|
454
462
|
# debugger
|
455
463
|
# Change account available_balance to 200000 cents
|
456
464
|
resumed_run = CF::Run.resume("resume_run")
|
@@ -466,7 +474,7 @@ module CF
|
|
466
474
|
VCR.use_cassette "run/block/adding_units", :record => :new_episodes do
|
467
475
|
# WebMock.allow_net_connect!
|
468
476
|
line = CF::Line.create("adding_units","Digitization") do |l|
|
469
|
-
CF::InputFormat.new({:line => l, :name => "Company", :required => true
|
477
|
+
CF::InputFormat.new({:line => l, :name => "Company", :required => true})
|
470
478
|
CF::InputFormat.new({:line => l, :name => "Website", :required => true, :valid_type => "url"})
|
471
479
|
CF::Station.create({:line => l, :type => "work"}) do |s|
|
472
480
|
CF::HumanWorker.new({:station => s, :number => 1, :reward => 20})
|
@@ -478,8 +486,9 @@ module CF
|
|
478
486
|
end
|
479
487
|
end
|
480
488
|
run = CF::Run.create(line, "adding_units_run", [{"Company"=>"Apple,Inc","Website"=>"Apple.com"}])
|
489
|
+
# sleep 10
|
481
490
|
added_units = CF::Run.add_units(:run_title => "adding_units_run", :units => [{"Company"=>"Apple,Inc","Website"=>"Apple.com"}, {"Company"=>"Sprout","Website"=>"sprout.com"}])
|
482
|
-
added_units['successfull'].should eql("
|
491
|
+
added_units['successfull'].should eql("Sucessfully added 2 units, Failed :0")
|
483
492
|
run.title.should eql("adding_units_run")
|
484
493
|
end
|
485
494
|
end
|
@@ -488,7 +497,7 @@ module CF
|
|
488
497
|
VCR.use_cassette "run/block/adding_units_file", :record => :new_episodes do
|
489
498
|
# WebMock.allow_net_connect!
|
490
499
|
line = CF::Line.create("adding_units_file","Digitization") do |l|
|
491
|
-
CF::InputFormat.new({:line => l, :name => "Company", :required => true
|
500
|
+
CF::InputFormat.new({:line => l, :name => "Company", :required => true})
|
492
501
|
CF::InputFormat.new({:line => l, :name => "Website", :required => true, :valid_type => "url"})
|
493
502
|
CF::Station.create({:line => l, :type => "work"}) do |s|
|
494
503
|
CF::HumanWorker.new({:station => s, :number => 1, :reward => 20})
|
@@ -500,8 +509,9 @@ module CF
|
|
500
509
|
end
|
501
510
|
end
|
502
511
|
run = CF::Run.create(line, "adding_units_file_run", [{"Company"=>"Sprout","Website"=>"sprout.com"}])
|
512
|
+
# sleep 10
|
503
513
|
added_units = CF::Run.add_units({:run_title => "adding_units_file_run", :file => File.expand_path("../../fixtures/input_data/test.csv", __FILE__)})
|
504
|
-
added_units['successfull'].should eql("
|
514
|
+
added_units['successfull'].should eql("Sucessfully added 1 units, Failed :0")
|
505
515
|
run.title.should eql("adding_units_file_run")
|
506
516
|
end
|
507
517
|
end
|
@@ -510,7 +520,7 @@ module CF
|
|
510
520
|
VCR.use_cassette "run/block/adding_units_errors", :record => :new_episodes do
|
511
521
|
# WebMock.allow_net_connect!
|
512
522
|
line = CF::Line.create("adding_units_error","Digitization") do |l|
|
513
|
-
CF::InputFormat.new({:line => l, :name => "Company", :required => true
|
523
|
+
CF::InputFormat.new({:line => l, :name => "Company", :required => true})
|
514
524
|
CF::InputFormat.new({:line => l, :name => "Website", :required => true, :valid_type => "url"})
|
515
525
|
CF::Station.create({:line => l, :type => "work"}) do |s|
|
516
526
|
CF::HumanWorker.new({:station => s, :number => 1, :reward => 20})
|
@@ -523,7 +533,7 @@ module CF
|
|
523
533
|
end
|
524
534
|
run = CF::Run.create(line, "adding_units_error_run", [{"Company"=>"Apple,Inc","Website"=>"Apple.com"}])
|
525
535
|
added_units = CF::Run.add_units(:run_title => "adding_units_error_run", :units => [{"Company"=>"Sprout","Url"=>"sprout.com"}])
|
526
|
-
added_units['error']['message'].should eql(
|
536
|
+
added_units['error']['message'].should eql("Run document not found using selector: {:title=>\"adding_units_error_run\"}")
|
527
537
|
run.title.should eql("adding_units_error_run")
|
528
538
|
end
|
529
539
|
end
|
@@ -545,7 +555,7 @@ module CF
|
|
545
555
|
end
|
546
556
|
run = CF::Run.create(line, "adding_units_error_run_1", [{"Company"=>"Apple,Inc","Website"=>"Apple.com"}])
|
547
557
|
added_units = CF::Run.add_units(:run_title => "adding_units_error_run", :units => [])
|
548
|
-
added_units['error']['message'].should eql("Run document not found using selector: {:
|
558
|
+
added_units['error']['message'].should eql("Run document not found using selector: {:title=>\"adding_units_error_run\"}")
|
549
559
|
end
|
550
560
|
end
|
551
561
|
end
|
@@ -555,7 +565,7 @@ module CF
|
|
555
565
|
VCR.use_cassette "run/block/delete_run", :record => :new_episodes do
|
556
566
|
# WebMock.allow_net_connect!
|
557
567
|
line = CF::Line.create("delete_run","Digitization") do |l|
|
558
|
-
CF::InputFormat.new({:line => l, :name => "Company", :required => true
|
568
|
+
CF::InputFormat.new({:line => l, :name => "Company", :required => true})
|
559
569
|
CF::InputFormat.new({:line => l, :name => "Website", :required => true, :valid_type => "url"})
|
560
570
|
CF::Station.create({:line => l, :type => "work"}) do |s|
|
561
571
|
CF::HumanWorker.new({:station => s, :number => 1, :reward => 20})
|
@@ -567,6 +577,7 @@ module CF
|
|
567
577
|
end
|
568
578
|
end
|
569
579
|
run = CF::Run.create(line, "delete_run_run", [{"Company"=>"Apple,Inc","Website"=>"Apple.com"}])
|
580
|
+
# sleep 10
|
570
581
|
deleted_resp = CF::Run.destroy("delete_run_run")
|
571
582
|
deleted_resp.code.should eql(200)
|
572
583
|
deleted_resp.line['title'].should eql("delete_run")
|
@@ -578,7 +589,7 @@ module CF
|
|
578
589
|
VCR.use_cassette "run/block/delete_run_error", :record => :new_episodes do
|
579
590
|
delete = CF::Run.destroy("norun")
|
580
591
|
delete.code.should_not eql(200)
|
581
|
-
delete.error.message.should eql("Run document not found using selector: {:
|
592
|
+
delete.error.message.should eql("Run document not found using selector: {:title=>\"norun\"}")
|
582
593
|
end
|
583
594
|
end
|
584
595
|
end
|
@@ -14,6 +14,7 @@ module CF
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
run = CF::Run.create(line, "sentiment_robot_run", [{"url"=> "http://www.thehappyguy.com/happiness-self-help-book.html"}])
|
17
|
+
# sleep 20
|
17
18
|
output = run.final_output
|
18
19
|
output.first['sentiment_of_url'].should eql("positive")
|
19
20
|
output.first['sentiment_relevance_of_url'].should eql(24.0408)
|
@@ -39,6 +40,7 @@ module CF
|
|
39
40
|
line.stations.first.worker = worker
|
40
41
|
|
41
42
|
run = CF::Run.create(line, "sentiment_robot_run_1", [{"url"=> "http://www.thehappyguy.com/happiness-self-help-book.html"}])
|
43
|
+
# sleep 20
|
42
44
|
output = run.final_output
|
43
45
|
output.first['sentiment_of_url'].should eql("positive")
|
44
46
|
output.first['sentiment_relevance_of_url'].should eql(24.0408)
|
data/spec/station_spec.rb
CHANGED
@@ -19,7 +19,7 @@ describe CF::Station do
|
|
19
19
|
line = CF::Line.create("igitizeard", "Digitization") do
|
20
20
|
CF::InputFormat.new({:line => self, :name => "image_url", :required => true, :valid_type => "url"})
|
21
21
|
CF::Station.create({:line => self, :type => "work"}) do |s|
|
22
|
-
CF::HumanWorker.new({:station => s, :number =>
|
22
|
+
CF::HumanWorker.new({:station => s, :number => 1, :reward => 20})
|
23
23
|
CF::TaskForm.create({:station => s, :title => "Enter text from a business card image", :instruction => "Describe"}) do |i|
|
24
24
|
CF::FormField.new({:form => i, :label => "First Name", :field_type => "short_answer", :required => "true"})
|
25
25
|
CF::FormField.new({:form => i, :label => "Middle Name", :field_type => "short_answer"})
|
@@ -28,7 +28,7 @@ describe CF::Station do
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
line.stations.first.type.should eq("WorkStation")
|
31
|
-
line.stations.first.worker.number.should eql(
|
31
|
+
line.stations.first.worker.number.should eql(1)
|
32
32
|
line.stations.first.worker.reward.should eql(20)
|
33
33
|
line.stations.first.form.title.should eq("Enter text from a business card image")
|
34
34
|
line.stations.first.form.instruction.should eq("Describe")
|
@@ -44,7 +44,7 @@ describe CF::Station do
|
|
44
44
|
line = CF::Line.create("Digitizrd", "Digitization") do
|
45
45
|
CF::InputFormat.new({:line => self, :name => "image_url", :required => true, :valid_type => "url"})
|
46
46
|
CF::Station.create({:line => self, :type => "work"}) do
|
47
|
-
CF::HumanWorker.new({:station => self, :number =>
|
47
|
+
CF::HumanWorker.new({:station => self, :number => 1, :reward => 20})
|
48
48
|
CF::TaskForm.create({:station => self, :title => "Enter text from a business card image", :instruction => "Describe"}) do
|
49
49
|
CF::FormField.new({:form => self, :label => "First Name", :field_type => "short_answer", :required => "true"})
|
50
50
|
CF::FormField.new({:form => self, :label => "Middle Name", :field_type => "short_answer"})
|
@@ -53,7 +53,7 @@ describe CF::Station do
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
line.stations.first.type.should eq("WorkStation")
|
56
|
-
line.stations.first.worker.number.should eql(
|
56
|
+
line.stations.first.worker.number.should eql(1)
|
57
57
|
line.stations.first.worker.reward.should eql(20)
|
58
58
|
line.stations.first.form.title.should eq("Enter text from a business card image")
|
59
59
|
line.stations.first.form.instruction.should eq("Describe")
|
@@ -78,8 +78,8 @@ describe CF::Station do
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
line.stations.first.type.should eq("TournamentStation")
|
81
|
-
line.stations.first.jury_worker.should eql({
|
82
|
-
line.stations.first.auto_judge.should eql({
|
81
|
+
line.stations.first.jury_worker.should eql({"max_judges"=>10, "confidence_level"=>0.65, "tournament_restarts"=>0, "number"=>2})
|
82
|
+
line.stations.first.auto_judge.should eql({"enabled"=>true, "finalize_percentage"=>51})
|
83
83
|
line.stations.first.worker.number.should eql(3)
|
84
84
|
line.stations.first.worker.reward.should eql(20)
|
85
85
|
line.stations.first.form.title.should eq("Enter text from a business card image")
|
@@ -106,7 +106,7 @@ describe CF::Station do
|
|
106
106
|
line = CF::Line.create("Display_station", "Digitization") do
|
107
107
|
CF::InputFormat.new({:line => self, :name => "image_url", :required => true, :valid_type => "url"})
|
108
108
|
CF::Station.create({:line => self, :type => "work"}) do |station|
|
109
|
-
CF::HumanWorker.new({:station => station, :number =>
|
109
|
+
CF::HumanWorker.new({:station => station, :number => 1, :reward => 20})
|
110
110
|
end
|
111
111
|
end
|
112
112
|
line.stations.first.to_s.should eql("{:type => WorkStation, :index => 1, :line_title => Display_station, :station_input_formats => , :errors => }")
|
@@ -122,7 +122,7 @@ describe CF::Station do
|
|
122
122
|
CF::HumanWorker.new({:station => s, :number => 2, :reward => 20})
|
123
123
|
end
|
124
124
|
end
|
125
|
-
line.stations.first.to_s.should eql("{:type => TournamentStation, :index => 1, :line_title => Display_station_tournament, :station_input_formats => , :jury_worker => {
|
125
|
+
line.stations.first.to_s.should eql("{:type => TournamentStation, :index => 1, :line_title => Display_station_tournament, :station_input_formats => , :jury_worker => {\"max_judges\"=>10, \"confidence_level\"=>0.65, \"tournament_restarts\"=>0, \"number\"=>2}, auto_judge => {\"enabled\"=>true, \"finalize_percentage\"=>51}, :errors => }")
|
126
126
|
end
|
127
127
|
end
|
128
128
|
end
|
@@ -160,7 +160,7 @@ describe CF::Station do
|
|
160
160
|
# WebMock.allow_net_connect!
|
161
161
|
VCR.use_cassette "stations/block/multiple-station-adding-input-format", :record => :new_episodes do
|
162
162
|
line = CF::Line.create("Company-info-214","Digitization") do |l|
|
163
|
-
CF::InputFormat.new({:line => l, :name => "Company", :required => true
|
163
|
+
CF::InputFormat.new({:line => l, :name => "Company", :required => true})
|
164
164
|
CF::InputFormat.new({:line => l, :name => "Website", :required => true, :valid_type => "url"})
|
165
165
|
CF::Station.create({:line => l, :type => "work", :input_formats=> {:station_0 => [{:name => "Company"},{:name => "Website", :except => true}]}}) do |s|
|
166
166
|
CF::HumanWorker.new({:station => s, :number => 1, :reward => 20})
|
@@ -192,7 +192,6 @@ describe CF::Station do
|
|
192
192
|
station_1.input_formats.count.should eql(1)
|
193
193
|
station_1.input_formats.first.name.should eql("Company")
|
194
194
|
station_1.input_formats.first.required.should eql(true)
|
195
|
-
station_1.input_formats.first.valid_type.should eql("general")
|
196
195
|
station_2 = line.stations.last.get
|
197
196
|
station_2.input_formats.count.should eql(3)
|
198
197
|
station_2.input_formats.map(&:name).should include("Website")
|
@@ -202,8 +201,6 @@ describe CF::Station do
|
|
202
201
|
station_2.input_formats.map(&:required).should include(false) #how to make it true
|
203
202
|
station_2.input_formats.map(&:required).should include(false)
|
204
203
|
station_2.input_formats.map(&:valid_type).should include("url")
|
205
|
-
station_2.input_formats.map(&:valid_type).should include("general")
|
206
|
-
station_2.input_formats.map(&:valid_type).should include("general")
|
207
204
|
end
|
208
205
|
end
|
209
206
|
end
|
@@ -259,7 +256,7 @@ describe CF::Station do
|
|
259
256
|
line = CF::Line.create("batch_size_line", "Digitization") do
|
260
257
|
CF::InputFormat.new({:line => self, :name => "image_url", :required => true, :valid_type => "url"})
|
261
258
|
CF::Station.create({:line => self, :type => "work", :batch_size => 3}) do |s|
|
262
|
-
CF::HumanWorker.new({:station => s, :number =>
|
259
|
+
CF::HumanWorker.new({:station => s, :number => 1, :reward => 20})
|
263
260
|
CF::TaskForm.create({:station => s, :title => "Enter text from a business card image", :instruction => "Describe"}) do |i|
|
264
261
|
CF::FormField.new({:form => i, :label => "First Name", :field_type => "short_answer", :required => "true"})
|
265
262
|
CF::FormField.new({:form => i, :label => "Middle Name", :field_type => "short_answer"})
|
@@ -269,7 +266,7 @@ describe CF::Station do
|
|
269
266
|
end
|
270
267
|
line.stations.first.type.should eql("WorkStation")
|
271
268
|
line.stations.first.batch_size.should eql(3)
|
272
|
-
line.stations.first.worker.number.should eql(
|
269
|
+
line.stations.first.worker.number.should eql(1)
|
273
270
|
line.stations.first.worker.reward.should eql(20)
|
274
271
|
end
|
275
272
|
end
|