Skip to content
This repository has been archived by the owner on Apr 17, 2020. It is now read-only.

Commit

Permalink
Remove Extra Methods From Controller Filter
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
braidn committed Mar 24, 2015
1 parent 9d9b8b4 commit 265a49c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
10 changes: 2 additions & 8 deletions lib/spree/chimpy/controller_filters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
7 changes: 0 additions & 7 deletions spec/controllers/controller_filters_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 265a49c

Please sign in to comment.