mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
rubocop: fix offences of the Layout/FirstParameterIndentation cop
This commit is contained in:
parent
f0a6af8492
commit
970d0e1d57
5 changed files with 53 additions and 46 deletions
|
@ -13,17 +13,6 @@ Gemspec/RequiredRubyVersion:
|
|||
Exclude:
|
||||
- 'pry.gemspec'
|
||||
|
||||
# Offense count: 9
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||
# SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
|
||||
Layout/FirstParameterIndentation:
|
||||
Exclude:
|
||||
- 'lib/pry/input_completer.rb'
|
||||
- 'spec/command_spec.rb'
|
||||
- 'spec/commands/ls_spec.rb'
|
||||
- 'spec/method_spec.rb'
|
||||
|
||||
# Offense count: 3
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||
|
|
|
@ -20,13 +20,19 @@ describe "ls" do
|
|||
end
|
||||
|
||||
it "should include super-classes by default" do
|
||||
expect(pry_eval(
|
||||
expect(
|
||||
pry_eval(
|
||||
"cd Class.new(Class.new{ def goo; end; public :goo }).new",
|
||||
"ls")).to match(/goo/)
|
||||
"ls"
|
||||
)
|
||||
).to match(/goo/)
|
||||
|
||||
expect(pry_eval(
|
||||
expect(
|
||||
pry_eval(
|
||||
"cd Class.new(Class.new{ def goo; end; public :goo })",
|
||||
"ls -M")).to match(/goo/)
|
||||
"ls -M"
|
||||
)
|
||||
).to match(/goo/)
|
||||
end
|
||||
|
||||
it "should not include super-classes when -q is given" do
|
||||
|
@ -47,10 +53,12 @@ describe "ls" do
|
|||
end
|
||||
|
||||
it "should work on subclasses of BasicObject" do
|
||||
expect(pry_eval(
|
||||
expect(
|
||||
pry_eval(
|
||||
"class LessBasic < BasicObject; def jaroussky; 5; end; end",
|
||||
"ls LessBasic.new"
|
||||
)).to match(/LessBasic#methods:.*jaroussky/m)
|
||||
)
|
||||
).to match(/LessBasic#methods:.*jaroussky/m)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -127,6 +135,7 @@ describe "ls" do
|
|||
expect(result).not_to match(/0x\d{5}/)
|
||||
expect(result).to match(/asdf.*xyz/m)
|
||||
end
|
||||
|
||||
it 'should not list pry noise' do
|
||||
expect(pry_eval('ls -l')).not_to match(/_(?:dir|file|ex|pry|out|in)_/)
|
||||
end
|
||||
|
@ -134,17 +143,23 @@ describe "ls" do
|
|||
|
||||
describe "when inside Modules" do
|
||||
it "should still work" do
|
||||
expect(pry_eval(
|
||||
expect(
|
||||
pry_eval(
|
||||
"cd Module.new{ def foobie; end; public :foobie }",
|
||||
"ls -M")).to match(/foobie/)
|
||||
"ls -M"
|
||||
)
|
||||
).to match(/foobie/)
|
||||
end
|
||||
|
||||
it "should work for ivars" do
|
||||
expect(pry_eval(
|
||||
expect(
|
||||
pry_eval(
|
||||
"module StigmaT1sm; def foobie; @@gharble = 456; end; end",
|
||||
"Object.new.tap{ |o| o.extend(StigmaT1sm) }.foobie",
|
||||
"cd StigmaT1sm",
|
||||
"ls -i")).to match(/@@gharble/)
|
||||
"ls -i"
|
||||
)
|
||||
).to match(/@@gharble/)
|
||||
end
|
||||
|
||||
it "should include instance methods by default" do
|
||||
|
@ -184,11 +199,13 @@ describe "ls" do
|
|||
end
|
||||
|
||||
it "should show constants for an object's class regardless of mixins" do
|
||||
expect(pry_eval(
|
||||
expect(
|
||||
pry_eval(
|
||||
"cd Pry.new",
|
||||
"extend Module.new",
|
||||
"ls -c"
|
||||
)).to match(/Method/)
|
||||
)
|
||||
).to match(/Method/)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -486,10 +486,11 @@ describe Pry::Method do
|
|||
end
|
||||
|
||||
it "should include the Pry::Method.instance_resolution_order of Class after the singleton classes" do
|
||||
expect(Pry::Method.resolution_order(LS::Top)).to eq(
|
||||
[eigen_class(LS::Top), eigen_class(Object), eigen_class(BasicObject),
|
||||
*Pry::Method.instance_resolution_order(Class)]
|
||||
)
|
||||
singleton_classes = [
|
||||
eigen_class(LS::Top), eigen_class(Object), eigen_class(BasicObject),
|
||||
*Pry::Method.instance_resolution_order(Class)
|
||||
]
|
||||
expect(Pry::Method.resolution_order(LS::Top)).to eq(singleton_classes)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue