spec/autotest-tmux_spec.rb in autotest-tmux-1.2.0 vs spec/autotest-tmux_spec.rb in autotest-tmux-1.2.2

- old
+ new

@@ -7,11 +7,11 @@ it { should include(hook) } end end describe 'When display message' do - context 'without params' do + context 'without arguments' do it { Autotest::Tmux.message.should be_true } end context 'with String as message' do it { Autotest::Tmux.message('foo').should be_true } @@ -25,9 +25,67 @@ it { Autotest::Tmux.message('foo', :black).should be_true } end context 'with nil as color' do it { Autotest::Tmux.message('foo', nil).should be_true } + end + end + + describe 'When parse result' do + %w!Autotest Autotest::Rails!.each do |name| +#TODO: Fill out. + end + + %w!Autotest::Rspec Autotest::Rspec2 Autotest::RailsRspec Autotest::RailsRspec2 Autotest::MerbRspec!.each do |name| + context "With #{name}, 2 of 3 examples feiled" do + subject { Autotest::Tmux.parse_output('3 examples, 2 failures', name) } + it { should eql({:message => 'Fail F:2 P:0', :color => :red}) } + end + + context "With #{name}, 1 of 2 examples feiled" do + subject { Autotest::Tmux.parse_output('2 examples, 1 failure', name) } + it { should eql({:message => 'Fail F:1 P:0', :color => :red}) } + end + + context "With #{name}, 1 of 1 example feiled" do + subject { Autotest::Tmux.parse_output('1 example, 1 failure', name) } + it { should eql({:message => 'Fail F:1 P:0', :color => :red}) } + end + + context "With #{name}, 2 of 3 examples pending and 1 failed" do + subject { Autotest::Tmux.parse_output('3 examples, 1 failure, 2 pendings', name) } + it { should eql({:message => 'Fail F:1 P:2', :color => :red}) } + end + + context "With #{name}, 1 of 2 examples pending and 1 failed" do + subject { Autotest::Tmux.parse_output('2 examples, 1 failure, 1 pending', name) } + it { should eql({:message => 'Fail F:1 P:1', :color => :red}) } + end + + context "With #{name}, 2 of 3 examples pending" do + subject { Autotest::Tmux.parse_output('3 examples, 0 failures, 2 pendings', name) } + it { should eql({:message => 'Pend F:0 P:2', :color => :yellow}) } + end + + context "With #{name}, 1 of 2 examples pending" do + subject { Autotest::Tmux.parse_output('2 examples, 0 failures, 1 pending', name) } + it { should eql({:message => 'Pend F:0 P:1', :color => :yellow}) } + end + + context "With #{name}, all examples passed" do + subject { Autotest::Tmux.parse_output('2 examples, 0 failures', name) } + it { should eql({:message => 'All Green', :color => :green}) } + end + + context "With #{name}, all examples passed" do + subject { Autotest::Tmux.parse_output('1 example, 0 failures', name) } + it { should eql({:message => 'All Green', :color => :green}) } + end + end + + context 'With FooBar' do + subject { Autotest::Tmux.parse_output('1 example, 0 failures', 'FooBar') } + it { should eql({:message => 'Unknown class. (FooBar)'}) } end end after(:all) do Autotest::Tmux.clear