Move test helper methods inside the describe block

openid
Marcin Kulik 12 years ago
parent 92a09476e8
commit a96c5e381b

@ -8,38 +8,38 @@ def uploaded_file(path, type)
) )
end end
def load_asciicast(id) describe 'Asciicast', :type => :feature, :js => true do
FactoryGirl.create(
:asciicast, def load_asciicast(id)
:meta => uploaded_file( FactoryGirl.create(
"spec/fixtures/asciicasts/#{id}/meta.json", :asciicast,
'application/json' :meta => uploaded_file(
), "spec/fixtures/asciicasts/#{id}/meta.json",
:stdout => fixture_file_upload( 'application/json'
"spec/fixtures/asciicasts/#{id}/stdout", ),
"application/octet-stream" :stdout => fixture_file_upload(
), "spec/fixtures/asciicasts/#{id}/stdout",
:stdout_timing => fixture_file_upload( "application/octet-stream"
"spec/fixtures/asciicasts/#{id}/stdout.time", ),
"application/octet-stream" :stdout_timing => fixture_file_upload(
"spec/fixtures/asciicasts/#{id}/stdout.time",
"application/octet-stream"
)
) )
) end
end
def visit_asciicast(id) def visit_asciicast(id)
asciicast = load_asciicast(id) asciicast = load_asciicast(id)
visit "/a/#{asciicast.id}/raw?speed=2" visit "/a/#{asciicast.id}/raw?speed=2"
end end
def inject_on_finished_callback def inject_on_finished_callback
page.execute_script(<<EOS) page.execute_script(<<EOS)
window.player.movie.on('finished', function() { window.player.movie.on('finished', function() {
$('body').append('<span class=\"finished\"></span>'); $('body').append('<span class=\"finished\"></span>');
}) })
EOS EOS
end end
describe 'Asciicast', :type => :feature, :js => true do
Dir['spec/fixtures/asciicasts/*'].each do |dir| Dir['spec/fixtures/asciicasts/*'].each do |dir|
id = dir[/\d+/] id = dir[/\d+/]

Loading…
Cancel
Save