typingpool 0.8.11 → 0.8.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/bin/tp-assign +5 -4
  3. data/bin/tp-collect +16 -6
  4. data/bin/tp-finish +5 -4
  5. data/bin/tp-make +5 -4
  6. data/bin/tp-review +52 -26
  7. data/lib/typingpool/test.rb +4 -126
  8. data/lib/typingpool/test/fixtures/tp_collect_id.txt +1 -1
  9. data/lib/typingpool/test/fixtures/tp_collect_sandbox-assignment.csv +7 -8
  10. data/lib/typingpool/test/fixtures/tp_review2a_id.txt +1 -0
  11. data/lib/typingpool/test/fixtures/tp_review2a_sandbox-assignment.csv +7 -0
  12. data/lib/typingpool/test/fixtures/tp_review2b_id.txt +1 -0
  13. data/lib/typingpool/test/fixtures/tp_review2b_sandbox-assignment.csv +7 -0
  14. data/lib/typingpool/test/fixtures/tp_review3_id.txt +1 -0
  15. data/lib/typingpool/test/fixtures/tp_review3_sandbox-assignment.csv +7 -0
  16. data/lib/typingpool/test/fixtures/tp_review_id.txt +1 -1
  17. data/lib/typingpool/test/fixtures/tp_review_sandbox-assignment.csv +7 -8
  18. data/lib/typingpool/test/fixtures/vcr/tp-collect-1.yml +3176 -1814
  19. data/lib/typingpool/test/fixtures/vcr/tp-collect-2.yml +116 -2641
  20. data/lib/typingpool/test/fixtures/vcr/tp-collect-3.yml +119 -2693
  21. data/lib/typingpool/test/fixtures/vcr/tp-review-1.yml +353 -355
  22. data/lib/typingpool/test/fixtures/vcr/tp-review-2.yml +161 -242
  23. data/lib/typingpool/test/fixtures/vcr/tp-review-3.yml +4716 -0
  24. data/lib/typingpool/test/fixtures/vcr/tp-review-4.yml +741 -0
  25. data/lib/typingpool/test/fixtures/vcr/tp-review-5.yml +248 -0
  26. data/lib/typingpool/test/fixtures/vcr/tp-review-6.yml +233 -0
  27. data/lib/typingpool/test/fixtures/vcr/tp-review-7.yml +4479 -0
  28. data/lib/typingpool/test/fixtures/vcr/tp-review-8.yml +188 -0
  29. data/lib/typingpool/test/fixtures/vcr/tp-review-9.yml +187 -0
  30. data/lib/typingpool/test/script.rb +13 -320
  31. data/lib/typingpool/utility/test.rb +175 -0
  32. data/lib/typingpool/utility/test/script.rb +342 -0
  33. data/lib/typingpool/version.rb +1 -1
  34. data/test/make_amazon_question_fixture.rb +1 -1
  35. data/test/make_tp_collect_fixture_1.rb +18 -19
  36. data/test/make_tp_collect_fixture_2.rb +16 -10
  37. data/test/make_tp_collect_fixture_3.rb +15 -9
  38. data/test/make_tp_collect_fixture_4.rb +19 -11
  39. data/test/make_tp_collect_fixture_5.rb +25 -0
  40. data/test/make_tp_collect_fixture_6.rb +22 -0
  41. data/test/make_tp_collect_fixture_7.rb +22 -0
  42. data/test/make_tp_collect_fixture_8.rb +26 -0
  43. data/test/make_tp_review_fixture_1.rb +18 -19
  44. data/test/make_tp_review_fixture_2.rb +43 -24
  45. data/test/make_tp_review_fixture_3.rb +35 -0
  46. data/test/make_tp_review_fixture_4.rb +56 -0
  47. data/test/test_integration_script_1_tp_config.rb +7 -7
  48. data/test/test_integration_script_2_tp_make.rb +12 -12
  49. data/test/test_integration_script_3_tp_assign.rb +23 -21
  50. data/test/test_integration_script_4_tp_review.rb +156 -23
  51. data/test/test_integration_script_5_tp_collect.rb +33 -24
  52. data/test/test_integration_script_6_tp_finish.rb +23 -20
  53. data/test/test_unit_amazon.rb +4 -2
  54. data/test/test_unit_filer.rb +6 -6
  55. data/test/test_unit_project.rb +2 -2
  56. data/test/test_unit_project_local.rb +2 -2
  57. data/test/test_unit_project_remote.rb +3 -1
  58. data/test/test_unit_template.rb +6 -6
  59. data/test/test_unit_test.rb +3 -3
  60. metadata +23 -3
  61. data/lib/typingpool/app/test.rb +0 -69
