summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorr-obert <r-obert@users.noreply.github.com>2017-11-18 20:54:03 +0100
committerGitHub <noreply@github.com>2017-11-18 20:54:03 +0100
commit3499b21a0295ee114bb5b4e0093b4e355389c5a3 (patch)
tree3ede5ecd6497790bd97da6f676bb8ff69305abc3
parent3bd43b9db4f866e9c47897e707f000a33b3139e9 (diff)
downloadpry-3499b21a0295ee114bb5b4e0093b4e355389c5a3.tar.gz
add rbx-3.86, add Pry::Platform.known_engines, allow expected failures in spec suite (#1694)
* Add Pry::Platform.known_engines * Add fixes for rbx-3.86, and cleanup .travis.yml * Optionally skip a test on specific Ruby engine(s). And tag specs that currently do not pass on Rubinius. Travis takes much longer to complete after this change. Maybe there are switches we can pass to speed up Rubinius, or this will improve on new versions of Rubinius.
-rw-r--r--.travis.yml7
-rw-r--r--CHANGELOG.md13
-rw-r--r--lib/pry/platform.rb8
-rw-r--r--spec/commands/save_file_spec.rb4
-rw-r--r--spec/commands/show_source_spec.rb4
-rw-r--r--spec/helper.rb11
-rw-r--r--spec/hooks_spec.rb12
-rw-r--r--spec/pryrc_spec.rb2
8 files changed, 45 insertions, 16 deletions
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<Symbol>]
+ # 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')