From 7c14385ee6a97ee4cc0bd1772fe980c6b8c20e3c Mon Sep 17 00:00:00 2001 From: Andrew Haines Date: Sun, 14 Jul 2013 12:40:26 +0100 Subject: [PATCH] Fix RSpec deprecations --- spec/draper/collection_decorator_spec.rb | 2 +- spec/draper/decorator_spec.rb | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/spec/draper/collection_decorator_spec.rb b/spec/draper/collection_decorator_spec.rb index 90419a8..173ced2 100644 --- a/spec/draper/collection_decorator_spec.rb +++ b/spec/draper/collection_decorator_spec.rb @@ -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) diff --git a/spec/draper/decorator_spec.rb b/spec/draper/decorator_spec.rb index cef15f8..047bb2b 100755 --- a/spec/draper/decorator_spec.rb +++ b/spec/draper/decorator_spec.rb @@ -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