@@ -8,29 +8,38 @@ require 'typingpool/test'
8
8
 
9
9
  class TestTpCollect < Typingpool::Test::Script
10
10
 
11
- def test_tp_collect
12
- with_temp_readymade_project do |dir|
13
- skip_if_no_upload_credentials('tp-collect integration test')
14
- skip_if_no_amazon_credentials('tp-collect integration test')
15
- copy_fixtures_to_transcripts_dir(dir, 'tp_collect_')
16
- begin
17
- project = transcripts_dir_project(dir)
18
- tp_collect_with_fixture(dir, File.join(vcr_dir, 'tp-collect-1'))
19
- transcript = assert_has_partial_transcript(dir)
20
- assert_html_has_audio_count(2, transcript)
21
- assert_assignment_csv_has_transcription_count(2, project, 'sandbox-assignment.csv')
22
- tp_collect_with_fixture(dir, File.join(vcr_dir, 'tp-collect-2'))
23
- transcript = assert_has_partial_transcript(dir)
24
- assert_html_has_audio_count(4, transcript)
25
- assert_assignment_csv_has_transcription_count(4, project, 'sandbox-assignment.csv')
26
- tp_collect_with_fixture(dir, File.join(vcr_dir, 'tp-collect-3'))
27
- # transcript = assert_has_transcript(dir) || assert_has_partial_transcript(dir)
28
- # assert_html_has_audio_count(7, transcript)
29
- # assert_assignment_csv_has_transcription_count(7, project, 'sandbox-assignment.csv')
30
- ensure
31
- rm_fixtures_from_transcripts_dir(dir, 'tp_collect_')
32
- end #begin
33
- end #with_temp_readymade_project do...
11
+ def test_collection_in_tp_collect_and_tp_review
12
+ [{script: lambda{ |transcripts_dir, fixture| tp_collect_with_fixture(transcripts_dir, fixture) },
13
+ fixtures: ['tp-collect-1', 'tp-collect-2', 'tp-collect-3'],
14
+ prefix: 'tp_collect_'},
15
+ {script: lambda{ |transcripts_dir, fixture| tp_review_with_fixture(transcripts_dir, fixture, %w(q), false)},
16
+ fixtures: ['tp-review-7', 'tp-review-8', 'tp-review-9'],
17
+ prefix: 'tp_review3_'}
18
+ ].each do |script|
19
+ with_temp_readymade_project do |dir|
20
+ skip_if_no_upload_credentials('tp-collect integration test')
21
+ skip_if_no_amazon_credentials('tp-collect integration test')
22
+ copy_fixtures_to_project_dir(script[:prefix], File.join(dir, project_default[:title]))
23
+ begin
24
+ project = Typingpool::Project.new(project_default[:title], Typingpool::Config.file(config_path(dir)))
25
+ assert_equal(6, project.local.subdir('audio', 'chunks').count, "Wrong number of audio files generated by tp_make")
26
+ script[:script].call(dir, script[:fixtures].shift)
27
+ transcript = assert_has_partial_transcript(project)
28
+ assert_html_has_audio_count(2, transcript)
29
+ assert_assignment_csv_has_transcription_count(2, project, 'sandbox-assignment.csv')
30
+ script[:script].call(dir, script[:fixtures].shift)
31
+ transcript = assert_has_partial_transcript(project)
32
+ assert_html_has_audio_count(3, transcript)
33
+ assert_assignment_csv_has_transcription_count(3, project, 'sandbox-assignment.csv')
34
+ script[:script].call(dir, script[:fixtures].shift)
35
+ transcript = assert_has_partial_transcript(project)
36
+ assert_html_has_audio_count(5, transcript)
37
+ assert_assignment_csv_has_transcription_count(5, project, 'sandbox-assignment.csv')
38
+ ensure
39
+ restore_project_dir_from_fixtures(script[:prefix], File.join(dir, project_default[:title]))
40
+ end #begin
41
+ end #with_temp_readymade_project do...
42
+ end #each
34
43
  end
