Fix feature specs

openid
Marcin Kulik 11 years ago
parent 5b177f0d13
commit 4b981d710b

@ -2,14 +2,14 @@ require 'spec_helper'
feature "Asciicast lists" do
let!(:asciicast) { load_asciicast(1) }
let!(:asciicast) { create(:asciicast) }
scenario 'Visiting all' do
visit browse_path
expect(page).to have_content(/All Asciicasts/i)
expect_browse_links
expect(page).to have_link("##{asciicast.id}")
expect(page).to have_link("bashing")
expect(page).to have_selector('.supplimental .play-button')
end
@ -19,7 +19,7 @@ feature "Asciicast lists" do
expect(page).to have_content(/Popular Asciicasts/i)
expect_browse_links
expect(page).to have_link("##{asciicast.id}")
expect(page).to have_link("bashing")
expect(page).to have_selector('.supplimental .play-button')
end

@ -2,16 +2,17 @@ require 'spec_helper'
feature "Homepage", :js => true do
let!(:asciicast) { load_asciicast(1) }
let!(:user) { create(:user) }
let!(:asciicast) { create(:asciicast, :user => user) }
scenario 'Visiting' do
visit root_path
expect(page).to have_content(/Recent Asciicasts/i)
expect(page).to have_link('Browse')
expect(page).to have_link('Record')
expect(page).to have_link('Docs')
expect_browse_links
expect(page).to have_link("##{asciicast.id}")
expect(page).to have_content(/Recent Asciicasts/i)
expect(page).to have_link("bashing")
expect(page).to have_selector('#about .play-button')
end

@ -2,11 +2,9 @@ require 'spec_helper'
describe 'Asciicast playback', :js => true, :slow => true do
def visit_asciicast(id)
asciicast = load_asciicast(id)
visit "/a/#{asciicast.id}/raw?speed=5"
end
let(:asciicast) { create(:asciicast) }
describe "from fixture" do
def inject_on_finished_callback
page.execute_script(<<EOS)
window.player.movie.on('finished', function() {
@ -15,10 +13,6 @@ describe 'Asciicast playback', :js => true, :slow => true do
EOS
end
Dir['spec/fixtures/asciicasts/*'].each do |dir|
id = dir[/\d+/]
describe "from fixture #{id}" do
before do
@old_wait_time = Capybara.default_wait_time
Capybara.default_wait_time = 120
@ -29,12 +23,11 @@ EOS
end
it "is successful" do
visit_asciicast(id)
visit asciicast_path(asciicast, speed: 5)
find(".play-button").find(".arrow").click
inject_on_finished_callback
page.should have_selector('body .finished')
end
end
end
end

@ -1,14 +0,0 @@
{
"command": null,
"duration": 5.914434194564819,
"recorded_at": "Sun, 04 Mar 2012 16:43:52 +0000",
"shell": "/bin/zsh",
"term": {
"columns": 89,
"lines": 27,
"type": "rxvt-unicode-256color"
},
"title": null,
"uname": "Linux 3.2.6-3.fc16.x86_64 #1 SMP Mon Feb 13 20:35:42 UTC 2012 x86_64",
"user_token": "2b4b4e02-6613-11e1-9be5-00215c6bbb11"
}

Binary file not shown.

Binary file not shown.

@ -1 +0,0 @@
{"duration":19.3045,"term":{"columns":89,"lines":27}}

Binary file not shown.

Binary file not shown.

@ -1 +0,0 @@
{"duration":260.875012,"term":{"columns":107,"lines":29}}

Binary file not shown.

Binary file not shown.

@ -1 +0,0 @@
{"duration":426.9083879999997,"term":{"columns":119,"lines":39}}

Binary file not shown.

Binary file not shown.

@ -1 +0,0 @@
{"duration":64.2345,"term":{"columns":80,"lines":27}}

Binary file not shown.

Binary file not shown.

@ -1 +0,0 @@
{"duration":57.8766,"term":{"columns":102,"lines":30}}

Binary file not shown.

Binary file not shown.

@ -1 +0,0 @@
{"duration":38.238195,"term":{"columns":98,"lines":27}}

Binary file not shown.

Binary file not shown.

@ -1 +0,0 @@
{"duration":170.28530999999998,"term":{"columns":89,"lines":27}}

Binary file not shown.

Binary file not shown.

@ -1 +0,0 @@
{"duration":112.36874,"term":{"columns":89,"lines":27}}

Binary file not shown.

Binary file not shown.

@ -1,38 +1,6 @@
module Asciinema
module FeatureHelpers
def uploaded_file(path, type)
ActionDispatch::Http::UploadedFile.new(
:filename => File.basename(path),
:tempfile => File.open(path),
:type => type
)
end
def load_asciicast(id)
AsciicastCreator.new.create(
:meta => uploaded_file(
"spec/fixtures/asciicasts/#{id}/meta.json",
'application/json'
),
:stdout => fixture_file_upload(
"spec/fixtures/asciicasts/#{id}/stdout",
"application/octet-stream"
),
:stdout_timing => fixture_file_upload(
"spec/fixtures/asciicasts/#{id}/stdout.time",
"application/octet-stream"
)
)
end
def load_all_asciicasts
Dir['spec/fixtures/asciicasts/*'].each do |dir|
id = dir[/\d+/]
load_asciicast(id)
end
end
def expect_browse_links
expect(page).to have_link('All')
expect(page).to have_link('Popular')

Loading…
Cancel
Save