typingpool 0.8.1 → 0.8.2

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: eb6abdc9b9f07ff9c24adaa0304a9aed90619e3b
4
+ data.tar.gz: a6d2d4f6de6ea82bec54e8a026b899257979d2d8
5
+ SHA512:
6
+ metadata.gz: 75c33b151d88e38bfb12b37751c3a8a8deaa9de91ed40971927e5d095a56d905c1841f160148b9f4f55000921e860436b198dd07240c7ca850ebe64b20ab12cd
7
+ data.tar.gz: c1593d3a0aeb1755723bf4d8f1289a8803b69d985f7675a1eeef74d568f8acabdffa37e754bbb6e275923889c07049e2ff53ed4a79174cab2d723aa17095164f
data/lib/typingpool.rb CHANGED
@@ -487,13 +487,13 @@
487
487
  # license. See LICENSE for details.
488
488
 
489
489
  module Typingpool
490
+ require 'typingpool/utility'
491
+ require 'typingpool/filer'
492
+ require 'typingpool/project'
490
493
  require 'typingpool/version'
491
494
  require 'typingpool/error'
492
- require 'typingpool/utility'
493
495
  require 'typingpool/config'
494
- require 'typingpool/filer'
495
496
  require 'typingpool/amazon'
496
- require 'typingpool/project'
497
497
  require 'typingpool/transcript'
498
498
  require 'typingpool/template'
499
499
  require 'typingpool/app'
@@ -1,14 +1,10 @@
1
1
  module Typingpool
2
- require 'test/unit'
2
+ require 'minitest/autorun'
3
3
 
4
- class Test < ::Test::Unit::TestCase
4
+ class Test < Minitest::Test
5
5
  require 'nokogiri'
6
6
  require 'fileutils'
7
7
 
8
- def MiniTest.filter_backtrace(bt)
9
- bt
10
- end
11
-
12
8
  def self.app_dir
13
9
  File.dirname(File.dirname(File.dirname(__FILE__)))
14
10
  end
@@ -284,10 +284,10 @@ module Typingpool
284
284
  end
285
285
 
286
286
  def assert_shell_error_match(regex)
287
- exception = assert_raise(Typingpool::Error::Shell) do
287
+ exception = assert_raises(Typingpool::Error::Shell) do
288
288
  yield
289
289
  end
290
- assert_match(exception.message, regex)
290
+ assert_match(regex, exception.message)
291
291
  end
292
292
 
293
293
  def assert_script_abort_match(args, regex)
@@ -1,3 +1,3 @@
1
1
  module Typingpool
2
- VERSION = '0.8.1'
2
+ VERSION = '0.8.2'
3
3
  end #Typingpool
@@ -8,34 +8,34 @@ require 'typingpool/test'
8
8
  class TestTpConfig < Typingpool::Test::Script
9
9
 
10
10
  def test_abort_with_invalid_file
11
- exception = assert_raise(Typingpool::Error::Shell) do
11
+ exception = assert_raises(Typingpool::Error::Shell) do
12
12
  tp_config(File.join(fixtures_dir, 'not_yaml.txt'))
13
13
  end
14
- assert_match(exception.message, /not valid yaml/i)
14
+ assert_match(/not valid yaml/i, exception.message)
15
15
  end
16
16
 
17
17
  def test_abort_with_directory_path
18
18
  dir = File.join(fixtures_dir, 'vcr')
19
19
  assert(File.exists? dir)
20
20
  assert(File.directory? dir)
21
- exception = assert_raise(Typingpool::Error::Shell) do
21
+ exception = assert_raises(Typingpool::Error::Shell) do
22
22
  tp_config(dir)
23
23
  end
24
- assert_match(exception.message, /not a file/i)
24
+ assert_match(/not a file/i, exception.message)
25
25
  end
26
26
 
27
27
  def test_abort_with_invalid_path
28
28
  path = '/jksdljs/euwiroeuw'
29
29
  refute(File.exists? path)
30
- exception = assert_raise(Typingpool::Error::Shell) do
30
+ exception = assert_raises(Typingpool::Error::Shell) do
31
31
  tp_config(path)
32
32
  end
33
- assert_match(exception.message, /valid path/i)
33
+ assert_match(/valid path/i, exception.message)
34
34
  end
35
35
 
36
36
  def test_usage_message
37
37
  assert(output = tp_config('--help'))
38
- assert_match(output, /\bUSAGE:/)
38
+ assert_match(/\bUSAGE:/, output)
39
39
  end
40
40
 
41
41
  def test_new_config_creation
@@ -46,7 +46,7 @@ def test_new_config_creation
46
46
  }
47
47
  path.values.each{|path| refute(File.exists? path) }
48
48
  assert(output = tp_config_with_input([path[:config], '--test'], ['keykey', 'secretsecret', path[:transcript_dir]]))
49
- assert_match(output[:err], /wrote config to/i)
49
+ assert_match(/wrote config to/i, output[:err])
50
50
  path.values.each{|path| assert(File.exists? path) }
51
51
  assert(File.file? path[:config] )
