diff --git a/.travis.yml b/.travis.yml index 7ea15d7f..5aa48822 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,10 +5,9 @@ rvm: - 2.2 - 2.3 - 2.4 - - ruby-head - - rbx-3.69 + - rbx-3.86 - jruby-9.1.14.0 - - jruby + - ruby-head - jruby-head install: @@ -23,9 +22,7 @@ sudo: false matrix: allow_failures: - rvm: ruby-head - - rvm: jruby - rvm: jruby-head - - rvm: rbx-3.69 - rvm: 2.4 # https://bugs.ruby-lang.org/issues/13537 notifications: diff --git a/CHANGELOG.md b/CHANGELOG.md index f40aef93..8792edfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ #### Features +* Add Pry::Platform#known_engines, returns an Array of Ruby engines + (MRI, JRuby, Rubinius) that Pry is known to run on. + +See pull request [#1694](https://github.com/pry/pry/pull/1694). + * Deprecate Pry::Command#text. Please use black(), white(), etc directly instead (as you would with helper functions from BaseHelpers and CommandHelpers) @@ -50,6 +55,14 @@ See pull request [#1691](https://github.com/pry/pry/pull/1691). See pull request [#1674](https://github.com/pry/pry/pull/1674). + +#### Pry developers + +* Optionally skip a spec on specific Ruby engine(s) by providing `expect_failure: [:mri, :jruby]` + as a metadata Hash to the example group. + +See pull request [#1694](https://github.com/pry/pry/pull/1694). + ### 0.11.0 * Add alias 'whereami[?!]+' for 'whereami' command. ([#1597](https://github.com/pry/pry/pull/1597)) diff --git a/lib/pry/platform.rb b/lib/pry/platform.rb index 5593d1a0..ea273888 100644 --- a/lib/pry/platform.rb +++ b/lib/pry/platform.rb @@ -90,4 +90,12 @@ module Pry::Platform def mri_2? !!(mri? and RUBY_VERSION =~ /\A2/) end + + # + # @return [Array] + # Returns an Array of Ruby engines that Pry is known to run on. + # + def known_engines + [:jruby, :rbx, :mri] + end end diff --git a/spec/commands/save_file_spec.rb b/spec/commands/save_file_spec.rb index 8141e6c6..963380ab 100644 --- a/spec/commands/save_file_spec.rb +++ b/spec/commands/save_file_spec.rb @@ -20,7 +20,7 @@ describe "save-file" do @t.eval("save-file '#{path}' --to '#{@path}'") - + expect(File.read(@path)).to eq(File.read(path)) end end @@ -141,7 +141,7 @@ describe "save-file" do end describe "saving commands" do - it 'should save a command to a file' do + it 'should save a command to a file', expect_failure: [:rbx] do @t.eval "save-file --to '#{@path}' show-source" cmd_source = Pry.config.commands["show-source"].source expect(File.read(@path)).to eq(cmd_source) diff --git a/spec/commands/show_source_spec.rb b/spec/commands/show_source_spec.rb index f0f19ec9..495caabf 100644 --- a/spec/commands/show_source_spec.rb +++ b/spec/commands/show_source_spec.rb @@ -623,13 +623,13 @@ describe "show-source" do end describe "when current context is a C object" do - it "should display a warning, and not monkey-patched definition" do + it "should display a warning, and not monkey-patched definition", expect_failure: [:rbx] do out = pry_eval([1, 2, 3], 'show-source') expect(out).not_to match(/doge/) expect(out).to match(/warning/i) end - it "recommends to use the --all switch when other candidates are found" do + it "recommends to use the --all switch when other candidates are found", expect_failure: [:rbx] do out = pry_eval([], 'show-source') expect(out).to match(/'--all' switch/i) end diff --git a/spec/helper.rb b/spec/helper.rb index 97f5dfd1..1899da3d 100644 --- a/spec/helper.rb +++ b/spec/helper.rb @@ -42,6 +42,17 @@ RSpec.configure do |config| config.include Pry::Testable::Utility include Pry::Testable::Evalable include Pry::Testable::Variables + + # Optionally skip a test on specific Ruby engine(s). + # Please use this feature sparingly! It is better that a feature works than not. + # Inapplicable features are OK. + config.before(:each) do |example| + Pry::Platform.known_engines.each do |engine| + example.metadata[:expect_failure].to_a.include?(engine) and + Pry::Platform.public_send(:"#{engine}?") and + skip("This spec is failing or inapplicable on #{engine}.") + end + end end puts "Ruby v#{RUBY_VERSION} (#{defined?(RUBY_ENGINE) ? RUBY_ENGINE : "ruby"}), Pry v#{Pry::VERSION}, method_source v#{MethodSource::VERSION}, CodeRay v#{CodeRay::VERSION}, Pry::Slop v#{Pry::Slop::VERSION}" diff --git a/spec/hooks_spec.rb b/spec/hooks_spec.rb index 686b4736..be37f17e 100644 --- a/spec/hooks_spec.rb +++ b/spec/hooks_spec.rb @@ -175,13 +175,13 @@ describe Pry::Hooks do describe "getting hooks" do describe "get_hook" do it 'should return the correct requested hook' do - run = false - fun = false - @hooks.add_hook(:test_hook, :my_name) { run = true } - @hooks.add_hook(:test_hook, :my_name2) { fun = true } + run1 = false + run2 = false + @hooks.add_hook(:test_hook, :my_name) { run1 = true } + @hooks.add_hook(:test_hook, :my_name2) { run2 = true } @hooks.get_hook(:test_hook, :my_name).call - expect(run).to eq true - expect(fun).to eq false + expect(run1).to eq true + expect(run2).to eq false end it 'should return nil if hook does not exist' do diff --git a/spec/pryrc_spec.rb b/spec/pryrc_spec.rb index 9324b5de..fcf2d5d7 100644 --- a/spec/pryrc_spec.rb +++ b/spec/pryrc_spec.rb @@ -37,7 +37,7 @@ describe Pry do end end - it "should not load the pryrc if pryrc's directory permissions do not allow this" do + it "should not load the pryrc if pryrc's directory permissions do not allow this", expect_failure: [:rbx] do Dir.mktmpdir do |dir| File.chmod 0000, dir Pry::LOCAL_RC_FILE.replace File.join(dir, '.pryrc')