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

Commit

Permalink
Skip specs with non-mri-compatible backtrace. Also see rspec-support
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bf4 committed Nov 19, 2014
1 parent 703a882 commit 23f911b
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 4 deletions.
2 changes: 2 additions & 0 deletions features/core_standalone.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Feature: Use rspec-core without rspec-mocks or rspec-expectations
available, but rspec-core can be used just fine without either of those
gems installed.

# Rubinius stacktrace includes kernel/loader.rb etc.
@unsupported-on-rbx
Scenario: Use only rspec-core when only it is installed
Given only rspec-core is installed
And a file named "core_only_spec.rb" with:
Expand Down
2 changes: 1 addition & 1 deletion spec/rspec/core/drb_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "spec_helper"
require 'rspec/core/drb'

RSpec.describe RSpec::Core::DRbRunner, :isolated_directory => true, :isolated_home => true, :type => :drb, :unless => RUBY_PLATFORM == 'java' do
RSpec.describe RSpec::Core::DRbRunner, :isolated_directory => true, :isolated_home => true, :type => :drb, :unless => RSpec::Support::RubyFeatures.non_mri_backtrace? do
let(:config) { RSpec::Core::Configuration.new }
let(:out) { StringIO.new }
let(:err) { StringIO.new }
Expand Down
4 changes: 2 additions & 2 deletions spec/rspec/core/formatters/documentation_formatter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ def execution_result(values)
")
end

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

Expand Down
2 changes: 1 addition & 1 deletion spec/rspec/core/formatters/progress_formatter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
end

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

Expand Down
28 changes: 28 additions & 0 deletions spec/support/ruby_features.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# rspec-support/lib/rspec/support/ruby_features.rb
module RSpec
module Support
# @api private
#
# Provides query methods for different rubies
module Ruby
module_function

def rbx?
@rbx ||= defined?(Rubinius) == 'constant'
end
end

# @api private
#
# Provides query methods for ruby features that differ among
# implementations.
module RubyFeatures
module_function

def non_mri_backtrace?
@non_mri_backtrace ||= RSpec::Support::Ruby.rbx? ||
RSpec::Support::Ruby.jruby?
end
end
end
end

0 comments on commit 23f911b

Please sign in to comment.