From 73ca1a0c063732939f83a1478e6f862e50572a54 Mon Sep 17 00:00:00 2001 From: Justin French Date: Fri, 7 Nov 2014 18:12:40 +1100 Subject: [PATCH] Rails 4 always has a scope, not an array --- spec/spec_helper.rb | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9c0cb99aa..e7fae97db 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -161,9 +161,8 @@ def respond_to?(sym) end end - # In Rails 3 Model.all returns an array. In Rails 4, it returns an - # association proxy, which quacks a lot like an array. We use this in stubs - # or mocks where we need to return the later. + # Model.all returns an association proxy, which quacks a lot like an array. + # We use this in stubs or mocks where we need to return the later. # # TODO try delegate? # delegate :map, :size, :length, :first, :to_ary, :each, :include?, :to => :array @@ -246,14 +245,8 @@ def author_path(*args); "/authors/1"; end def authors_path(*args); "/authors"; end def new_author_path(*args); "/authors/new"; end - # Returns the array for Rails 3 and a thing that looks looks like an - # association proxy for Rails 4+ def author_array_or_scope(the_array = [@fred, @bob]) - if ::Formtastic::Util.rails3? - the_array - else - MockScope.new(the_array) - end + MockScope.new(the_array) end @fred = ::Author.new