35
44
 
36
- end #TestTpCollect
45
+ end #TestTpCollect
@@ -5,6 +5,8 @@ $LOAD_PATH.unshift File.join(File.dirname(File.dirname(__FILE__)), 'lib')
5
5
  require 'minitest/autorun'
6
6
  require 'typingpool'
7
7
  require 'typingpool/test'
8
+ require 'typingpool/utility/test'
9
+ include Typingpool::Utility::Test
8
10
 
9
11
  class TestTpFinish < Typingpool::Test::Script
10
12
  def test_tp_finish_on_audio_files_with_sftp
@@ -17,7 +19,7 @@ class TestTpFinish < Typingpool::Test::Script
17
19
  begin
18
20
  #get audio uploaded by calling tp-make on existing project
19
21
  tp_make(dir)
20
- project = transcripts_dir_project(dir)
22
+ project = Typingpool::Project.new(project_default[:title], Typingpool::Config.file(config_path(dir)))
21
23
  csv = project.local.file('data', 'assignment.csv').as(:csv)
22
24
  urls = csv.map{|assignment| assignment['audio_url'] }
23
25
  refute_empty(urls)
@@ -35,13 +37,14 @@ class TestTpFinish < Typingpool::Test::Script
35
37
  skip_if_no_s3_credentials('tp-finish s3 audio test')
36
38
  skip_if_no_amazon_credentials('tp-finish s3 audio test')
37
39
  with_temp_readymade_project do |dir|
38
- s3_config_path = setup_s3_config(dir)
39
- reconfigure_readymade_project_in(s3_config_path)
40
+ config = reconfigure_for_s3(Typingpool::Config.file(config_path(dir)))
41
+ s3_config_path = write_config(dir, config)
42
+ project = Typingpool::Project.new(project_default[:title], config)
43
+ reconfigure_project(project)
40
44
  simulate_failed_audio_upload_in(dir, s3_config_path)
41
45
  begin
42
46
  #get audio uploaded by calling tp-make on existing project
43
47
  tp_make_with_vcr(dir, 'tp_finish_1', s3_config_path)
44
- project = transcripts_dir_project(dir, Typingpool::Config.file(s3_config_path))
45
48
  csv = project.local.file('data', 'assignment.csv').as(:csv)
46
49
  urls = csv.map{|assignment| assignment['audio_url'] }
47
50
  refute_empty(urls)
@@ -56,7 +59,7 @@ class TestTpFinish < Typingpool::Test::Script
56
59
  end
57
60
 
58
61
  def script_with_vcr(dir, fixture_name, config_path=config_path(dir))
59
- yield([dir, config_path, *vcr_args(fixture_name)])
62
+ yield([dir, config_path, project_default[:title], *vcr_args(fixture_name)])
60
63
  end
61
64
 
62
65
  def tp_finish_with_vcr(*args)
@@ -75,19 +78,19 @@ class TestTpFinish < Typingpool::Test::Script
75
78
  skip_if_no_amazon_credentials('tp-finish Amazon test')
76
79
  skip_if_no_s3_credentials('tp-finish Amazon test')
77
80
  with_temp_readymade_project do |dir|
78
- s3_config_path = setup_s3_config(dir)
79
- reconfigure_readymade_project_in(s3_config_path)
81
+ config = reconfigure_for_s3(Typingpool::Config.file(config_path(dir)))
82
+ s3_config_path = write_config(dir, config)
83
+ project = Typingpool::Project.new(project_default[:title], config)
84
+ reconfigure_project(project)
80
85
  copy_tp_assign_fixtures(dir, 'tp_finish_3', s3_config_path)
81
- config = Typingpool::Config.file(s3_config_path)
82
86
  sandbox_csv=nil
83
87
  csv=nil
84
88
  with_vcr('tp_finish_4', config, {
85
89
  :preserve_exact_body_bytes => true,
86
- :match_requests_on => [:method, Typingpool::App.vcr_core_host_matcher]
90
+ :match_requests_on => [:method, vcr_core_host_matcher]
87
91
  }) do
