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.
asciinema.org/spec/api/asciicast_create_spec.rb

36 lines
993 B
Ruby

require 'rails_helper'
describe "Asciicast creation" do
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')
}
end
let(:meta_filename) { 'meta.json' }
it 'returns the URL to the uploaded asciicast' do
expect(response.body).to eq(asciicast_url(Asciicast.last))
end
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
end