1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Wrap 2.1 specific specs (keyword args) in 2.1 version check guard

This commit is contained in:
John Mair 2018-02-23 01:13:38 +01:00
parent 5b10692c72
commit 387bd8618e

View file

@ -536,6 +536,13 @@ describe Pry::Method do
expect(signature).to eq("rest(*splat)")
end
it 'should print the name of optional args, with =? after the arg name' do
signature = Pry::Method.new(@class.method(:optional)).signature
expect(signature).to eq("optional(option=?)")
end
# keyword args are only on >= Ruby 2.1
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.1")
it 'should print the name of keyword args, with :? after the arg name' do
signature = Pry::Method.new(@class.method(:keyword)).signature
expect(signature).to eq("keyword(keyword_arg:?)")
@ -545,10 +552,6 @@ describe Pry::Method do
signature = Pry::Method.new(@class.method(:required_keyword)).signature
expect(signature).to eq("required_keyword(required_key:)")
end
it 'should print the name of optional args, with =? after the arg name' do
signature = Pry::Method.new(@class.method(:optional)).signature
expect(signature).to eq("optional(option=?)")
end
end
end