screenomat/spec/lib/screenie/dsl/session_spec.rb
John Bintz 234a6734b3 stuff
2010-12-09 16:20:21 -05:00

67 lines
1.5 KiB
Ruby

require 'spec_helper'
require 'screenie/dsl/session'
describe Screenie::DSL::Session do
describe '#to_cmd' do
context 'one screen' do
subject {
Screenie::DSL::Session.new("my-session") { screen "test" }.to_cmd
}
it { should == [
%{screen -dmS "my-session"},
%{screen -X -S "my-session" -p 0 stuff "test
"},
%{screen -x "my-session" -p 0}
] }
end
context 'two screens' do
subject {
Screenie::DSL::Session.new("my-session") { screen "test"; screen "test2" }.to_cmd
}
it { should == [
%{screen -dmS "my-session"},
%{screen -X -S "my-session" -p 0 stuff "test
"},
%{screen -X -S "my-session" screen 1},
%{screen -X -S "my-session" -p 1 stuff "test2
"},
%{screen -x "my-session" -p 0}
] }
end
end
describe 'from string' do
subject {
Screenie::DSL::Session.new("my-session", <<-EOR).to_cmd
screen "test"
EOR
}
it { should == [
%{screen -dmS "my-session"},
%{screen -X -S "my-session" -p 0 stuff "test
"},
%{screen -x "my-session" -p 0}
] }
end
describe 'screen!' do
subject {
Screenie::DSL::Session.new("my-session") { screen "test"; screen! "test2" }.to_cmd
}
it { should == [
%{screen -dmS "my-session"},
%{screen -X -S "my-session" -p 0 stuff "test
"},
%{screen -X -S "my-session" screen 1},
%{screen -X -S "my-session" -p 1 stuff "test2
"},
%{screen -x "my-session" -p 1}
] }
end
end