summaryrefslogtreecommitdiff
path: root/spec/mspec/spec
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-25 18:47:17 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-25 18:47:17 +0000
commite2d74af38b0a5329615e03f964acf01cd0266782 (patch)
tree611b633b9761ad505e5faa43f9f4505d34cfc6c5 /spec/mspec/spec
parent2466288d27eba50a6a68bd00f854b5a7687745ae (diff)
Update to ruby/mspec@2bca8cb
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/mspec/spec')
-rw-r--r--spec/mspec/spec/fixtures/chatty_spec.rb8
-rw-r--r--spec/mspec/spec/fixtures/die_spec.rb7
-rw-r--r--spec/mspec/spec/integration/run_spec.rb22
-rw-r--r--spec/mspec/spec/runner/formatters/multi_spec.rb4
4 files changed, 36 insertions, 5 deletions
diff --git a/spec/mspec/spec/fixtures/chatty_spec.rb b/spec/mspec/spec/fixtures/chatty_spec.rb
new file mode 100644
index 0000000000..2d110d8ce4
--- /dev/null
+++ b/spec/mspec/spec/fixtures/chatty_spec.rb
@@ -0,0 +1,8 @@
+unless defined?(RSpec)
+ describe "Chatty#spec" do
+ it "prints too much" do
+ STDOUT.puts "Hello\nIt's me!"
+ 1.should == 1
+ end
+ end
+end
diff --git a/spec/mspec/spec/fixtures/die_spec.rb b/spec/mspec/spec/fixtures/die_spec.rb
new file mode 100644
index 0000000000..0f66793274
--- /dev/null
+++ b/spec/mspec/spec/fixtures/die_spec.rb
@@ -0,0 +1,7 @@
+unless defined?(RSpec)
+ describe "Deadly#spec" do
+ it "dies" do
+ abort "DEAD"
+ end
+ end
+end
diff --git a/spec/mspec/spec/integration/run_spec.rb b/spec/mspec/spec/integration/run_spec.rb
index 93d2ef8b68..dc2a9933f9 100644
--- a/spec/mspec/spec/integration/run_spec.rb
+++ b/spec/mspec/spec/integration/run_spec.rb
@@ -24,23 +24,21 @@ EOS
a_stats = "1 file, 3 examples, 2 expectations, 1 failure, 1 error, 0 tagged\n"
ab_stats = "2 files, 4 examples, 3 expectations, 1 failure, 1 error, 0 tagged\n"
+ fixtures = "spec/fixtures"
it "runs the specs" do
- fixtures = "spec/fixtures"
out, ret = run_mspec("run", "#{fixtures}/a_spec.rb")
out.should == "RUBY_DESCRIPTION\n.FE\n#{a_spec_output}\n#{a_stats}"
ret.success?.should == false
end
it "directly with mspec-run runs the specs" do
- fixtures = "spec/fixtures"
out, ret = run_mspec("-run", "#{fixtures}/a_spec.rb")
out.should == "RUBY_DESCRIPTION\n.FE\n#{a_spec_output}\n#{a_stats}"
ret.success?.should == false
end
it "runs the specs in parallel with -j" do
- fixtures = "spec/fixtures"
out, ret = run_mspec("run", "-j #{fixtures}/a_spec.rb #{fixtures}/b_spec.rb")
progress_bar =
"\r[/ | 0% | 00:00:00] \e[0;32m 0F \e[0;32m 0E\e[0m " +
@@ -49,4 +47,22 @@ EOS
out.should == "RUBY_DESCRIPTION\n#{progress_bar}\n#{a_spec_output}\n#{ab_stats}"
ret.success?.should == false
end
+
+ it "gives a useful error message when a subprocess dies in parallel mode" do
+ out, ret = run_mspec("run", "-j #{fixtures}/b_spec.rb #{fixtures}/die_spec.rb")
+ lines = out.lines
+ lines.should include "A child mspec-run process died unexpectedly while running CWD/spec/fixtures/die_spec.rb\n"
+ lines.should include "Finished in D.DDDDDD seconds\n"
+ lines.last.should =~ /^\d files?, \d examples?, \d expectations?, 0 failures, 0 errors, 0 tagged$/
+ ret.success?.should == false
+ end
+
+ it "gives a useful error message when a subprocess prints unexpected output on STDOUT in parallel mode" do
+ out, ret = run_mspec("run", "-j #{fixtures}/b_spec.rb #{fixtures}/chatty_spec.rb")
+ lines = out.lines
+ lines.should include "A child mspec-run process printed unexpected output on STDOUT: #{'"Hello\nIt\'s me!\n"'} while running CWD/spec/fixtures/chatty_spec.rb\n"
+ lines.should include "Finished in D.DDDDDD seconds\n"
+ lines.last.should == "2 files, 2 examples, 2 expectations, 0 failures, 0 errors, 0 tagged\n"
+ ret.success?.should == false
+ end
end
diff --git a/spec/mspec/spec/runner/formatters/multi_spec.rb b/spec/mspec/spec/runner/formatters/multi_spec.rb
index afcc7e9cea..72bf629f71 100644
--- a/spec/mspec/spec/runner/formatters/multi_spec.rb
+++ b/spec/mspec/spec/runner/formatters/multi_spec.rb
@@ -9,10 +9,10 @@ describe MultiFormatter, "#aggregate_results" do
@file = double("file").as_null_object
File.stub(:delete)
- YAML.stub(:load)
+ File.stub(:read)
@hash = { "files"=>1, "examples"=>1, "expectations"=>2, "failures"=>0, "errors"=>0 }
- File.stub(:open).and_yield(@file).and_return(@hash)
+ YAML.stub(:load).and_return(@hash)
@formatter = MultiFormatter.new
@formatter.timer.stub(:format).and_return("Finished in 42 seconds")