1
0
Fork 0
mirror of https://github.com/drapergem/draper synced 2023-03-27 23:21:17 -04:00

Removed many more RSpec deprecations

This commit is contained in:
Michael Dao 2015-03-09 15:23:29 -06:00
parent 5b7d4aff9a
commit 1fa61dc331
5 changed files with 11 additions and 11 deletions

View file

@ -192,7 +192,7 @@ module Draper
context "when an unrelated NameError is thrown" do context "when an unrelated NameError is thrown" do
it "re-raises that error" 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/ expect{Product.decorator_class}.to raise_error NameError, /Draper::Base/
end end
end end

View file

@ -148,7 +148,7 @@ module Draper
context "when a NameError is thrown" do context "when a NameError is thrown" do
it "re-raises that error" 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/ expect{ProductDecorator.decorate_collection([])}.to raise_error NameError, /Draper::DecoratedEnumerableProxy/
end end
end end
@ -207,7 +207,7 @@ module Draper
context "when an unrelated NameError is thrown" do context "when an unrelated NameError is thrown" do
it "re-raises that error" 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/ expect{ProductDecorator.object_class}.to raise_error NameError, /SomethingThatDoesntExist/
end end
end end
@ -580,7 +580,7 @@ module Draper
it "passes blocks to delegated methods" do it "passes blocks to delegated methods" do
object = Model.new 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) decorator = Decorator.new(object)
expect(decorator.hello_world{:yielded}).to be :yielded expect(decorator.hello_world{:yielded}).to be :yielded

View file

@ -18,7 +18,7 @@ module Draper
view_context = double view_context = double
helper_proxy = HelperProxy.new(view_context) 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 expect(helper_proxy.foo(:passed)).to be :passed
end end
@ -26,7 +26,7 @@ module Draper
view_context = double view_context = double
helper_proxy = HelperProxy.new(view_context) 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 expect(helper_proxy.foo{:yielded}).to be :yielded
end end
@ -52,7 +52,7 @@ module Draper
view_context = double view_context = double
helper_proxy = HelperProxy.new(view_context) 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 \ expect(helper_proxy.capture(:first_arg, :second_arg){:yielded}).to \
be_eql [:first_arg, :second_arg, :yielded] be_eql [:first_arg, :second_arg, :yielded]
end end

View file

@ -8,12 +8,12 @@ module Draper
end end
it "proxies methods to #helpers" do 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 expect(decorator.foo(:passed)).to be :passed
end end
it "passes blocks" do 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 expect(decorator.foo{:yielded}).to be :yielded
end end
end end

View file

@ -131,7 +131,7 @@ module Draper
end end
it "passes a block to the strategy" do 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 expect(ViewContext.test_strategy(:fast){:passed}).to be :passed
end end
@ -144,7 +144,7 @@ module Draper
end end
it "passes a block to the strategy" do 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 expect(ViewContext.test_strategy(:full){:passed}).to be :passed
end end