spec/msgr/msgr/routes_spec.rb in msgr-0.14.1.1.b125 vs spec/msgr/msgr/routes_spec.rb in msgr-0.14.1.1.b126

- old
+ new

@@ -1,12 +1,13 @@ +# frozen_string_literal: true require 'spec_helper' describe Msgr::Routes do let(:routes) { Msgr::Routes.new } describe '#configure' do - let(:block) { Proc.new{} } + let(:block) { proc {} } it 'should evaluate given block within instance context' do expect(routes).to receive(:instance_eval) do |&p| expect(p).to be block end @@ -45,11 +46,11 @@ describe '#route' do let(:subject) { -> { routes.route 'routing.key', to: 'test2#index2' } } let(:last_route) { routes.routes.last } it 'should add a new route' do - expect { subject.call }.to change{ routes.routes.size }.from(0).to(1) + expect { subject.call }.to change { routes.routes.size }.from(0).to(1) end it 'should add given route' do subject.call @@ -58,18 +59,18 @@ expect(last_route.action).to eq 'index2' end context 'with same target' do let(:subject) do - -> do + lambda do routes.route 'routing.key', to: 'test#index' routes.route 'another.routing.key', to: 'test#index' end end it 'should only add one new route' do - expect { subject.call }.to change{ routes.routes.size }.from(0).to(1) + expect { subject.call }.to change { routes.routes.size }.from(0).to(1) end it 'should add second binding to first route' do subject.call expect(routes.routes.first.keys).to eq %w(routing.key another.routing.key) @@ -85,10 +86,10 @@ expect(routes.files).to eq %w(abc.rb cde.rb edf.rb) end end describe 'reload' do - before { File.stub(:exists?).and_return(true) } + before { File.stub(:exist?).and_return(true) } it 'should trigger load for all files' do expect(routes).to receive(:load).with('cde.rb').ordered expect(routes).to receive(:load).with('edf.rb').ordered routes.files += %w(cde.rb edf.rb)