You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.0 KiB
Ruby
46 lines
1.0 KiB
Ruby
11 years ago
|
require 'spec_helper'
|
||
|
|
||
|
describe "Asciicast retrieval" do
|
||
|
|
||
|
let(:asciicast) { create(:asciicast) }
|
||
|
|
||
|
context "when requested as js" do
|
||
|
before do
|
||
|
get "/a/#{asciicast.id}.js"
|
||
|
end
|
||
|
|
||
|
it "responds with status 200" do
|
||
|
expect(response.status).to eq(200)
|
||
|
end
|
||
|
|
||
|
it "responds with javascript content type" do
|
||
|
expect(response.headers['Content-Type']).to match('text/javascript')
|
||
|
end
|
||
|
|
||
|
it "responds with embeddable player code" do
|
||
|
expect(response.body).to match(/iframe/)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
context "when requested as html" do
|
||
|
include Capybara::RSpecMatchers
|
||
|
|
||
|
before do
|
||
|
get "/api/asciicasts/#{asciicast.id}", format: 'html'
|
||
|
end
|
||
|
|
||
|
it "responds with status 200" do
|
||
|
expect(response.status).to eq(200)
|
||
|
end
|
||
|
|
||
|
it "responds with html content type" do
|
||
|
expect(response.headers['Content-Type']).to match('text/html')
|
||
|
end
|
||
|
|
||
|
it "responds with player page using iframe layout" do
|
||
|
expect(response.body).to have_selector('body.iframe div.player')
|
||
|
end
|
||
|
end
|
||
|
|
||
|
end
|