Removed many more RSpec deprecations
This commit is contained in:
parent
5b7d4aff9a
commit
1fa61dc331
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue