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

Fix RSpec deprecations

This commit is contained in:
Andrew Haines 2013-07-14 12:40:26 +01:00
parent 8f69021a8f
commit 7c14385ee6
2 changed files with 4 additions and 6 deletions

View file

@ -133,7 +133,7 @@ module Draper
context "without a block" do
it "decorates object.find" do
object = []
found = stub(decorate: :decorated)
found = double(decorate: :decorated)
decorator = CollectionDecorator.new(object)
object.should_receive(:find).and_return(found)

View file

@ -364,7 +364,7 @@ module Draper
describe "aliasing object to object class name" do
context "when object_class is inferrable from the decorator name" do
it "aliases object to the object class name" do
object = stub
object = double
decorator = ProductDecorator.new(object)
expect(decorator.product).to be object
@ -374,7 +374,7 @@ module Draper
context "when object_class is set by decorates" do
it "aliases object to the object class name" do
decorator_class = Class.new(Decorator) { decorates Product }
object = stub
object = double
decorator = decorator_class.new(object)
expect(decorator.product).to be object
@ -385,7 +385,7 @@ module Draper
it "underscores the method name" do
stub_const "LongWindedModel", Class.new
decorator_class = Class.new(Decorator) { decorates LongWindedModel }
object = stub
object = double
decorator = decorator_class.new(object)
expect(decorator.long_winded_model).to be object
@ -678,7 +678,6 @@ module Draper
object = Class.new{def hello_world; end}.new
decorator = Decorator.new(object)
expect { decorator.method(:hello_world) }.not_to raise_error NameError
expect(decorator.method(:hello_world)).not_to be_nil
end
end
@ -687,7 +686,6 @@ module Draper
it "allows .method to be called on delegated class methods" do
Decorator.stub object_class: double(hello_world: :delegated)
expect { Decorator.method(:hello_world) }.not_to raise_error NameError
expect(Decorator.method(:hello_world)).not_to be_nil
end
end