88
92
  begin
89
93
  tp_assign_with_vcr(dir, 'tp_finish_3', s3_config_path)
90
- project = transcripts_dir_project(dir, config)
91
94
  csv = project.local.file('data', 'assignment.csv').as(:csv)
92
95
  sandbox_csv = project.local.file('data', 'sandbox-assignment.csv').as(:csv)
93
96
  assert_all_assets_have_upload_status(sandbox_csv, 'assignment', 'yes')
@@ -120,13 +123,13 @@ class TestTpFinish < Typingpool::Test::Script
120
123
  skip_if_no_amazon_credentials('tp-finish missing files test')
121
124
  skip_if_no_s3_credentials('tp-finish missing files test')
122
125
  with_temp_readymade_project do |dir|
123
- project = nil
124
- s3_config_path = setup_s3_config(dir)
125
- reconfigure_readymade_project_in(s3_config_path)
126
+ config = reconfigure_for_s3(Typingpool::Config.file(config_path(dir)))
127
+ s3_config_path = write_config(dir, config)
128
+ project = Typingpool::Project.new(project_default[:title], config)
129
+ reconfigure_project(project)
126
130
  simulate_failed_audio_upload_in(dir, s3_config_path)
127
131
  begin
128
132
  tp_make_with_vcr(dir, 'tp_finish_6', s3_config_path)
129
- project = transcripts_dir_project(dir, Typingpool::Config.file(s3_config_path))
130
133
  csv = project.local.file('data', 'assignment.csv').as(:csv)
131
134
  assignments = csv.read
132
135
  urls = assignments.map{|assignment| assignment['audio_url'] }
@@ -134,13 +137,13 @@ class TestTpFinish < Typingpool::Test::Script
134
137
  assert_all_assets_have_upload_status(csv, 'audio', 'yes')
135
138
  bogus_url = urls.first.sub(/\.mp3/, '.foo.mp3')
136
139
  refute_equal(urls.first, bogus_url)
137
- refute(working_url? bogus_url) if (Typingpool::Test.live || Typingpool::Test.record)
140
+ refute(Typingpool::Utility.working_url? bogus_url) if (Typingpool::Test.live || Typingpool::Test.record)
138
141
  bogus_assignment = assignments.first.dup
139
142
  bogus_assignment['audio_url'] = bogus_url
140
143
  assignments.insert(1, bogus_assignment)
141
144
  csv.write(assignments)
142
145
  assignments = csv.read
143
- refute(working_url? assignments[1]['audio_url']) if (Typingpool::Test.live || Typingpool::Test.record)
146
+ refute(Typingpool::Utility.working_url? assignments[1]['audio_url']) if (Typingpool::Test.live || Typingpool::Test.record)
144
147
  ensure
145
148
  tp_finish_outside_sandbox_with_vcr(dir, 'tp_finish_7', s3_config_path)
146
149
  end #begin
@@ -153,15 +156,15 @@ class TestTpFinish < Typingpool::Test::Script
153
156
  def test_abort_on_config_mismatch
154
157
  skip_if_no_s3_credentials('tp-finish abort on config mismatch test')
155
158
  with_temp_readymade_project do |dir|
156
- config = Typingpool::Config.file(config_path(dir))
157
- good_config_path = setup_s3_config(dir, config, '.config_s3_good')
158
- reconfigure_readymade_project_in(good_config_path)
159
+ config = reconfigure_for_s3(Typingpool::Config.file(config_path(dir)))
160
+ good_config_path = write_config(dir, config, '.config_s3_good')
161
+ reconfigure_project(Typingpool::Project.new(project_default[:title], config))
159
162
  simulate_failed_audio_upload_in(dir, good_config_path)
160
163
  assert(config.amazon.bucket)
161
164
  new_bucket = 'configmismatch-test'
162
165
  refute_equal(new_bucket, config.amazon.bucket)
163
166
  config.amazon.bucket = new_bucket
164
- bad_config_path = setup_s3_config(dir, config, '.config_s3_bad')
167
+ bad_config_path = write_config(dir, config, '.config_s3_bad')
165
168
  exception = assert_raises(Typingpool::Error::Shell) do
166
169
  tp_finish_outside_sandbox_with_vcr(dir, 'tp_finish_8', bad_config_path)
