Permalink
Browse files

added acceptance spec

  • Loading branch information...
realmyst committed Jan 27, 2012
1 parent 8233b05 commit a9d62ea5ef639abec4f91654562c0e524a14c4a8
Showing with 53 additions and 0 deletions.
  1. +1 −0 Rakefile
  2. +17 −0 acceptance/minitest_example_test.rb
  3. +35 −0 acceptance/verification_spec.rb
View
@@ -97,6 +97,7 @@ task :generate_output do
begin
result_proc = proc {|ok,*| puts "Failures above are expected." unless ok }
ruby "-Ilib #{opts} -rci/reporter/rake/test_unit_loader acceptance/test_unit_example_test.rb", &result_proc
+ ruby "-Ilib #{opts} -rci/reporter/rake/minitest_loader acceptance/minitest_example_test.rb", &result_proc
ruby "-Ilib #{opts} -S #{@spec_bin} --require ci/reporter/rake/rspec_loader --format CI::Reporter::RSpec acceptance/rspec_example_spec.rb", &result_proc
ruby "-Ilib #{opts} -rci/reporter/rake/cucumber_loader -S cucumber --format CI::Reporter::Cucumber acceptance/cucumber", &result_proc
ensure
@@ -0,0 +1,17 @@
+require 'minitest/autorun'
+
+class MiniTestExampleTestOne < MiniTest::Unit::TestCase
+ def test_one
+ puts "Some <![CDATA[on stdout]]>"
+ assert false
+ end
+ def teardown
+ raise "second failure"
+ end
+end
+
+class MiniTestExampleTestTwo < MiniTest::Unit::TestCase
+ def test_two
+ assert true
+ end
+end
@@ -37,6 +37,41 @@
end
end
+describe "MiniTest::Unit acceptance" do
+ it "should generate two XML files" do
+ File.exist?(File.join(REPORTS_DIR, 'TEST-MiniTestExampleTestOne.xml')).should == true
+ File.exist?(File.join(REPORTS_DIR, 'TEST-MiniTestExampleTestTwo.xml')).should == true
+ end
+
+ it "should have one error and one failure for MiniTestExampleTestOne" do
+ doc = File.open(File.join(REPORTS_DIR, 'TEST-MiniTestExampleTestOne.xml')) do |f|
+ REXML::Document.new(f)
+ end
+ doc.root.attributes["errors"].should == "1"
+ doc.root.attributes["failures"].should == "1"
+ doc.root.attributes["assertions"].should == "1"
+ doc.root.attributes["tests"].should == "1"
+ doc.root.elements.to_a("/testsuite/testcase").size.should == 1
+ doc.root.elements.to_a("/testsuite/testcase/error").size.should == 1
+ doc.root.elements.to_a("/testsuite/testcase/failure").size.should == 1
+ doc.root.elements.to_a("/testsuite/system-out").first.texts.inject("") do |c,e|
+ c << e.value; c
+ end.strip.should == "Some <![CDATA[on stdout]]>"
+ end
+
+ it "should have no errors or failures for MiniTestExampleTestTwo" do
+ doc = File.open(File.join(REPORTS_DIR, 'TEST-MiniTestExampleTestTwo.xml')) do |f|
+ REXML::Document.new(f)
+ end
+ doc.root.attributes["errors"].should == "0"
+ doc.root.attributes["failures"].should == "0"
+ doc.root.attributes["assertions"].should == "1"
+ doc.root.attributes["tests"].should == "1"
+ doc.root.elements.to_a("/testsuite/testcase").size.should == 1
+ doc.root.elements.to_a("/testsuite/testcase/failure").size.should == 0
+ end
+end
+
describe "RSpec acceptance" do
it "should generate two XML files" do
File.exist?(File.join(REPORTS_DIR, 'SPEC-RSpec-example.xml')).should == true

0 comments on commit a9d62ea

Please sign in to comment.