cloudfactory 0.4.4 → 0.4.5
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.rb +4 -1
- data/lib/cf/badge.rb +59 -0
- data/lib/cf/cli.rb +6 -0
- data/lib/cf/cli/line.rb +185 -132
- data/lib/cf/cli/line_yaml_validator.rb +7 -30
- data/lib/cf/cli/production.rb +63 -9
- data/lib/cf/gold_standard.rb +74 -0
- data/lib/cf/help.txt +67 -0
- data/lib/cf/human_worker.rb +45 -49
- data/lib/cf/line.rb +51 -1
- data/lib/cf/run.rb +10 -10
- data/lib/cf/station.rb +111 -29
- data/lib/cf/test_run.rb +66 -0
- data/lib/cf/version.rb +1 -1
- data/spec/account_spec.rb +1 -1
- data/spec/badges/station_1.html +135 -0
- data/spec/badges_spec.rb +288 -0
- data/spec/gold_standard_spec.rb +179 -0
- data/spec/gold_standards.csv +2 -0
- data/spec/google_translate_robot_spec.rb +1 -1
- data/spec/human_worker_spec.rb +1 -65
- data/spec/line_spec.rb +6 -39
- data/spec/robot_worker_spec.rb +1 -1
- data/spec/run_spec.rb +9 -7
- data/spec/stat_badge_spec.rb +45 -0
- data/spec/test_run_spec.rb +105 -0
- metadata +264 -218
- data/spec/badge_spec.rb +0 -88
data/spec/badge_spec.rb
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module CF
|
4
|
-
describe CF::HumanWorker do
|
5
|
-
context "create badge" do
|
6
|
-
it "should create multiple badge for worker" do
|
7
|
-
WebMock.allow_net_connect!
|
8
|
-
badge =
|
9
|
-
{
|
10
|
-
:title => 'Football Fanatic',
|
11
|
-
:description => "This qualification allows you to perform work at stations which have this badge.",
|
12
|
-
:max_badges => 3,
|
13
|
-
:test =>
|
14
|
-
{
|
15
|
-
:input => {:name => "Lionel Andres Messi", :country => "Argentina"},
|
16
|
-
:expected_output =>
|
17
|
-
[{:birthplace => "Rosario, Santa Fe, Argentina",:match_options => {:tolerance => 10, :ignore_case => true }},{:position => "CF",:match_options => {:tolerance => 1 }},{:"current-club" => "Barcelona",:match_options => {:tolerance => 1, :ignore_case => false }}]
|
18
|
-
}
|
19
|
-
}
|
20
|
-
badge_1 =
|
21
|
-
{
|
22
|
-
:title => 'Football Fanatic',
|
23
|
-
:description => "This qualification allows you to perform work at stations which have this badge.",
|
24
|
-
:max_badges => 3,
|
25
|
-
:test =>
|
26
|
-
{
|
27
|
-
:input => {:name => "Cristiano Ronaldo", :country => "Portugal"},
|
28
|
-
:expected_output =>
|
29
|
-
[{:birthplace => "Rosario, Santa Fe, Portugal",:match_options => {:tolerance => 10, :ignore_case => true }},{:position => "CF",:match_options => {:tolerance => 1 }},{:"current-club" => "Real Madrid",:match_options => {:tolerance => 1, :ignore_case => false }}]
|
30
|
-
}
|
31
|
-
}
|
32
|
-
title = "line_title#{Time.new.strftime('%Y%b%d-%H%M%S')}".downcase
|
33
|
-
sleep 1
|
34
|
-
line = CF::Line.create(title, "Digitization") do |l|
|
35
|
-
CF::InputFormat.new({:line => l, :name => "image_url", :required => true, :valid_type => "url"})
|
36
|
-
CF::Station.create({:line =>l, :type => "work"}) do |s|
|
37
|
-
CF::HumanWorker.new({:station => s, :number => 1, :reward => 20, :skill_badge => badge})
|
38
|
-
end
|
39
|
-
end
|
40
|
-
line.stations.first.worker.badge = badge_1
|
41
|
-
line.stations.first.type.should eql("WorkStation")
|
42
|
-
line.stations.first.worker.number.should eql(1)
|
43
|
-
line.stations.first.worker.reward.should eql(20)
|
44
|
-
line.stations.first.worker.skill_badges.first.should eql([{"title"=>"Football Fanatic", "description"=>"This qualification allows you to perform work at stations which have this badge.", "score"=>nil, "quality_rating"=>nil, "max_badges"=>3, "skill_test"=>{"score_after"=>"submit", "manual_scoring"=>false, "display_answers"=>false, "edit_answers"=>true, "retries"=>0, "pass_percentage"=>100, "test_units"=>[{"input"=>{"name"=>"Lionel Andres Messi", "country"=>"Argentina"}, "expected_output"=>[{"birthplace"=>"Rosario, Santa Fe, Argentina", "match_options"=>{"tolerance"=>"1", "ignore_case"=>"false"}, "position"=>"CF", "current-club"=>"Barcelona"}], "match_options"=>{"tolerance"=>0, "ignore_case"=>false}}]}}])
|
45
|
-
line.stations.first.worker.skill_badges.last.should eql([{"title"=>"Football Fanatic", "description"=>"This qualification allows you to perform work at stations which have this badge.", "score"=>nil, "quality_rating"=>nil, "max_badges"=>3, "skill_test"=>{"score_after"=>"submit", "manual_scoring"=>false, "display_answers"=>false, "edit_answers"=>true, "retries"=>0, "pass_percentage"=>100, "test_units"=>[{"input"=>{"name"=>"Cristiano Ronaldo", "country"=>"Portugal"}, "expected_output"=>[{"birthplace"=>"Rosario, Santa Fe, Portugal", "match_options"=>{"tolerance"=>"1", "ignore_case"=>"false"}, "position"=>"CF", "current-club"=>"Real Madrid"}], "match_options"=>{"tolerance"=>0, "ignore_case"=>false}}]}}])
|
46
|
-
line.stations.first.worker.stat_badge.should eql({"approval_rating"=>80, "assignment_duration"=>3600, "abandonment_rate"=>30, "country"=>nil})
|
47
|
-
end
|
48
|
-
|
49
|
-
it "should create stat badge for worker in block DSL way" do
|
50
|
-
WebMock.allow_net_connect!
|
51
|
-
stat_badge = {:approval_rating => 40, :assignment_duration => 1800}
|
52
|
-
title = "line_title#{Time.new.strftime('%Y%b%d-%H%M%S')}".downcase
|
53
|
-
sleep 1
|
54
|
-
line = CF::Line.create(title, "Digitization") do |l|
|
55
|
-
CF::InputFormat.new({:line => l, :name => "image_url", :required => true, :valid_type => "url"})
|
56
|
-
CF::Station.create({:line =>l, :type => "work"}) do |s|
|
57
|
-
CF::HumanWorker.new({:station => s, :number => 1, :reward => 20, :stat_badge => stat_badge})
|
58
|
-
end
|
59
|
-
end
|
60
|
-
line.stations.first.type.should eql("WorkStation")
|
61
|
-
line.stations.first.worker.number.should eql(1)
|
62
|
-
line.stations.first.worker.reward.should eql(20)
|
63
|
-
line.stations.first.worker.stat_badge.should eql({"approval_rating"=>40, "assignment_duration"=>1800, "abandonment_rate"=>30, "country"=>nil})
|
64
|
-
end
|
65
|
-
|
66
|
-
it "should create stat badge for worker in plain ruby way" do
|
67
|
-
WebMock.allow_net_connect!
|
68
|
-
stat_badge = {:approval_rating => 40, :assignment_duration => 1800}
|
69
|
-
title = "line_title#{Time.new.strftime('%Y%b%d-%H%M%S')}".downcase
|
70
|
-
sleep 1
|
71
|
-
line = CF::Line.new(title, "Digitization")
|
72
|
-
input_format = CF::InputFormat.new({:name => "image_url", :required => true, :valid_type => "url"})
|
73
|
-
line.input_formats input_format
|
74
|
-
|
75
|
-
station = CF::Station.new({:type => "work"})
|
76
|
-
line.stations station
|
77
|
-
|
78
|
-
worker = CF::HumanWorker.new({:number => 1, :reward => 20, :stat_badge => stat_badge})
|
79
|
-
line.stations.first.worker = worker
|
80
|
-
|
81
|
-
line.stations.first.type.should eql("WorkStation")
|
82
|
-
line.stations.first.worker.number.should eql(1)
|
83
|
-
line.stations.first.worker.reward.should eql(20)
|
84
|
-
line.stations.first.worker.stat_badge.should eql({"approval_rating"=>40, "assignment_duration"=>1800, "abandonment_rate"=>30, "country"=>nil})
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|