Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit 23f911b

Browse files
committed
Skip specs with non-mri-compatible backtrace. Also see rspec-support
The code in spec/support/ruby_features.rb shoul be moved into rspec-support lib/rspec/support/spec/prevent_load_time_warnings.rb:53 - it "issues no warnings when the spec files are loaded", :slow do + it "issues no warnings when the spec files are loaded", :slow, :unless => (RUBY_PLATFORM == 'java' || (defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx')) do expect_no_warnings_from_files_in "spec", "require 'rspec/core'; require 'spec_helper'" end
1 parent 703a882 commit 23f911b

File tree

5 files changed

+34
-4
lines changed

5 files changed

+34
-4
lines changed

features/core_standalone.feature

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Feature: Use rspec-core without rspec-mocks or rspec-expectations
55
available, but rspec-core can be used just fine without either of those
66
gems installed.
77

8+
# Rubinius stacktrace includes kernel/loader.rb etc.
9+
@unsupported-on-rbx
810
Scenario: Use only rspec-core when only it is installed
911
Given only rspec-core is installed
1012
And a file named "core_only_spec.rb" with:

spec/rspec/core/drb_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require "spec_helper"
22
require 'rspec/core/drb'
33

4-
RSpec.describe RSpec::Core::DRbRunner, :isolated_directory => true, :isolated_home => true, :type => :drb, :unless => RUBY_PLATFORM == 'java' do
4+
RSpec.describe RSpec::Core::DRbRunner, :isolated_directory => true, :isolated_home => true, :type => :drb, :unless => RSpec::Support::RubyFeatures.non_mri_backtrace? do
55
let(:config) { RSpec::Core::Configuration.new }
66
let(:out) { StringIO.new }
77
let(:err) { StringIO.new }

spec/rspec/core/formatters/documentation_formatter_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ def execution_result(values)
7878
")
7979
end
8080

81-
# The backrace is slightly different on JRuby so we skip there.
82-
it 'produces the expected full output', :unless => RUBY_PLATFORM == 'java' do
81+
# The backtrace is slightly different on JRuby/Rubinius so we skip there.
82+
it 'produces the expected full output', :unless => RSpec::Support::RubyFeatures.non_mri_backtrace? do
8383
output = run_example_specs_with_formatter("doc")
8484
output.gsub!(/ +$/, '') # strip trailing whitespace
8585

spec/rspec/core/formatters/progress_formatter_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
end
4343

4444
# The backrace is slightly different on JRuby so we skip there.
45-
it 'produces the expected full output', :unless => RUBY_PLATFORM == 'java' do
45+
it 'produces the expected full output', :unless => RSpec::Support::RubyFeatures.non_mri_backtrace? do
4646
output = run_example_specs_with_formatter("progress")
4747
output.gsub!(/ +$/, '') # strip trailing whitespace
4848

spec/support/ruby_features.rb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# rspec-support/lib/rspec/support/ruby_features.rb
2+
module RSpec
3+
module Support
4+
# @api private
5+
#
6+
# Provides query methods for different rubies
7+
module Ruby
8+
module_function
9+
10+
def rbx?
11+
@rbx ||= defined?(Rubinius) == 'constant'
12+
end
13+
end
14+
15+
# @api private
16+
#
17+
# Provides query methods for ruby features that differ among
18+
# implementations.
19+
module RubyFeatures
20+
module_function
21+
22+
def non_mri_backtrace?
23+
@non_mri_backtrace ||= RSpec::Support::Ruby.rbx? ||
24+
RSpec::Support::Ruby.jruby?
25+
end
26+
end
27+
end
28+
end

0 commit comments

Comments
 (0)