167
170
  end #assert_raises...
@@ -5,11 +5,13 @@ $LOAD_PATH.unshift File.join(File.dirname(File.dirname(__FILE__)), 'lib')
5
5
  require 'minitest/autorun'
6
6
  require 'typingpool'
7
7
  require 'typingpool/test'
8
+ require 'typingpool/utility/test'
8
9
  require 'uri'
9
10
  require 'cgi'
10
11
  require 'rturk'
11
12
  require 'ostruct'
12
13
  require 'timecop'
14
+ include Typingpool::Utility::Test
13
15
 
14
16
  class TestAmazon < Typingpool::Test
15
17
 
@@ -152,7 +154,7 @@ class TestAmazon < Typingpool::Test
152
154
  config = self.config
153
155
  dummy_project = Typingpool::Project.new('dummy', config)
154
156
  url = dummy_project.remote.file_to_url(Typingpool::Project::Remote::S3.random_bucket_name(16,'dummy-missing-file-'))
155
- refute(working_url? url) if (Typingpool::Test.live || Typingpool::Test.record)
157
+ refute(Typingpool::Utility.working_url? url) if (Typingpool::Test.live || Typingpool::Test.record)
156
158
  with_dummy_typingpool_hit_or_skip('test_handles_hits_with_broken_external_question', url) do |hit, dummy_config|
157
159
  assert_equal(hit.full.external_question_url, url) if (Typingpool::Test.live || Typingpool::Test.record)
158
160
  refute(hit.full.external_question)
@@ -195,7 +197,7 @@ class TestAmazon < Typingpool::Test
195
197
  config.assign.lifetime = '20m'
196
198
  cache = Tempfile.new('typingpool_cache')
197
199
  with_vcr(test_handle, config, {
198
- :match_requests_on => [:method, Typingpool::App.vcr_core_host_matcher]
200
+ :match_requests_on => [:method, vcr_core_host_matcher]
199
201
  }) do
200
202
  begin
201
203
  config.cache = cache.path