52
52
  assert(File.directory? path[:transcript_dir] )
@@ -99,7 +99,7 @@ def test_skips_bucket_when_sftp_params_exist
99
99
  assert(original_config = Typingpool::Config.file(path[:config]))
100
100
  assert_empty(original_config.amazon.bucket.to_s)
101
101
  assert(output = tp_config_with_input([path[:config], '--test'], ['keykey', 'secretsecret', path[:transcript_dir]]))
102
- assert_match(output[:err], /wrote config to/i)
102
+ assert_match(/wrote config to/i, output[:err])
103
103
  assert(edited_config = Typingpool::Config.file(path[:config]))
104
104
  assert_empty(edited_config.amazon.bucket.to_s)
105
105
  end #in_temp_dir do |dir|
@@ -34,8 +34,8 @@ class TestTpMake < Typingpool::Test::Script
34
34
  begin
35
35
  tp_make(dir, config_path, subdir)
36
36
  assert(project = temp_tp_dir_project(dir, Typingpool::Config.file(config_path)))
37
- assert_not_nil(project.local)
38
- assert_not_nil(project.local.id)
37
+ assert(project.local)
38
+ assert(project.local.id)
39
39
  assert(project.local.subdir('audio','chunks').to_a.size <= 7)
40
40
  assert(project.local.subdir('audio','chunks').to_a.size >= 6)
41
41
  assert_equal(project_default[:subtitle], project.local.subtitle)
@@ -44,7 +44,7 @@ class TestTpMake < Typingpool::Test::Script
44
44
  assert_all_assets_have_upload_status(assignments, ['audio'], 'yes')
45
45
  sleep 4 #pause before checking URLs so remote server has time to fully upload
46
46
  assignments.each do |assignment|
47
- assert_not_nil(assignment['audio_url'])
47
+ assert(assignment['audio_url'])
48
48
  assert(working_url? assignment['audio_url'])
49
49
  assert_equal(assignment['project_id'], project.local.id)
50
50
  assert_equal(assignment['unusual'].split(/\s*,\s*/), project_default[:unusual])
@@ -10,7 +10,7 @@ class TestTpAssign < Typingpool::Test::Script
10
10
  #(or at least some xml parsing) since rturk doesn't provide an
11
11
  #easy way to look at HIT qualifications)
12
12
  def test_abort_with_no_input
13
- assert_raise(Typingpool::Error::Shell){call_tp_assign}
13
+ assert_raises(Typingpool::Error::Shell){call_tp_assign}
14
14
  end
15
15
 
16
16
  def test_abort_with_no_template
@@ -59,7 +59,7 @@ class TestTpAssign < Typingpool::Test::Script
59
59
  sandbox_csv = project.local.file('data', 'sandbox-assignment.csv').as(:csv)
60
60
  refute_empty(assignment_urls = sandbox_csv.map{|assignment| assignment['assignment_url'] })
61
61
  assert(assignment_html = fetch_url(assignment_urls.first).body)
62
- assert_match(assignment_html, /\b20[\s-]+second\b/)
62
+ assert_match(/\b20[\s-]+second\b/, assignment_html)
63
63
  assert_all_assets_have_upload_status(sandbox_csv, ['assignment'], 'yes')
64
64
  ensure
65
65
  tp_finish(dir)
@@ -111,7 +111,7 @@ def test_fixing_failed_assignment_html_upload
111
111
  exception = assert_raises(Typingpool::Error::Shell) do
112
112
  tp_assign(dir, bad_config_path)
113
113
  end #assert_raises...
114
- assert_match(exception.message, /s3 operation fail/i)
114
+ assert_match(/s3 operation fail/i, exception.message)
115
115
  sandbox_csv = project.local.file('data', 'sandbox-assignment.csv').as(:csv)
116
116
  refute_empty(get_assignment_urls.call(sandbox_csv))
117
117
  check_assignment_urls = lambda{ get_assignment_urls.call(sandbox_csv).map{|url| Typingpool::Utility.working_url? url } }
@@ -142,7 +142,7 @@ def test_abort_on_config_mismatch
142
142
  exception = assert_raises(Typingpool::Error::Shell) do
143
143
  tp_assign(dir, bad_config_path)
144
144
  end #assert_raises...
