turkee 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +1 -1
- data/lib/helpers/turkee_forms_helper.rb +29 -26
- data/spec/dummy/app/controllers/surveys_controller.rb +7 -0
- data/spec/dummy/app/models/survey.rb +3 -0
- data/spec/dummy/config/routes.rb +1 -2
- data/spec/factories/survey_factory.rb +7 -0
- data/spec/helpers/turkee_forms_helper_spec.rb +45 -14
- data/spec/spec_helper.rb +2 -0
- data/turkee.gemspec +2 -2
- metadata +6 -3
data/Gemfile.lock
CHANGED
@@ -6,21 +6,21 @@ module Turkee
|
|
6
6
|
|
7
7
|
options.merge!({:url => mturk_url})
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
capture do
|
10
|
+
form_for record, options do |f|
|
11
|
+
params.each do |k,v|
|
12
|
+
unless ['action','controller'].include?(k) || !v.is_a?(String)
|
13
|
+
concat hidden_field_tag(k, v)
|
14
|
+
cookies[k] = v
|
15
|
+
end
|
15
16
|
end
|
16
|
-
end
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
['assignmentId', 'workerId', 'hitId'].each do |k|
|
19
|
+
concat hidden_field_tag(k, cookies[k]) if !params.has_key?(k) && cookies.has_key?(k)
|
20
|
+
end
|
21
21
|
|
22
|
-
|
23
|
-
|
22
|
+
concat(yield(f))
|
23
|
+
end
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -33,21 +33,24 @@ module Turkee
|
|
33
33
|
style = "position: fixed; top: 120px; right: 30px; color: #FFF;"
|
34
34
|
style << "width: 400px; height: 375px; z-index: 100; padding: 10px;"
|
35
35
|
style << "background-color: rgba(0,0,0, 0.5); border: 1px solid #000;"
|
36
|
+
|
36
37
|
div_for(task, :style => style) do
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
38
|
+
capture do
|
39
|
+
concat content_tag(:h3, "DIRECTIONS", :style => 'text-align: right; color:#FF0000;')
|
40
|
+
concat task.hit_description.html_safe
|
41
|
+
concat '<hr/>'.html_safe
|
42
|
+
concat(turkee_form_for(study, params) do |f|
|
43
|
+
capture do
|
44
|
+
concat f.label(:feedback, "Feedback?:")
|
45
|
+
concat f.text_area(:feedback, :rows => 3, :disabled => disabled)
|
46
|
+
concat f.label(:gold_response, "Enter the fourth word from your above feedback :")
|
47
|
+
concat f.text_field(:gold_response, :disabled => disabled)
|
48
|
+
concat f.hidden_field(:turkee_task_id, :value => task.id)
|
49
|
+
concat '<br/>'.html_safe
|
50
|
+
concat f.submit('Submit', :disabled => disabled)
|
51
|
+
end
|
52
|
+
end)
|
53
|
+
end
|
51
54
|
end
|
52
55
|
end
|
53
56
|
end
|
data/spec/dummy/config/routes.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Turkee::TurkeeFormHelper, :type => :helper do
|
4
|
-
#include RSpec::Rails::HelperExampleGroup
|
5
4
|
describe "mturk_url" do
|
6
5
|
it "should return sandbox" do
|
7
6
|
RTurk.stub(:sandbox?).and_return true
|
@@ -17,28 +16,60 @@ describe Turkee::TurkeeFormHelper, :type => :helper do
|
|
17
16
|
before do
|
18
17
|
@task = Factory(:turkee_task)
|
19
18
|
RTurk.stub(:sandbox?).and_return true
|
19
|
+
|
20
|
+
helper.stub(:params).and_return({:assignmentId => '123456', :workerId => '987654'})
|
21
|
+
@study_form = helper.turkee_study
|
20
22
|
end
|
21
23
|
|
22
|
-
it "includes the description" do
|
23
|
-
|
24
|
-
study_form
|
25
|
-
study_form.should
|
26
|
-
study_form.should
|
27
|
-
study_form.should match /workersandbox.mturk.com/
|
24
|
+
it "includes the description, textarea" do
|
25
|
+
@study_form.should match(/Test Desc/)
|
26
|
+
@study_form.should match(/feedback/)
|
27
|
+
@study_form.should match(/textarea/)
|
28
|
+
@study_form.should match(/workersandbox.mturk.com/)
|
28
29
|
end
|
29
30
|
|
30
|
-
it "
|
31
|
-
|
31
|
+
it "the form points to the sandbox" do
|
32
|
+
@study_form = turkee_study
|
33
|
+
@study_form.should match(/workersandbox.mturk.com/)
|
34
|
+
end
|
32
35
|
|
33
|
-
|
36
|
+
it "still includes the necessary assignmentId and workerId" do
|
37
|
+
@study_form.should match(/assignmentId/)
|
38
|
+
@study_form.should match(/workerId/)
|
39
|
+
end
|
34
40
|
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "turkee_form_for" do
|
44
|
+
before do
|
45
|
+
@survey = Factory(:survey)
|
46
|
+
RTurk.stub(:sandbox?).and_return true
|
47
|
+
|
48
|
+
params = {:assignmentId => '123456', :workerId => '987654'}
|
49
|
+
@survey_form = helper.turkee_form_for(@survey, params) do |f|
|
50
|
+
f.text_field :answer
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
it "displays the passed in assignmentId and workerId " do
|
55
|
+
@survey_form.should match(/answer/)
|
56
|
+
@survey_form.should match(/type=\"text\"/)
|
57
|
+
@survey_form.should match(/assignmentId/)
|
58
|
+
@survey_form.should match(/workerId/)
|
59
|
+
end
|
60
|
+
|
61
|
+
it "the intial turkee_form_for saved the assignmentId and workerId to a cookie for later retrieval" do
|
35
62
|
helper.cookies['assignmentId'].should == '123456'
|
63
|
+
helper.cookies['workerId'].should == '987654'
|
36
64
|
|
37
65
|
# Subsequent requests should still return form fields for assignmentId
|
38
|
-
helper.
|
39
|
-
|
40
|
-
|
41
|
-
|
66
|
+
survey_form = helper.turkee_form_for(@survey, {}) do |f|
|
67
|
+
f.text_field :answer
|
68
|
+
end
|
69
|
+
survey_form.should match(/123456/)
|
70
|
+
survey_form.should match(/987654/)
|
71
|
+
survey_form.should match(/assignmentId/)
|
72
|
+
survey_form.should match(/workerId/)
|
42
73
|
end
|
43
74
|
end
|
44
75
|
end
|
data/spec/spec_helper.rb
CHANGED
data/turkee.gemspec
CHANGED
@@ -3,11 +3,11 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = %q{turkee}
|
6
|
-
s.version = "2.0.
|
6
|
+
s.version = "2.0.1"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
9
|
s.authors = [%q{Jim Jones}]
|
10
|
-
s.date = %q{2013-
|
10
|
+
s.date = %q{2013-05-14}
|
11
11
|
s.description = %q{Turkee will help you to easily create usability studies, post HITs, and retrieve the user entered values from Mechanical Turk.}
|
12
12
|
s.email = %q{jjones@aantix.com}
|
13
13
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turkee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-05-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: lockfile
|
@@ -176,9 +176,11 @@ files:
|
|
176
176
|
- spec/dummy/app/assets/javascripts/application.js
|
177
177
|
- spec/dummy/app/assets/stylesheets/application.css
|
178
178
|
- spec/dummy/app/controllers/application_controller.rb
|
179
|
+
- spec/dummy/app/controllers/surveys_controller.rb
|
179
180
|
- spec/dummy/app/helpers/application_helper.rb
|
180
181
|
- spec/dummy/app/mailers/.gitkeep
|
181
182
|
- spec/dummy/app/models/.gitkeep
|
183
|
+
- spec/dummy/app/models/survey.rb
|
182
184
|
- spec/dummy/app/views/layouts/application.html.erb
|
183
185
|
- spec/dummy/config.ru
|
184
186
|
- spec/dummy/config/application.rb
|
@@ -206,6 +208,7 @@ files:
|
|
206
208
|
- spec/dummy/public/favicon.ico
|
207
209
|
- spec/dummy/script/rails
|
208
210
|
- spec/dummy/tmp/cache/.gitkeep
|
211
|
+
- spec/factories/survey_factory.rb
|
209
212
|
- spec/factories/turkee_task_factory.rb
|
210
213
|
- spec/helpers/turkee_forms_helper_spec.rb
|
211
214
|
- spec/models/turkee_study_spec.rb
|
@@ -233,7 +236,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
233
236
|
version: '0'
|
234
237
|
segments:
|
235
238
|
- 0
|
236
|
-
hash:
|
239
|
+
hash: 509377053887078608
|
237
240
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
238
241
|
none: false
|
239
242
|
requirements:
|