<commit_before>module Spree
  module TestingSupport
    module AuthorizationHelpers
      module CustomAbility
        def build_ability(&block)
          block ||= proc{ |u| can :manage, :all }
          Class.new do
            include CanCan::Ability
            define_method(:initialize, block)
          end
        end
      end

      module Controller
        include CustomAbility

        def stub_authorization!(&block)
          ability_class = build_ability(&block)
          before do
            allow(controller).to receive(:current_ability).and_return{ ability_class.new(nil) }
          end
        end
      end

      module Request
        include CustomAbility

        def stub_authorization!
          ability = build_ability<commit_msg>Update authorization_helpers for rspec 3<commit_after>module Spree
  module TestingSupport
    module AuthorizationHelpers
      module CustomAbility
        def build_ability(&block)
          block ||= proc{ |u| can :manage, :all }
          Class.new do
            include CanCan::Ability
            define_method(:initialize, block)
          end
        end
      end

      module Controller
        include CustomAbility

        def stub_authorization!(&block)
          ability_class = build_ability(&block)
          before do
            allow(controller).to receive(:current_ability) { ability_class.new(nil) }
          end
        end
      end

      module Request
        include CustomAbility

        def stub_authorization!
          ability = build_ability
{'fraction_non_alphanumeric': 0.057754704737183644, 'fraction_numerical': 0.0006489292667099286, 'mean_word_length': 1.9483747609942639, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4666052', 'n_tokens_mistral': 387, 'n_tokens_neox': 375, 'n_words': 101}