Sha256: 4868fd813f95c03abafcfee991387b8d1f2ab59336344a29cb0815bb0d2abd5e

Contents?: true

Size: 1.02 KB

Versions: 6

Compression:

Stored size: 1.02 KB

Contents

module Rspectacular
  module Matchers
    module Authentication
      def it_should_require_authentication_for(*actions)
        actions.each do |action_parts|
          method, action, params = action_parts

          params ||= {}
          params.reverse_merge! :id => 1

          it "#{method.upcase} ##{action} should require login" do
            send(method, action, params)

            response.should redirect_to(new_user_session_path)
          end
        end
      end

      def it_should_not_require_authentication_for(*actions)
        actions.each do |action_parts|
          method, action, params = action_parts

          params ||= {}
          params.reverse_merge! :id => 1

          it "#{method.upcase} ##{action} should not require login" do
            send(method, action, params)

            response.should_not redirect_to(new_user_session_path)
          end
        end
      end
    end
  end
end

RSpec.configure do |config|
  config.extend Rspectacular::Matchers::Authentication, :type => :controller
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rspectacular-0.59.0 lib/rspectacular/matchers/authentication.rb
rspectacular-0.58.0 lib/rspectacular/matchers/authentication.rb
rspectacular-0.57.0 lib/rspectacular/matchers/authentication.rb
rspectacular-0.56.0 lib/rspectacular/matchers/authentication.rb
rspectacular-0.55.0 lib/rspectacular/matchers/authentication.rb
rspectacular-0.54.0 lib/rspectacular/matchers/authentication.rb