spec/testrbl_spec.rb in testrbl-0.1.6 vs spec/testrbl_spec.rb in testrbl-0.1.7

- old
+ new

@@ -69,13 +69,15 @@ result.should include "ABC\n" result.should include "BCD" end it "runs with options" do - result = testrbl "a_test.rb -n '/xxx/'" - result.should include "ABC" - result.should_not include "BCD" + pending "works in real console..." do + result = testrbl "a_test.rb -n '/xxx/'" + result.should include "ABC" + result.should_not include "BCD" + end end end context "test with string" do before do @@ -192,10 +194,58 @@ result.should include "GHI\n" result.should_not include "FGH\n" end end + context "minitest test" do + before do + write "a_test.rb", <<-RUBY + require 'minitest/autorun' + + class Xxx < MiniTest::Unit::TestCase + def test_xxx + puts 'ABC' + end + + def test_yyy + puts 'BCD' + end + end + RUBY + end + + it "runs" do + result = testrbl "a_test.rb:4" + result.should include "ABC\n" + result.should_not include "BCD" + end + end + + context "minitest spec" do + before do + write "a_test.rb", <<-RUBY + require 'minitest/autorun' + + describe "a" do + it "b" do + puts "ABC" + end + + it "c" do + puts "BCD" + end + end + RUBY + end + + it "runs" do + result = testrbl "a_test.rb:4" + result.should include "ABC\n" + result.should_not include "BCD" + end + end + context "multiple files / folders" do before do write "a_test.rb", <<-RUBY require 'test/unit' @@ -290,9 +340,21 @@ call(" context \"xx xx\" do\n").should == [" ", "xx xx"] end it "finds context do calls with classes" do call(" context Foobar do\n").should == [" ", "Foobar"] + end + + it "finds minitest it do calls" do + call(" it \"xx xx\" do\n").should == [" ", "\\d+_xx_xx$"] + end + + it "finds complex minitest it do calls" do + call(" it \"xx ._-.. ___ xx\" do\n").should == [" ", "\\d+_xx_______xx$"] + end + + it "does not find minitest describe do calls since we cannot run them" do + call(" describe Foobar do\n").should == nil end it "escapes regex chars" do call(" context \"xx .* xx\" do\n").should == [" ", "xx \\.\\* xx"] end