2013-08-08 13:41:57 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2014-02-25 17:28:57 +00:00
|
|
|
describe "Asciicast creation" do
|
2014-02-11 16:49:22 +00:00
|
|
|
|
|
|
|
before do
|
|
|
|
post '/api/asciicasts', asciicast: {
|
|
|
|
meta: fixture_file(meta_filename, 'application/json'),
|
|
|
|
stdout: fixture_file('stdout', 'application/octet-stream'),
|
|
|
|
stdout_timing: fixture_file('stdout.time', 'application/octet-stream')
|
2013-08-08 13:41:57 +00:00
|
|
|
}
|
2014-02-11 16:49:22 +00:00
|
|
|
end
|
2013-08-08 13:41:57 +00:00
|
|
|
|
2014-02-11 16:49:22 +00:00
|
|
|
let(:meta_filename) { 'meta.json' }
|
|
|
|
|
|
|
|
it 'returns the URL to the uploaded asciicast' do
|
2013-08-08 13:41:57 +00:00
|
|
|
expect(response.body).to eq(asciicast_url(Asciicast.last))
|
|
|
|
end
|
2014-02-11 16:49:22 +00:00
|
|
|
|
|
|
|
context "when json includes uname (legacy)" do
|
|
|
|
let(:meta_filename) { 'meta-with-uname.json' }
|
|
|
|
|
|
|
|
it 'returns the URL to the uploaded asciicast' do
|
|
|
|
expect(response.body).to eq(asciicast_url(Asciicast.last))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "when json doesn't include user_token (anonymous?)" do
|
|
|
|
let(:meta_filename) { 'meta-no-token.json' }
|
|
|
|
|
|
|
|
it 'returns the URL to the uploaded asciicast' do
|
|
|
|
expect(response.body).to eq(asciicast_url(Asciicast.last))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-08-08 13:41:57 +00:00
|
|
|
end
|