Move test helper methods inside the describe block

openid
Marcin Kulik 12 years ago
parent 92a09476e8
commit a96c5e381b

@ -8,7 +8,9 @@ def uploaded_file(path, type)
) )
end end
def load_asciicast(id) describe 'Asciicast', :type => :feature, :js => true do
def load_asciicast(id)
FactoryGirl.create( FactoryGirl.create(
:asciicast, :asciicast,
:meta => uploaded_file( :meta => uploaded_file(
@ -24,22 +26,20 @@ def load_asciicast(id)
"application/octet-stream" "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