@@ -18,7 +18,7 @@ class TestFiler < Typingpool::Test
18
18
  assert_match(/transcripts: ~\/Documents\/Transcripts\//, text)
19
19
  assert_match(/- mp3\s*$/, text)
20
20
  assert_equal(fixtures_dir, filer.dir.path)
21
- in_temp_dir do |dir|
21
+ Typingpool::Utility.in_temp_dir do |dir|
22
22
  path = File.join(dir, 'filer-temp')
23
23
  assert(filer = Typingpool::Filer.new(path))
24
24
  assert_instance_of(Typingpool::Filer::CSV, filer_csv = filer.as(:csv))
@@ -46,7 +46,7 @@ class TestFiler < Typingpool::Test
46
46
  assert(data.first['audio_url'])
47
47
  assert_match(/^https?:\/\/\w/, data.first['audio_url'])
48
48
  assert(filer.select{|r| r['audio_url'] }.count > 0)
49
- in_temp_dir do |dir|
49
+ Typingpool::Utility.in_temp_dir do |dir|
50
50
  path = File.join(dir, 'filer-temp')
51
51
  assert(filer2 = Typingpool::Filer::CSV.new(path))
52
52
  assert_equal([], filer2.read)
@@ -74,7 +74,7 @@ class TestFiler < Typingpool::Test
74
74
  assert(data = filer.read)
75
75
  assert_instance_of(Array, data)
76
76
  assert_instance_of(Hash, data.first)
77
- in_temp_dir do |dir|
77
+ Typingpool::Utility.in_temp_dir do |dir|
78
78
  path = File.join(dir, 'filer-temp')
79
79
  assert(filer2 = Typingpool::Filer::CSV.new(path))
80
80
  assert_equal([], filer2.read)
@@ -94,7 +94,7 @@ class TestFiler < Typingpool::Test
94
94
  wma = Typingpool::Filer::Audio.new(files_from(File.join(audio_dir, 'wma')).first)
95
95
  assert(mp3.mp3?)
96
96
  assert(not(wma.mp3?))
97
- in_temp_dir do |dir|
97
+ Typingpool::Utility.in_temp_dir do |dir|
98
98
  [mp3, wma].each do |file|
99
99
  FileUtils.cp(file, dir)
100
100
  end
@@ -145,7 +145,7 @@ class TestFiler < Typingpool::Test
145
145
  assert(filer_wma = Typingpool::Filer::Files::Audio.new(wmas))
146
146
  assert_equal(mp3s.count, filer_mp3.files.count)
147
147
  assert_equal(wmas.count, filer_wma.files.count)
148
- in_temp_dir do |dir|
148
+ Typingpool::Utility.in_temp_dir do |dir|
149
149
  dest_filer = Typingpool::Filer::Dir.new(dir)
150
150
  assert(filer_conversion = filer_wma.to_mp3(dest_filer))
151
151
  assert_equal(filer_wma.files.count, filer_conversion.files.count)
@@ -167,7 +167,7 @@ class TestFiler < Typingpool::Test
167
167
  dir2_path = File.join(fixtures_dir, 'doesntexist')
168
168
  assert(not(File.exist? dir2_path))
169
169
  assert(dir2 = Typingpool::Filer::Dir.new(dir2_path))
170
- in_temp_dir do |temp_dir|
170
+ Typingpool::Utility.in_temp_dir do |temp_dir|
171
171
  dir3_path = File.join(temp_dir, 'filer-dir-temp')
172
172
  assert(not(File.exist? dir3_path))
173
173
  assert(dir3 = Typingpool::Filer::Dir.create(dir3_path))
@@ -103,7 +103,7 @@ class TestProject < Typingpool::Test
103
103
 
104
104
  def test_project_base_create_local
105
105
  config = dummy_config
106
- in_temp_dir do |dir|
106
+ Typingpool::Utility.in_temp_dir do |dir|
107
107
  config.transcripts = dir
108
108
  assert(project = Typingpool::Project.new(project_default[:title], config))
109
109
  assert_nil(project.local)
@@ -114,7 +114,7 @@ class TestProject < Typingpool::Test
114
114
 
115
115
  def test_project_base_create_assignment_csv
116
116
  config = dummy_config
117
- in_temp_dir do |dir|
117
+ Typingpool::Utility.in_temp_dir do |dir|
118
118
  config.transcripts = dir
119
119
  assert(project = Typingpool::Project.new(project_default[:title], config))
120
120
  project.create_local
@@ -26,7 +26,7 @@ class TestProjectLocal < Typingpool::Test
26
26
  end
27
27
 
28
28
  def test_project_local_create
29
- in_temp_dir do |dir|
29
+ Typingpool::Utility.in_temp_dir do |dir|
30
30
  assert(local = create_project_local(dir))
31
31
  assert(File.exist?(local.path))
32
32
  assert(File.directory?(local.path))
@@ -36,7 +36,7 @@ class TestProjectLocal < Typingpool::Test
36
36
  end
37
37
 
38
38
  def test_project_instance
39
- in_temp_dir do |dir|
39
+ Typingpool::Utility.in_temp_dir do |dir|
40
40
  assert(local = create_project_local(dir))
41
41
  refute_nil(local.id)
42
42
  assert_raises(Typingpool::Error) do
@@ -5,8 +5,10 @@ $LOAD_PATH.unshift File.join(File.dirname(File.dirname(__FILE__)), 'lib')
5
5
  require 'minitest/autorun'
6
6
  require 'typingpool'
7
7
  require 'typingpool/test'
8
+ require 'typingpool/utility/test'
8
9
  require 'stringio'
9
10
  require 'aws-sdk'
11
+ include Typingpool::Utility::Test
10
12
 
11
13
  class TestProjectRemote < Typingpool::Test
12
14
  def test_project_remote_from_config
@@ -45,7 +47,7 @@ class TestProjectRemote < Typingpool::Test
45
47
  def vcr_opts
46
48
  {
47
49
  :preserve_exact_body_bytes => true,
48
- :match_requests_on => [:method, Typingpool::App.vcr_core_host_matcher]
50
+ :match_requests_on => [:method, vcr_core_host_matcher]
49
51
  }
50
52
  end
51
53
 
@@ -17,11 +17,11 @@ class TestTemplate < Typingpool::Test
17
17
  assert_match(/#{signature}/, template1.render({:title => signature}))
18
18
  refute_match(/#{signature}/, template1.read)
19
19
  assert_match(/<h1><%= title/i, template1.read)
20
- in_temp_dir do |dir1|
20
+ Typingpool::Utility.in_temp_dir do |dir1|
21
21
  assert(template = Typingpool::Template.new('template', [dir1, fixtures_dir]))
22
22
  assert(template.look_in.detect{|path| path == dir1})
23
23
  has_template_in_fixtures_dir_test(template)
24
- in_temp_dir do |dir2|
24
+ Typingpool::Utility.in_temp_dir do |dir2|
25
25
  copy_template_fixture_into(dir2, '-2') do |path|
26
26
  assert(template = Typingpool::Template.new('template', [dir1, dir2, fixtures_dir]))
27
27
  assert_equal(path, template.full_path)
@@ -34,8 +34,8 @@ class TestTemplate < Typingpool::Test
34
34
  end
35
35
 
36
36
  def test_template_from_config
37
- in_temp_dir do |dir1|
38
- in_temp_dir do |dir2|
37
+ Typingpool::Utility.in_temp_dir do |dir1|
38
+ Typingpool::Utility.in_temp_dir do |dir2|
39
39
  copy_template_fixture_into(dir2, '-2') do |path|
40
40
  config = dummy_config
41
41
  config.templates = dir2
@@ -53,7 +53,7 @@ class TestTemplate < Typingpool::Test
53
53
  end
54
54
 
55
55
  def test_template_assignment
56
- in_temp_dir do |dir|
56
+ Typingpool::Utility.in_temp_dir do |dir|
57
57
  copy_template_fixture_into(dir) do |path|
58
58
  assignment_subdir = File.join(dir, 'assignment')
59
59
  FileUtils.mkdir(assignment_subdir)
@@ -75,7 +75,7 @@ class TestTemplate < Typingpool::Test
75
75
  assert_match(/<h1><%= title/i, rendered)
76
76
  assert_match(/<h1>#{signatures[0]}/i, rendered)
77
77
  assert_match(/<h1>#{signatures[1]}/i, rendered)
78
- in_temp_dir do |dir|
78
+ Typingpool::Utility.in_temp_dir do |dir|
79
79
  copy_template_fixture_into(dir) do |template_path|
80
80
  subdir = File.join(dir, 'closer')
81
81
  FileUtils.mkdir(subdir)
@@ -21,7 +21,7 @@ class TestTest < Typingpool::Test::Script
21
21
  end
22
22
  with_temp_readymade_project do |dir|
23
23
  with_temp_readymade_project do |dir2|
24
- projects = [transcripts_dir_project(dir), transcripts_dir_project(dir2)]
24
+ projects = [Typingpool::Project.new(project_default[:title], Typingpool::Config.file(config_path(dir))), Typingpool::Project.new(project_default[:title], Typingpool::Config.file(config_path(dir2)))]
25
25
  refute_equal(projects[0].local.id, projects[1].local.id)
26
26
  ['audio_url', 'project_id'].each do |csv_param|
27
27
  param_set = projects.map{|project| Set.new project.local.file('data', 'assignment.csv').as(:csv).select{|a| a[csv_param] } }
@@ -32,7 +32,7 @@ class TestTest < Typingpool::Test::Script
32
32
  end
33
33
 
34
34
  def assert_is_proper_tp_dir(dir)
35
- assert(project = transcripts_dir_project(dir))
35
+ assert(project = Typingpool::Project.new(project_default[:title], Typingpool::Config.file(config_path(dir))))
36
36
  assert(project.local)
37
37
  assert(File.exist? project.local)
38
38
  assert(File.directory? project.local)
@@ -41,7 +41,7 @@ class TestTest < Typingpool::Test::Script
41
41
  end
42
42
 
43
43
  def assert_has_proper_assignment_csv(dir)
44
- assert(project = transcripts_dir_project(dir))
44
+ assert(project = Typingpool::Project.new(project_default[:title], Typingpool::Config.file(config_path(dir))))
45
45
  assert(File.exist? project.local.file('data', 'assignment.csv').path)
46
46
  assert(assignments = project.local.file('data', 'assignment.csv').as(:csv).read)
47
47
  assert_equal(project.local.subdir('audio', 'chunks').files.count, assignments.count)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typingpool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.11
4
+ version: 0.8.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Tate
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-03 00:00:00.000000000 Z
11
+ date: 2017-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rturk
@@ -184,7 +184,6 @@ files:
184
184
  - lib/typingpool/app/cli.rb
185
185
  - lib/typingpool/app/cli/formatter.rb
186
186
  - lib/typingpool/app/friendlyexceptions.rb
187
- - lib/typingpool/app/test.rb
188
187
  - lib/typingpool/config.rb
189
188
  - lib/typingpool/config/root.rb
190
189
  - lib/typingpool/error.rb
@@ -262,6 +261,12 @@ files:
262
261
  - lib/typingpool/test/fixtures/tp_finish_3_time.txt
263
262
  - lib/typingpool/test/fixtures/tp_make_assignment.csv
264
263
  - lib/typingpool/test/fixtures/tp_make_id.txt
264
+ - lib/typingpool/test/fixtures/tp_review2a_id.txt
265
+ - lib/typingpool/test/fixtures/tp_review2a_sandbox-assignment.csv
266
+ - lib/typingpool/test/fixtures/tp_review2b_id.txt
267
+ - lib/typingpool/test/fixtures/tp_review2b_sandbox-assignment.csv
268
+ - lib/typingpool/test/fixtures/tp_review3_id.txt
269
+ - lib/typingpool/test/fixtures/tp_review3_sandbox-assignment.csv
265
270
  - lib/typingpool/test/fixtures/tp_review_id.txt
266
271
  - lib/typingpool/test/fixtures/tp_review_sandbox-assignment.csv
267
272
  - lib/typingpool/test/fixtures/transcript-chunks.csv
@@ -281,6 +286,13 @@ files:
281
286
  - lib/typingpool/test/fixtures/vcr/tp-collect-3.yml
282
287
  - lib/typingpool/test/fixtures/vcr/tp-review-1.yml
283
288
  - lib/typingpool/test/fixtures/vcr/tp-review-2.yml
289
+ - lib/typingpool/test/fixtures/vcr/tp-review-3.yml
290
+ - lib/typingpool/test/fixtures/vcr/tp-review-4.yml
291
+ - lib/typingpool/test/fixtures/vcr/tp-review-5.yml
292
+ - lib/typingpool/test/fixtures/vcr/tp-review-6.yml
293
+ - lib/typingpool/test/fixtures/vcr/tp-review-7.yml
294
+ - lib/typingpool/test/fixtures/vcr/tp-review-8.yml
295
+ - lib/typingpool/test/fixtures/vcr/tp-review-9.yml
284
296
  - lib/typingpool/test/fixtures/vcr/tp_assign_1.yml
285
297
  - lib/typingpool/test/fixtures/vcr/tp_assign_2.yml
286
298
  - lib/typingpool/test/fixtures/vcr/tp_assign_3.yml
@@ -303,14 +315,22 @@ files:
303
315
  - lib/typingpool/transcript/chunk.rb
304
316
  - lib/typingpool/utility.rb
305
317
  - lib/typingpool/utility/castable.rb
318
+ - lib/typingpool/utility/test.rb
319
+ - lib/typingpool/utility/test/script.rb
306
320
  - lib/typingpool/version.rb
307
321
  - test/make_amazon_question_fixture.rb
308
322
  - test/make_tp_collect_fixture_1.rb
309
323
  - test/make_tp_collect_fixture_2.rb
310
324
  - test/make_tp_collect_fixture_3.rb
311
325
  - test/make_tp_collect_fixture_4.rb
326
+ - test/make_tp_collect_fixture_5.rb
327
+ - test/make_tp_collect_fixture_6.rb
328
+ - test/make_tp_collect_fixture_7.rb
329
+ - test/make_tp_collect_fixture_8.rb
312
330
  - test/make_tp_review_fixture_1.rb
313
331
  - test/make_tp_review_fixture_2.rb
332
+ - test/make_tp_review_fixture_3.rb
333
+ - test/make_tp_review_fixture_4.rb
314
334
  - test/make_transcript_chunks_fixture.rb
315
335
  - test/test_integration_script_1_tp_config.rb
316
336
  - test/test_integration_script_2_tp_make.rb