145
- assert_match(exception.message, /\burls don't look right\b/i)
145
+ assert_match(/\burls don't look right\b/i, exception.message)
146
146
  ensure
147
147
  tp_finish(dir, good_config_path)
148
148
  end #begin
@@ -18,43 +18,38 @@ class TestTpReview < Typingpool::Test::Script
18
18
  assert_equal(7, project.local.file('data','sandbox-assignment.csv').as(:csv).reject{|assignment| assignment['hit_id'].to_s.empty? }.count)
19
19
  begin
20
20
  output = nil
21
- assert_nothing_raised do
22
- output = tp_review_with_fixture(dir, File.join(fixtures_dir, 'vcr', 'tp-review-1'), %w(a r a r s q))
23
- end
21
+ output = tp_review_with_fixture(dir, File.join(fixtures_dir, 'vcr', 'tp-review-1'), %w(a r a r s q))
24
22
  assert_equal(0, output[:status].to_i, "Bad exit code: #{output[:status]} err: #{output[:err]}")
25
23
  assert_equal(5, project.local.file('data','sandbox-assignment.csv').as(:csv).reject{|assignment| assignment['hit_id'].to_s.empty? }.count)
26
24
  reviews = split_reviews(output[:out])
27
- assert_match(reviews[1], /Interview\.00\.00/)
25
+ assert_match(/Interview\.00\.00/, reviews[1])
28
26
  #we can't specify leading \b boundaries because the ansi
29
27
  #escape sequences mess that up
30
- assert_match(reviews[1], /Approved\b/i)
31
- assert_match(reviews[2], /Interview\.00\.20/)
32
- assert_match(reviews[2], /reason\b/i)
33
- assert_match(reviews[2], /Rejected\b/i)
34
- assert_match(reviews[3], /Interview\.00\.40/)
35
- assert_match(reviews[3], /Approved\b/i)
36
- assert_match(reviews[4], /Interview\.01\.00/)
37
- assert_match(reviews[4], /reason\b/i)
38
- assert_match(reviews[4], /Rejected\b/i)
39
- assert_match(reviews[5], /Interview\.01\.20/)
40
- assert_match(reviews[5], /Skipping\b/i)
41
- assert_match(reviews[6], /Interview\.02\.00/)
42
- assert_match(reviews[6], /Quitting\b/i)
28
+ assert_match(/Approved\b/i, reviews[1])
29
+ assert_match(/Interview\.00\.20/, reviews[2])
30
+ assert_match(/reason\b/i, reviews[2])
31
+ assert_match(/Rejected\b/i, reviews[2])
32
+ assert_match(/Interview\.00\.40/, reviews[3])
33
+ assert_match(/Approved\b/i, reviews[3])
34
+ assert_match(/Interview\.01\.00/, reviews[4])
35
+ assert_match(/reason\b/i, reviews[4])
36
+ assert_match(/Rejected\b/i, reviews[4])
37
+ assert_match(/Interview\.01\.20/, reviews[5])
38
+ assert_match(/Skipping\b/i, reviews[5])
39
+ assert_match(/Interview\.02\.00/, reviews[6])
40
+ assert_match(/Quitting\b/i, reviews[6])
43
41
  transcript = assert_has_partial_transcript(dir)
44
42
  assert_html_has_audio_count(2, transcript)
45
43
  assert_assignment_csv_has_transcription_count(2, project, 'sandbox-assignment.csv')
46
-
47
- assert_nothing_raised do
48
- output = tp_review_with_fixture(dir, File.join(fixtures_dir, 'vcr', 'tp-review-2'), %w(a r))
49
- end
44
+ output = tp_review_with_fixture(dir, File.join(fixtures_dir, 'vcr', 'tp-review-2'), %w(a r))
50
45
  assert_equal(0, output[:status].to_i, "Bad exit code: #{output[:status]} err: #{output[:err]}")
51
46
  assert_equal(4, project.local.file('data','sandbox-assignment.csv').as(:csv).reject{|assignment| assignment['hit_id'].to_s.empty? }.count)
52
47
  reviews = split_reviews(output[:out])
53
- assert_match(reviews[1], /Interview\.01\.20/)
54
- assert_match(reviews[1], /Approved\b/i)
55
- assert_match(reviews[2], /Interview\.02\.00/)
56
- assert_match(reviews[2], /reason\b/i)
57
- assert_match(reviews[2], /Rejected\b/i)
48
+ assert_match(/Interview\.01\.20/, reviews[1])
49
+ assert_match(/Approved\b/i, reviews[1])
50
+ assert_match(/Interview\.02\.00/, reviews[2])
51
+ assert_match(/reason\b/i, reviews[2])
52
+ assert_match(/Rejected\b/i, reviews[2])
58
53
  transcript = assert_has_partial_transcript(dir)
59
54
  assert_html_has_audio_count(3, transcript)
60
55
  assert_assignment_csv_has_transcription_count(3, project, 'sandbox-assignment.csv')
@@ -16,21 +16,15 @@ class TestTpCollect < Typingpool::Test::Script
16
16
  copy_fixtures_to_temp_tp_dir(dir, 'tp_collect_')
17
17
  begin
18
18
  project = temp_tp_dir_project(dir)
19
- assert_nothing_raised do
20
- tp_collect_with_fixture(dir, File.join(vcr_dir, 'tp-collect-1'))
21
- end
19
+ tp_collect_with_fixture(dir, File.join(vcr_dir, 'tp-collect-1'))
22
20
  transcript = assert_has_partial_transcript(dir)
23
21
  assert_html_has_audio_count(2, transcript)
24
22
  assert_assignment_csv_has_transcription_count(2, project, 'sandbox-assignment.csv')
25
- assert_nothing_raised do
26
- tp_collect_with_fixture(dir, File.join(vcr_dir, 'tp-collect-2'))
27
- end
23
+ tp_collect_with_fixture(dir, File.join(vcr_dir, 'tp-collect-2'))
28
24
  transcript = assert_has_partial_transcript(dir)
29
25
  assert_html_has_audio_count(4, transcript)
30
26
  assert_assignment_csv_has_transcription_count(4, project, 'sandbox-assignment.csv')
31
- assert_nothing_raised do
32
- tp_collect_with_fixture(dir, File.join(vcr_dir, 'tp-collect-3'))
33
- end
27
+ tp_collect_with_fixture(dir, File.join(vcr_dir, 'tp-collect-3'))
34
28
  # transcript = assert_has_transcript(dir) || assert_has_partial_transcript(dir)
35
29
  # assert_html_has_audio_count(7, transcript)
36
30
  # assert_assignment_csv_has_transcription_count(7, project, 'sandbox-assignment.csv')
@@ -17,9 +17,7 @@ class TestTpFinish < Typingpool::Test::Script
17
17
  assert_all_assets_have_upload_status(csv, ['audio'], 'yes')
18
18
  sleep 3 #pause before checking URLs so remote server has time to fully upload
19
19
  assert_equal(urls.size, urls.select{|url| working_url? url}.size)
20
- assert_nothing_raised do
21
- tp_finish_outside_sandbox(dir, config_path)
22
- end
20
+ tp_finish_outside_sandbox(dir, config_path)
23
21
  sleep 3 #pause before checking URLs so remote server has time to fully delete
24
22
  assert_empty(urls.select{|url| working_url? url })
25
23
  assert_all_assets_have_upload_status(csv, ['audio'], 'no')
@@ -55,9 +53,7 @@ class TestTpFinish < Typingpool::Test::Script
55
53
  setup_amazon(dir)
56
54
  results = Typingpool::Amazon::HIT.all_for_project(project.local.id)
57
55
  refute_empty(results)
58
- assert_nothing_raised do
59
- tp_finish(dir)
60
- end
56
+ tp_finish(dir)
61
57
  assert_empty(Typingpool::Amazon::HIT.all_for_project(project.local.id))
62
58
  results.each do |result|
63
59
  #The original HIT might be gone, or there and marked
@@ -65,9 +61,9 @@ class TestTpFinish < Typingpool::Test::Script
65
61
  #dead HITs yet
66
62
  begin
67
63
  hit = RTurk::Hit.find(result.id)
68
- assert_match(hit.status, /^dispos/i)
64
+ assert_match(/^dispos/i, hit.status)
69
65
  rescue RTurk::InvalidRequest => exception
70
- assert_match(exception.message, /HITDoesNotExist/i)
66
+ assert_match(/HITDoesNotExist/i, exception.message)
71
67
  end #begin
72
68
  end #results.each...
73
69
  refute(File.exists? sandbox_csv)
@@ -116,7 +112,7 @@ def test_abort_on_config_mismatch
116
112
  exception = assert_raises(Typingpool::Error::Shell) do
117
113
  tp_finish_outside_sandbox(dir, bad_config_path)
118
114
  end #assert_raises...
119
- assert_match(exception.message, /\burls don't look right\b/i)
115
+ assert_match(/\burls don't look right\b/i, exception.message)
120
116
  ensure
121
117
  tp_finish_outside_sandbox(dir, good_config_path)
122
118
  end #begin
@@ -11,7 +11,7 @@ class TestAmazon < Typingpool::Test
11
11
 
12
12
  def test_amazon_base
13
13
  setup_result = Typingpool::Amazon.setup(:sandbox => true, :config => dummy_config)
14
- assert_match(setup_result, /amazonaws/)
14
+ assert_match(/amazonaws/, setup_result)
15
15
  assert(Typingpool::Amazon.cache)
16
16
  assert_instance_of(PStore, Typingpool::Amazon.cache)
17
17
  assert_equal(dummy_config.cache, Typingpool::Amazon.cache.path)
@@ -24,13 +24,13 @@ class TestAmazon < Typingpool::Test
24
24
  assert_instance_of(Typingpool::Amazon::Question, question)
25
25
  assert_equal(question_url, question.url)
26
26
  assert_equal(question_html, question.html)
27
- assert_match(question.title, /Transcribe MP3 of/i)
28
- assert_match(question.description, /telephone conversation/i)
29
- assert_match(question.annotation, /\S/)
27
+ assert_match(/Transcribe MP3 of/i, question.title)
28
+ assert_match(/telephone conversation/i, question.description)
29
+ assert_match(/\S/, question.annotation)
30
30
  assert(decoded_annotation = URI.decode_www_form(CGI.unescapeHTML(question.annotation)))
31
31
  decoded_annotation = Hash[*decoded_annotation.flatten]
32
- assert_match(decoded_annotation[Typingpool::Amazon::HIT.url_at], /^http/i)
33
- assert_match(decoded_annotation[Typingpool::Amazon::HIT.id_at], /\S/)
32
+ assert_match(/^http/i, decoded_annotation[Typingpool::Amazon::HIT.url_at])
33
+ assert_match(/\S/, decoded_annotation[Typingpool::Amazon::HIT.id_at])
34
34
  end
35
35
 
36
36
  def test_amazon_hit_create
@@ -67,10 +67,10 @@ class TestAmazon < Typingpool::Test
67
67
  def test_amazon_hit_base
68
68
  with_dummy_hit_or_skip('test_amazon_hit_base') do |hit, config|
69
69
  assert_instance_of(Typingpool::Amazon::HIT, hit)
70
- assert_match(hit.id, /\S/)
71
- assert_match(hit.url, /^http/i)
72
- assert_match(hit.project_id, /\S/)
73
- assert_match(hit.project_title_from_url, /\S/)
70
+ assert_match(/\S/, hit.id)
71
+ assert_match(/^http/i, hit.url)
72
+ assert_match(/\S/, hit.project_id)
73
+ assert_match(/\S/, hit.project_title_from_url)
74
74
  assert(not(hit.approved?))
75
75
  assert(not(hit.rejected?))
76
76
  assert(not(hit.submitted?))
@@ -87,16 +87,16 @@ class TestAmazon < Typingpool::Test
87
87
  with_dummy_hit_or_skip('test_amazon_hit_full') do |hit, config|
88
88
  assert(full = hit.full)
89
89
  assert_instance_of(Typingpool::Amazon::HIT::Full, full)
90
- [:id, :type_id].each{|attr| assert_match(full.send(attr), /\S/) }
90
+ [:id, :type_id].each{|attr| assert_match(/\S/, full.send(attr)) }
91
91
  assert(not(full.expired?))
92
92
  assert(not(full.expired_and_overdue?))
93
93
  assert_equal('Assignable', full.status)
94
- assert_match(full.external_question_url, /^http/i)
95
- [:assignments_completed, :assignments_pending].each{|attr| assert_match(full.send(attr).to_s, /^\d+$/) }
94
+ assert_match(/^http/i, full.external_question_url)
95
+ [:assignments_completed, :assignments_pending].each{|attr| assert_match(/^\d+$/, full.send(attr).to_s) }
96
96
  assert_kind_of(Time, full.expires_at)
97
97
  assert_instance_of(Hash, full.annotation)
98
- assert_match(full.annotation[Typingpool::Amazon::HIT.url_at], /^http/i)
99
- assert_match(full.annotation[Typingpool::Amazon::HIT.id_at], /\S/)
98
+ assert_match(/^http/i, full.annotation[Typingpool::Amazon::HIT.url_at])
99
+ assert_match(/\S/, full.annotation[Typingpool::Amazon::HIT.id_at])
100
100
  end #with_dummy_hit_or_skip
101
101
  end
102
102
 
@@ -10,13 +10,13 @@ class TestConfig < Typingpool::Test
10
10
  def test_config_regular_file
11
11
  assert(config = Typingpool::Config.file(File.join(fixtures_dir, 'config-1')))
12
12
  assert_equal('~/Documents/Transcripts/', config['transcripts'])
13
- assert_match(config.transcripts, /Transcripts$/)
14
- refute_match(config.transcripts, /~/)
13
+ assert_match(/Transcripts$/, config.transcripts)
14
+ refute_match(/~/, config.transcripts)
15
15
  %w(key secret).each do |param|
16
16
  regex = /test101010/
17
- assert_match(config.amazon.send(param), regex)
18
- assert_match(config.amazon[param], regex)
19
- assert_match(config.amazon.to_hash[param], regex)
17
+ assert_match(regex, config.amazon.send(param))
18
+ assert_match(regex, config.amazon[param])
19
+ assert_match(regex, config.amazon.to_hash[param])
20
20
  end
21
21
  assert_equal(0.75, config.assign.reward.to_f)
22
22
  assert_equal(3*60*60, config.assign.deadline.to_i)
@@ -45,25 +45,25 @@ class TestConfig < Typingpool::Test
45
45
  exception = assert_raises(Typingpool::Error::Argument) do
46
46
  config.assign.qualify
47
47
  end
48
- assert_match(exception.message, /Unknown qualification type/i)
48
+ assert_match(/Unknown qualification type/i, exception.message)
49
49
 
50
50
  config.assign['qualify'] = [config.assign['qualify'].pop]
51
51
  exception = assert_raises(Typingpool::Error::Argument) do
52
52
  config.assign.qualify
53
53
  end
54
- assert_match(exception.message, /Unknown comparator/i)
54
+ assert_match(/Unknown comparator/i, exception.message)
55
55
 
56
56
  assert_equal('3z', config.assign['deadline'])
57
57
  exception = assert_raises(Typingpool::Error::Argument::Format) do
58
58
  config.assign.deadline
59
59
  end
60
- assert_match(exception.message, /can't convert/i)
60
+ assert_match(/can't convert/i, exception.message)
61
61
 
62
62
  config.assign['reward'] = 'foo'
63
63
  exception = assert_raises(Typingpool::Error::Argument::Format) do
64
64
  config.assign.reward
65
65
  end
66
- assert_match(exception.message, /\bformat should\b/i)
66
+ assert_match(/\bformat should\b/i, exception.message)
67
67
  end
68
68
 
69
69
  def test_config_regular_input
@@ -83,12 +83,12 @@ class TestConfig < Typingpool::Test
83
83
  exception = assert_raises(Typingpool::Error::Argument::Format) do
84
84
  config.assign.reward = 'foo'
85
85
  end
86
- assert_match(exception.message, /\bformat should\b/i)
86
+ assert_match(/\bformat should\b/i, exception.message)
87
87
 
88
88
  exception = assert_raises(Typingpool::Error::Argument::Format) do
89
89
  config.assign.approval = '11f'
90
90
  end
91
- assert_match(exception.message, /can't convert/i)
91
+ assert_match(/can't convert/i, exception.message)
92
92
 
93
93
  end
94
94
  end #TestConfig
@@ -13,9 +13,9 @@ class TestFiler < Typingpool::Test
13
13
  assert(filer = Typingpool::Filer.new(path))
14
14
  assert_equal(path, "#{filer}")
15
15
  assert(text = filer.read)
16
- assert_match(text, /^amazon:\n/)
17
- assert_match(text, /transcripts: ~\/Documents\/Transcripts\//)
18
- assert_match(text, /- mp3\s*$/)
16
+ assert_match(/^amazon:\n/, text)
17
+ assert_match(/transcripts: ~\/Documents\/Transcripts\//, text)
18
+ assert_match(/- mp3\s*$/, text)
19
19
  assert_equal(fixtures_dir, filer.dir.path)
20
20
  in_temp_dir do |dir|
21
21
  path = File.join(dir, 'filer-temp')
@@ -43,7 +43,7 @@ class TestFiler < Typingpool::Test
43
43
  assert_respond_to(filer, :map)
44
44
  assert_respond_to(filer, :select)
45
45
  assert(data.first['audio_url'])
46
- assert_match(data.first['audio_url'], /^https?:\/\/\w/)
46
+ assert_match(/^https?:\/\/\w/, data.first['audio_url'])
47
47
  assert(filer.select{|r| r['audio_url'] }.count > 0)
48
48
  in_temp_dir do |dir|
49
49
  path = File.join(dir, 'filer-temp')
@@ -111,8 +111,8 @@ class TestFiler < Typingpool::Test
111
111
  assert_equal(3, chunks.count)
112
112
  chunks.each{|chunk| assert(File.exists? chunk) }
113
113
  assert(chunks.first.offset)
114
- assert_match(chunks.first.offset, /0\.00\b/)
115
- assert_match(chunks.to_a[1].offset, /0\.25\b/)
114
+ assert_match(/0\.00\b/, chunks.first.offset)
115
+ assert_match(/0\.25\b/, chunks.to_a[1].offset)
116
116
  end #in_temp_dir
117
117
  end
118
118
 
@@ -14,7 +14,7 @@ class TestProject < Typingpool::Test
14
14
  assert_instance_of(Typingpool::Project, project)
15
15
  assert_equal(project_default[:title], project.name)
16
16
  assert_equal(dummy_config.to_hash.to_s, project.config.to_hash.to_s)
17
- assert_raise(Typingpool::Error::Argument::Format) do
17
+ assert_raises(Typingpool::Error::Argument::Format) do
18
18
  Typingpool::Project.new('one/two', dummy_config)
19
19
  end #assert_raise...
20
20
  end
@@ -152,7 +152,7 @@ class TestProject < Typingpool::Test
152
152
 
153
153
  def test_local_basename_from_url
154
154
  url = ['http://example.com/dir/', URI.escape('Example Title With Spaces & Ampersand.html')].join
155
- assert_match(url, /%20/)
155
+ assert_match(/%20/, url)
156
156
  #assert(basename = Typingpool::Project.local_basename_from_url.u)
157
157
  end
158
158
 
@@ -38,7 +38,7 @@ class TestProjectLocal < Typingpool::Test
38
38
  in_temp_dir do |dir|
39
39
  assert(local = create_project_local(dir))
40
40
  refute_nil(local.id)
41
- assert_raise(Typingpool::Error) do
41
+ assert_raises(Typingpool::Error) do
42
42
  local.create_id
43
43
  end
44
44
  assert_nil(local.subtitle)
@@ -39,7 +39,7 @@ class TestProjectRemote < Typingpool::Test
39
39
  assert_equal(21,Typingpool::Project::Remote::S3.random_bucket_name(10).size)
40
40
  assert_equal(28,Typingpool::Project::Remote::S3.random_bucket_name(10, 'testing-typingpool').size)
41
41
  assert_equal(34,Typingpool::Project::Remote::S3.random_bucket_name(16, 'testing-typingpool').size)
42
- assert_match(Typingpool::Project::Remote::S3.random_bucket_name(16, ''), /^[a-z]/)
42
+ assert_match(/^[a-z]/, Typingpool::Project::Remote::S3.random_bucket_name(16, ''))
43
43
  end
44
44
 
45
45
  def test_project_remote_s3_networked
@@ -13,9 +13,9 @@ class TestTemplate < Typingpool::Test
13
13
  assert(template2 = Typingpool::Template.new('template.html.erb', [fixtures_dir]))
14
14
  has_template_in_fixtures_dir_test(template2)
15
15
  signature = 'ffffffffff'
16
- assert_match(template1.render({:title => signature}), /#{signature}/)
17
- refute_match(template1.read, /#{signature}/)
18
- assert_match(template1.read, /<h1><%= title/i)
16
+ assert_match(/#{signature}/, template1.render({:title => signature}))
17
+ refute_match(/#{signature}/, template1.read)
18
+ assert_match(/<h1><%= title/i, template1.read)
19
19
  in_temp_dir do |dir1|
20
20
  assert(template = Typingpool::Template.new('template', [dir1, fixtures_dir]))
21
21
  assert(template.look_in.detect{|path| path == dir1})
@@ -24,9 +24,9 @@ class TestTemplate < Typingpool::Test
24
24
  copy_template_fixture_into(dir2, '-2') do |path|
25
25
  assert(template = Typingpool::Template.new('template', [dir1, dir2, fixtures_dir]))
26
26
  assert_equal(path, template.full_path)
27
- assert_match(template.render({:title => signature}), /#{signature}/)
28
- refute_match(template.read, /#{signature}/)
29
- assert_match(template.read, /<h2><%= title/i)
27
+ assert_match(/#{signature}/, template.render({:title => signature}))
28
+ refute_match(/#{signature}/, template.read)
29
+ assert_match(/<h2><%= title/i, template.read)
30
30
  end #copy_template_fixture_into do...
31
31
  end #in_temp_dir do |dir2|
32
32
  end #in_temp_dir do |dir1|
@@ -40,12 +40,12 @@ class TestTemplate < Typingpool::Test
40
40
  config.templates = dir2
41
41
  assert(template = Typingpool::Template.from_config('template', config))
42
42
  assert_equal(path, template.full_path)
43
- assert_match(template.read, /<h2><%= title/i)
43
+ assert_match(/<h2><%= title/i, template.read)
44
44
  config.templates = dir1
45
- exception = assert_raise(Typingpool::Error) do
45
+ exception = assert_raises(Typingpool::Error) do
46
46
  template = Typingpool::Template.from_config('template', config)
47
47
  end #assert_raises() do...
48
- assert_match(exception.message, /could not find/i)
48
+ assert_match(/could not find/i, exception.message)
49
49
  end #copy_template_into do...
50
50
  end #in_temp_dir do |dir2|
51
51
  end #in_temp_dir do |dir1|
@@ -61,7 +61,7 @@ class TestTemplate < Typingpool::Test
61
61
  config.templates = dir
62
62
  assert(template = Typingpool::Template::Assignment.from_config('template', config))
63
63
  assert_equal(assignment_path, template.full_path)
64
- assert_match(template.read, /<h2><%= title/i)
64
+ assert_match(/<h2><%= title/i, template.read)
65
65
  end #copy_template_fixture_into(assignment_subdir) do...
66
66
  end #copy_template_fixture_into(dir, '') do...
67
67
  end #in_temp_dir do...
@@ -71,9 +71,9 @@ class TestTemplate < Typingpool::Test
71
71
  assert(template = Typingpool::Template.new('template-3', [fixtures_dir]))
72
72
  signatures = [('g' * 9), ('h' * 11)]
73
73
  assert(rendered = template.render(:title => signatures[0], :new_title => signatures[1]))
74
- assert_match(rendered, /<h1><%= title/i)
75
- assert_match(rendered, /<h1>#{signatures[0]}/i)
76
- assert_match(rendered, /<h1>#{signatures[1]}/i)
74
+ assert_match(/<h1><%= title/i, rendered)
75
+ assert_match(/<h1>#{signatures[0]}/i, rendered)
76
+ assert_match(/<h1>#{signatures[1]}/i, rendered)
77
77
  in_temp_dir do |dir|
78
78
  copy_template_fixture_into(dir) do |template_path|
79
79
  subdir = File.join(dir, 'closer')
@@ -83,12 +83,12 @@ class TestTemplate < Typingpool::Test
83
83
  FileUtils.cp(File.join(fixtures_dir, 'template-2.html.erb'), subdir)
84
84
  look_in = [dir, subdir]
85
85
  assert(template = Typingpool::Template.new('template', look_in))
86
- assert_match(template.read, /<h1><%= title/i)
87
- refute_match(template.read, /<h2><%= title/i)
86
+ assert_match(/<h1><%= title/i, template.read)
87
+ refute_match(/<h2><%= title/i, template.read)
88
88
  assert(calling_template = Typingpool::Template.new('template-3', look_in))
89
89
  assert(rendered = calling_template.render(:title => signatures[0], :new_title => signatures[1]))
90
- assert_match(rendered, /<h2>/)
91
- refute_match(rendered, /<h1>/)
90
+ assert_match(/<h2>/, rendered)
91
+ refute_match(/<h1>/, rendered)
92
92
  end #copy_template_fixture_into do...
93
93
  end #copy_template_fixture_into do...
94
94
  end #in_temp_dir do...
@@ -49,12 +49,12 @@ class TestTranscript < Typingpool::Test
49
49
  refute_equal(chunk.filename, chunk.filename_local)
50
50
  original_newline_count = chunk.body_as_text.scan(/\n/).count
51
51
  chunk.body = chunk.body + "\n\r\f" + ('foo bar baz' * 100)
52
- refute_match(chunk.body_as_text, /\r/) unless $/.match(/\r/)
52
+ refute_match(/\r/, chunk.body_as_text) unless $/.match(/\r/)
53
53
  assert_equal(original_newline_count + 2, chunk.body_as_text.scan(/\n/).count)
54
54
  original_p_count = chunk.body_as_html.scan(/<p>/i).count
55
55
  chunk.body = chunk.body + "One & two\n\n...and 3 < 4."
56
- refute_match(chunk.body_as_html, /\s&\s/)
57
- refute_match(chunk.body_as_html, /\s<\s/)
56
+ refute_match(/\s&\s/, chunk.body_as_html)
57
+ refute_match(/\s<\s/, chunk.body_as_html)
58
58
  assert_equal(original_p_count + 1, chunk.body_as_html.scan(/<p>/i).count)
59
59
  end
60
60
  end
data/typingpool.gemspec CHANGED
@@ -19,8 +19,9 @@ Gem::Specification.new do |s|
19
19
  s.add_runtime_dependency('nokogiri', '>= 1.5')
20
20
  s.add_runtime_dependency('aws-sdk', '~> 1.8.0')
21
21
  s.add_runtime_dependency('net-sftp', '>= 2.0.5')
22
- s.add_runtime_dependency('vcr')
23
- s.add_runtime_dependency('webmock')
22
+ s.add_development_dependency('minitest', '~> 5.0')
23
+ s.add_development_dependency('vcr')
24
+ s.add_development_dependency('webmock')
24
25
  s.require_path = 'lib'
25
26
  s.executables = ['tp-config',
26
27
  'tp-make',
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typingpool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
5
- prerelease:
4
+ version: 0.8.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ryan Tate
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-01 00:00:00.000000000 Z
11
+ date: 2013-06-24 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rturk
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,39 +27,34 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: highline
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '1.6'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '1.6'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: nokogiri
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '1.5'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '1.5'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: aws-sdk
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ~>
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ~>
76
67
  - !ruby/object:Gem::Version
@@ -78,49 +69,57 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: net-sftp
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: 2.0.5
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: 2.0.5
83
+ - !ruby/object:Gem::Dependency
84
+ name: minitest
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: '5.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: '5.0'
94
97
  - !ruby/object:Gem::Dependency
95
98
  name: vcr
96
99
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
100
  requirements:
99
- - - ! '>='
101
+ - - '>='
100
102
  - !ruby/object:Gem::Version
101
103
  version: '0'
102
- type: :runtime
104
+ type: :development
103
105
  prerelease: false
104
106
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
107
  requirements:
107
- - - ! '>='
108
+ - - '>='
108
109
  - !ruby/object:Gem::Version
109
110
  version: '0'
110
111
  - !ruby/object:Gem::Dependency
111
112
  name: webmock
112
113
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
114
  requirements:
115
- - - ! '>='
115
+ - - '>='
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
- type: :runtime
118
+ type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
121
  requirements:
123
- - - ! '>='
122
+ - - '>='
124
123
  - !ruby/object:Gem::Version
125
124
  version: '0'
126
125
  description: An app for transcribing audio using Mechanical Turk
@@ -256,20 +255,19 @@ files:
256
255
  - typingpool.gemspec
257
256
  homepage: http://github.com/ryantate/typingpool
258
257
  licenses: []
258
+ metadata: {}
259
259
  post_install_message:
260
260
  rdoc_options: []
261
261
  require_paths:
262
262
  - lib
263
263
  required_ruby_version: !ruby/object:Gem::Requirement
264
- none: false
265
264
  requirements:
266
- - - ! '>='
265
+ - - '>='
267
266
  - !ruby/object:Gem::Version
268
267
  version: 1.9.2
269
268
  required_rubygems_version: !ruby/object:Gem::Requirement
270
- none: false
271
269
  requirements:
272
- - - ! '>='
270
+ - - '>='
273
271
  - !ruby/object:Gem::Version
274
272
  version: '0'
275
273
  requirements:
@@ -277,9 +275,9 @@ requirements:
277
275
  - mp3splt
278
276
  - mp3wrap
279
277
  rubyforge_project:
280
- rubygems_version: 1.8.24
278
+ rubygems_version: 2.0.3
281
279
  signing_key:
282
- specification_version: 3
280
+ specification_version: 4
283
281
  summary: An app for transcribing audio using Mechanical Turk
284
282
  test_files:
285
283
  - test/test_unit_amazon.rb