diff --git a/spec/draper/decoratable_spec.rb b/spec/draper/decoratable_spec.rb index c20ae32..c8f5619 100644 --- a/spec/draper/decoratable_spec.rb +++ b/spec/draper/decoratable_spec.rb @@ -192,7 +192,7 @@ module Draper context "when an unrelated NameError is thrown" do it "re-raises that error" do - String.any_instance.stub(:constantize).and_return{Draper::Base} + String.any_instance.stub(:constantize) { Draper::Base } expect{Product.decorator_class}.to raise_error NameError, /Draper::Base/ end end diff --git a/spec/draper/decorator_spec.rb b/spec/draper/decorator_spec.rb index 4090eaf..d9cf729 100755 --- a/spec/draper/decorator_spec.rb +++ b/spec/draper/decorator_spec.rb @@ -148,7 +148,7 @@ module Draper context "when a NameError is thrown" do it "re-raises that error" do - String.any_instance.stub(:constantize).and_return{Draper::DecoratedEnumerableProxy} + String.any_instance.stub(:constantize) { Draper::DecoratedEnumerableProxy } expect{ProductDecorator.decorate_collection([])}.to raise_error NameError, /Draper::DecoratedEnumerableProxy/ end end @@ -207,7 +207,7 @@ module Draper context "when an unrelated NameError is thrown" do it "re-raises that error" do - String.any_instance.stub(:constantize).and_return{SomethingThatDoesntExist} + String.any_instance.stub(:constantize) { SomethingThatDoesntExist } expect{ProductDecorator.object_class}.to raise_error NameError, /SomethingThatDoesntExist/ end end @@ -580,7 +580,7 @@ module Draper it "passes blocks to delegated methods" do object = Model.new - object.stub(:hello_world).and_return{|*args, &block| block.call} + object.stub(:hello_world) { |*args, &block| block.call } decorator = Decorator.new(object) expect(decorator.hello_world{:yielded}).to be :yielded diff --git a/spec/draper/helper_proxy_spec.rb b/spec/draper/helper_proxy_spec.rb index c549296..a2b184e 100644 --- a/spec/draper/helper_proxy_spec.rb +++ b/spec/draper/helper_proxy_spec.rb @@ -18,7 +18,7 @@ module Draper view_context = double helper_proxy = HelperProxy.new(view_context) - view_context.stub(:foo).and_return{|arg| arg} + view_context.stub(:foo) { |arg| arg } expect(helper_proxy.foo(:passed)).to be :passed end @@ -26,7 +26,7 @@ module Draper view_context = double helper_proxy = HelperProxy.new(view_context) - view_context.stub(:foo).and_return{|&block| block.call} + view_context.stub(:foo) { |&block| block.call } expect(helper_proxy.foo{:yielded}).to be :yielded end @@ -52,7 +52,7 @@ module Draper view_context = double helper_proxy = HelperProxy.new(view_context) - view_context.stub(:capture).and_return{|*args, &block| [*args, block.call] } + view_context.stub(:capture) { |*args, &block| [*args, block.call] } expect(helper_proxy.capture(:first_arg, :second_arg){:yielded}).to \ be_eql [:first_arg, :second_arg, :yielded] end diff --git a/spec/draper/lazy_helpers_spec.rb b/spec/draper/lazy_helpers_spec.rb index f54ee53..e150602 100644 --- a/spec/draper/lazy_helpers_spec.rb +++ b/spec/draper/lazy_helpers_spec.rb @@ -8,12 +8,12 @@ module Draper end it "proxies methods to #helpers" do - decorator.helpers.stub(:foo).and_return{|arg| arg} + decorator.helpers.stub(:foo) { |arg| arg } expect(decorator.foo(:passed)).to be :passed end it "passes blocks" do - decorator.helpers.stub(:foo).and_return{|&block| block.call} + decorator.helpers.stub(:foo) { |&block| block.call } expect(decorator.foo{:yielded}).to be :yielded end end diff --git a/spec/draper/view_context_spec.rb b/spec/draper/view_context_spec.rb index 5ab99fc..b1f06af 100644 --- a/spec/draper/view_context_spec.rb +++ b/spec/draper/view_context_spec.rb @@ -131,7 +131,7 @@ module Draper end it "passes a block to the strategy" do - ViewContext::BuildStrategy::Fast.stub(:new).and_return{|&block| block.call} + ViewContext::BuildStrategy::Fast.stub(:new) { |&block| block.call } expect(ViewContext.test_strategy(:fast){:passed}).to be :passed end @@ -144,7 +144,7 @@ module Draper end it "passes a block to the strategy" do - ViewContext::BuildStrategy::Full.stub(:new).and_return{|&block| block.call} + ViewContext::BuildStrategy::Full.stub(:new) { |&block| block.call } expect(ViewContext.test_strategy(:full){:passed}).to be :passed end