diff options
| author | Xinhui | 2016-10-10 12:35:15 +0200 | 
|---|---|---|
| committer | Xinhui | 2016-10-10 12:35:15 +0200 | 
| commit | ab695004ec171a5730bf0cd0431084c76986742e (patch) | |
| tree | 493dbb349eda8a912579e3e35ee91a4f4c04541d /spec/support | |
| parent | 1cd01cc22e45710adf2efa080662d919daaaeed3 (diff) | |
| download | chouette-core-ab695004ec171a5730bf0cd0431084c76986742e.tar.bz2 | |
Fix views spec pundit
Diffstat (limited to 'spec/support')
| -rw-r--r-- | spec/support/pundit_view_policy.rb | 20 | 
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/support/pundit_view_policy.rb b/spec/support/pundit_view_policy.rb new file mode 100644 index 000000000..2945b9aac --- /dev/null +++ b/spec/support/pundit_view_policy.rb @@ -0,0 +1,20 @@ +module PunditViewPolicy +  extend ActiveSupport::Concern + +  included do +    before do +      controller.singleton_class.class_eval do +        def policy(instance) +          Class.new do +            def method_missing(*args, &block); true; end +          end.new +        end +        helper_method :policy +      end +    end +  end +end + +RSpec.configure do |config| +  config.include PunditViewPolicy, type: :view +end  | 
