|
|
|
@ -71,4 +71,54 @@ describe Asciicast do
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe '#meta=' do
|
|
|
|
|
let(:asciicast) { stub_model(Asciicast) }
|
|
|
|
|
|
|
|
|
|
let(:username) { 'username' }
|
|
|
|
|
let(:user_token) { 'token' }
|
|
|
|
|
let(:duration) { 123.456 }
|
|
|
|
|
let(:recorded_at) { Time.now.to_s }
|
|
|
|
|
let(:title) { 'title' }
|
|
|
|
|
let(:command) { '/bin/command' }
|
|
|
|
|
let(:shell) { '/bin/shell' }
|
|
|
|
|
let(:uname) { 'OS' }
|
|
|
|
|
let(:terminal_lines) { 29 }
|
|
|
|
|
let(:terminal_columns) { 97 }
|
|
|
|
|
let(:terminal_type) { 'xterm-lolz' }
|
|
|
|
|
|
|
|
|
|
it 'assigns attributes properly' do
|
|
|
|
|
data = {
|
|
|
|
|
:username => username,
|
|
|
|
|
:user_token => user_token,
|
|
|
|
|
:duration => duration,
|
|
|
|
|
:recorded_at => recorded_at,
|
|
|
|
|
:title => title,
|
|
|
|
|
:command => command,
|
|
|
|
|
:shell => shell,
|
|
|
|
|
:uname => uname,
|
|
|
|
|
:term => {
|
|
|
|
|
:lines => terminal_lines,
|
|
|
|
|
:columns => terminal_columns,
|
|
|
|
|
:type => terminal_type,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
json = data.to_json
|
|
|
|
|
tempfile = stub('tempfile', :read => json)
|
|
|
|
|
json_file = stub('file', :tempfile => tempfile)
|
|
|
|
|
asciicast.meta = json_file
|
|
|
|
|
|
|
|
|
|
asciicast.username.should == username
|
|
|
|
|
asciicast.user_token.should == user_token
|
|
|
|
|
asciicast.duration.should == duration
|
|
|
|
|
asciicast.recorded_at.should == recorded_at
|
|
|
|
|
asciicast.title.should == title
|
|
|
|
|
asciicast.command.should == command
|
|
|
|
|
asciicast.shell.should == shell
|
|
|
|
|
asciicast.uname.should == uname
|
|
|
|
|
asciicast.terminal_lines.should == terminal_lines
|
|
|
|
|
asciicast.terminal_columns.should == terminal_columns
|
|
|
|
|
asciicast.terminal_type.should == terminal_type
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|