Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated callbacks for rails 5 #43

Merged
merged 1 commit into from
May 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/mandrill-rails/web_hook_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ module Mandrill::Rails::WebHookProcessor
extend ActiveSupport::Concern

included do
skip_before_filter :verify_authenticity_token
before_filter :authenticate_mandrill_request!, :only => [:create]
skip_before_action :verify_authenticity_token, raise: false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whats raise: false for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

before_action :authenticate_mandrill_request!, :only => [:create]
end

module ClassMethods
Expand Down
18 changes: 9 additions & 9 deletions spec/mandrill-rails/web_hook_processor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
class WebHookProcessorTestHarness
# Mock some controller behaviour
# TODO: we should probably start using a real controller harness for testing
def self.skip_before_filter(*args) ; @skip_before_filter_settings = args; end
def self.skip_before_filter_settings ; @skip_before_filter_settings; end
def self.before_filter(*args) ; @before_filter_settings = args ; end
def self.before_filter_settings ; @before_filter_settings; end
def self.skip_before_action(*args) ; @skip_before_filter_settings = args; end
def self.skip_before_action_settings ; @skip_before_filter_settings; end
def self.before_action(*args) ; @before_filter_settings = args ; end
def self.before_action_settings ; @before_filter_settings; end
def head(*args) ; end
attr_accessor :params, :request

Expand All @@ -22,15 +22,15 @@ def head(*args) ; end
processor_class.on_unhandled_mandrill_events! nil
end

describe "##skip_before_filter settings" do
subject { processor_class.skip_before_filter_settings }
describe "##skip_before_action settings" do
subject { processor_class.skip_before_action_settings }
it "includes verify_authenticity_token" do
expect(subject).to eql([:verify_authenticity_token])
end
end

describe "##before_filter settings" do
subject { processor_class.before_filter_settings }
describe "##before_action settings" do
subject { processor_class.before_action_settings }
it "includes authenticate_mandrill_request" do
expect(subject).to eql([:authenticate_mandrill_request!, {:only=>[:create]}])
end
Expand Down Expand Up @@ -169,4 +169,4 @@ def head(*args) ; end
end
end

end
end