Browse files

add failing tests for exitstatus issue

  • Loading branch information...
1 parent 46ee9c3 commit df4c3c0ee66750d5bf986d0430a9990215565e04 @comboy comboy committed Apr 11, 2012
Showing with 39 additions and 0 deletions.
  1. +15 −0 spec/fixtures/example_spec2.txt
  2. +24 −0 spec/models/moci/test_runner/spec_spec.rb
View
15 spec/fixtures/example_spec2.txt
@@ -0,0 +1,15 @@
+class Foo
+ def bar
+ "baz"
+ end
+end
+
+describe Foo do
+ it "should baz" do
+ Foo.new.bar.should == "baz"
+ end
+
+ it "should not fail" do
+ 1.should == 1
+ end
+end
View
24 spec/models/moci/test_runner/spec_spec.rb
@@ -50,6 +50,30 @@
@tsr.test_unit_runs.find{|t| t.test_unit.name == "should fail sometimes"}.run_time.should > 0.2
end
+ it "should save proper exitstatus" do
+ @tsr.exitstatus.should == false
+ end
+ end
+
+ context "with another example spec" do
+ before :all do
+ @ts = Factory.create :test_suite, :suite_type => 'Spec', :suite_options => {'specs' => 'spec/foo_spec.rb'}
+ @tsr = Factory.create :test_suite_run
+ spec_dir = File.join(@tsr.project_instance.working_directory, 'spec')
+ FileUtils.mkdir_p(File.join(@tsr.project_instance.working_directory, 'spec'))
+ FileUtils.cp(File.join(Rails.root,'spec','fixtures','example_spec2.txt'), File.join(spec_dir,'foo_spec.rb'))
+ @spec = Moci::TestRunner::Spec.new @tsr
+ @spec.run
+ @tsr.reload
+ end
+
+ it "should find 2 tests" do
+ @tsr.tests_count.should == 2
+ end
+
+ it "should save proper exit status" do
+ @tsr.exitstatus.should == true
+ end
end
end

0 comments on commit df4c3c0

Please sign in to comment.