From 265a49c7d386c69c3196083b350f0e139c8e71b1 Mon Sep 17 00:00:00 2001 From: braidn Date: Tue, 24 Mar 2015 09:28:41 -0400 Subject: [PATCH] Remove Extra Methods From Controller Filter Methods used in previous WIP to test the callbacks. The set_current_order isn't emanating from this controller. If the include is removed, the set_current_order method still appears in the list of callbacks. --- lib/spree/chimpy/controller_filters.rb | 10 ++-------- spec/controllers/controller_filters_spec.rb | 7 ------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/lib/spree/chimpy/controller_filters.rb b/lib/spree/chimpy/controller_filters.rb index 96928d7..dd84d09 100644 --- a/lib/spree/chimpy/controller_filters.rb +++ b/lib/spree/chimpy/controller_filters.rb @@ -3,11 +3,9 @@ module ControllerFilters extend ActiveSupport::Concern included do - include ::Spree::Core::ControllerHelpers::Order - before_filter :set_mailchimp_params before_filter :find_mail_chimp_params, if: :mailchimp_params? - # before_filter :no_current_order, unless: :mailchimp_params? + include ::Spree::Core::ControllerHelpers::Order end private @@ -24,12 +22,8 @@ def mailchimp_params? (!session[:order_id].nil? || !params[:record_mc_details].nil?) end - # def no_current_order - # send(:remove_method, :set_current_order) - # end - def find_mail_chimp_params - attributes = {campaign_id: mc_cid, email_id: mc_eid} + attributes = { campaign_id: mc_cid, email_id: mc_eid } if current_order(create_order_if_necessary: true).source current_order.source.update_attributes(attributes) else diff --git a/spec/controllers/controller_filters_spec.rb b/spec/controllers/controller_filters_spec.rb index 1d71715..40961b1 100644 --- a/spec/controllers/controller_filters_spec.rb +++ b/spec/controllers/controller_filters_spec.rb @@ -34,11 +34,4 @@ def index get :index end - - it 'skips the set_current_order filter if not needed' do - filter_list = subject._process_action_callbacks.map(&:filter) - expect(filter_list).to_not include(:set_curent_order) - - get :index - end end