class Typingpool::Test::Script
Public Instance Methods
assert_all_assets_have_upload_status(assignment_csv, type, status)
click to toggle source
# File lib/typingpool/test/script.rb, line 44 def assert_all_assets_have_upload_status(assignment_csv, type, status) recorded_uploads = assignment_csv.map{|assignment| assignment["#{type}_uploaded"] } refute_empty(recorded_uploads) assert_equal(recorded_uploads.count, recorded_uploads.select{|uploaded| uploaded == status }.count) end
assert_assignment_csv_has_transcription_count(count, project, which_csv='assignment.csv')
click to toggle source
# File lib/typingpool/test/script.rb, line 36 def assert_assignment_csv_has_transcription_count(count, project, which_csv='assignment.csv') assert_equal(count, project_transcript_count(project, which_csv)) end
assert_has_partial_transcript(project)
click to toggle source
# File lib/typingpool/test/script.rb, line 32 def assert_has_partial_transcript(project) assert_has_transcript(project, 'transcript_in_progress.html') end
assert_has_transcript(project, transcript_file='transcript.html')
click to toggle source
# File lib/typingpool/test/script.rb, line 25 def assert_has_transcript(project, transcript_file='transcript.html') transcript_path = File.join(project.local, transcript_file) assert(File.exist?(transcript_path)) assert(not((transcript = IO.read(transcript_path)).empty?)) transcript end
assert_html_has_audio_count(count, html)
click to toggle source
# File lib/typingpool/test/script.rb, line 40 def assert_html_has_audio_count(count, html) assert_equal(count, Nokogiri::HTML(html).css('audio').size) end
assert_script_abort_match(args, regex) { |*args, '--config', config_path(dir)| ... }
click to toggle source
# File lib/typingpool/test/script.rb, line 50 def assert_script_abort_match(args, regex) with_temp_transcripts_dir do |dir| exception = assert_raises(Typingpool::Error::Shell) do yield([*args, '--config', config_path(dir)]) end assert_match(regex, exception.message) end #with_temp_transcripts_dir do... end
do_later() { || ... }
click to toggle source
Overrides method in Utility::Test::Script
# File lib/typingpool/test/script.rb, line 13 def do_later Minitest.after_run{ yield } end
write_s3_config_with_bad_password(dir, config=Config.file(config_path(dir)))
click to toggle source
# File lib/typingpool/test/script.rb, line 17 def write_s3_config_with_bad_password(dir, config=Config.file(config_path(dir))) bad_password = 'f' refute_equal(config.to_hash['amazon']['secret'], bad_password) config.to_hash['amazon']['secret'] = bad_password write_config(dir, reconfigure_for_s3(config), '.config_s3_bad') end