Skip to content

Commit

Permalink
Use the new lambda literal syntax ->(params) {...}
Browse files Browse the repository at this point in the history
  • Loading branch information
snusnu committed Jul 9, 2013
1 parent d2bd081 commit 202b8e1
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 16 deletions.
3 changes: 0 additions & 3 deletions config/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ HashSyntax:
Blocks:
Enabled: false

Lambda:
Enabled: false

SpaceInsideBrackets:
Enabled: false

Expand Down
4 changes: 2 additions & 2 deletions spec/integration/substation/dispatcher/call_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ def call
end # module Actions

module Observers
LOG_EVENT = lambda { |response| response }
SEND_EMAIL = lambda { |response| response }
LOG_EVENT = ->(response) { response }
SEND_EMAIL = ->(response) { response }
end

DB = Database.new({
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/substation/chain/dsl/builder/dsl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
let(:builder) { described_class.new(registry) }
let(:registry) { { :test => Spec::Processor } }
let(:processors) { [] }
let(:block) { lambda { |_| test(Spec::FAKE_HANDLER, EMPTY_ARRAY) } }
let(:block) { ->(_) { test(Spec::FAKE_HANDLER, EMPTY_ARRAY) } }

let(:processor) { Spec::FAKE_PROCESSOR }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
context 'and a block is given' do
subject { described_class.processors(chain, &block) }

let(:block) { lambda { |_| use(Spec::FAKE_PROCESSOR) } }
let(:block) { ->(_) { use(Spec::FAKE_PROCESSOR) } }
let(:processor) { Spec::FAKE_PROCESSOR }

it { should include(processor) }
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/substation/chain/dsl/failure_chain_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
let(:object) { dsl.new([ Spec::FAKE_PROCESSOR ]) }
let(:dsl) { described_class::Builder.call(registry) }
let(:registry) { Environment::DSL.registry(&block) }
let(:block) { lambda { |_| register(:test, Spec::Processor) } }
let(:block) { ->(_) { register(:test, Spec::Processor) } }

let(:processor) { Spec::FAKE_PROCESSOR.with_failure_chain(failure_chain) }
let(:failure_chain) { mock }

context 'when the processor to alter is registered' do
let(:name) { :test }
let(:name) { :test }

its(:processors) { should include(processor) }

Expand Down
2 changes: 1 addition & 1 deletion spec/unit/substation/chain/dsl/processors_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
context 'and a block is given' do
let(:object) { described_class.new(chain, &block) }
let(:chain) { EMPTY_ARRAY }
let(:block) { lambda { |_| use(Spec::FAKE_PROCESSOR) } }
let(:block) { ->(_) { use(Spec::FAKE_PROCESSOR) } }

it { should include(processor) }

Expand Down
4 changes: 2 additions & 2 deletions spec/unit/substation/environment/chain_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
let(:object) { described_class.build(&block) }

let(:other) { EMPTY_ARRAY }
let(:chain) { lambda { |_| test Spec::FAKE_HANDLER, EMPTY_ARRAY } }
let(:chain) { ->(_) { test Spec::FAKE_HANDLER, EMPTY_ARRAY } }
let(:dsl) { Chain::DSL::Builder.call(registry) }
let(:registry) { described_class::DSL.registry(&block) }
let(:block) { lambda { |_| register(:test, Spec::Processor) } }
let(:block) { ->(_) { register(:test, Spec::Processor) } }

let(:expected) { Chain.new(processors) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
describe Substation::Environment, '.build' do
subject { described_class.build(&block) }

let(:block) { lambda { |_| register(:test, Substation) } }
let(:block) { ->(_) { register(:test, Substation) } }
let(:expected) { described_class.new(registry) }
let(:registry) { described_class::DSL.registry(&block) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
context 'when a block is given' do
subject { described_class.registry(&block) }

let(:block) { lambda { |_| register :test, Spec::Processor } }
let(:block) { ->(_) { register :test, Spec::Processor } }
let(:expected) { { :test => Spec::Processor } }

it { should eql(expected) }
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/substation/environment/dsl/registry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

context 'when a block is given' do
let(:object) { described_class.new(&block) }
let(:block) { lambda { |_| register :test, Spec::Processor } }
let(:block) { ->(_) { register :test, Spec::Processor } }
let(:expected) { { :test => Spec::Processor } }

it { should eql(expected) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
end

context 'with a Proc handler' do
let(:handler) { lambda { |response| respone } }
let(:handler) { ->(response) { response } }

it { should be(handler) }
end
Expand Down

0 comments on commit 202b8e1

Please sign in to comment.