Skip to content

Commit

Permalink
added acceptance spec
Browse files Browse the repository at this point in the history
  • Loading branch information
realmyst committed Jan 27, 2012
1 parent 8233b05 commit a9d62ea
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions Rakefile
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions acceptance/minitest_example_test.rb
@@ -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
35 changes: 35 additions & 0 deletions acceptance/verification_spec.rb
Expand Up @@ -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
Expand Down

0 comments on commit a9d62ea

Please sign in to comment.