Sha256: 5ea63320141a381828a38750b5bcc3df98a0be409c3102506905967ecf2c9768

Contents?: true

Size: 1.13 KB

Versions: 6

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module RSpec
      module Rails
        # @!parse
        #   # Checks that tests use `have_http_status` instead of equality matchers.
        #   #
        #   # @example ResponseMethods: ['response', 'last_response'] (default)
        #   #   # bad
        #   #   expect(response.status).to be(200)
        #   #   expect(last_response.code).to eq("200")
        #   #
        #   #   # good
        #   #   expect(response).to have_http_status(200)
        #   #   expect(last_response).to have_http_status(200)
        #   #
        #   # @example ResponseMethods: ['foo_response']
        #   #   # bad
        #   #   expect(foo_response.status).to be(200)
        #   #
        #   #   # good
        #   #   expect(foo_response).to have_http_status(200)
        #   #
        #   #   # also good
        #   #   expect(response).to have_http_status(200)
        #   #   expect(last_response).to have_http_status(200)
        #   #
        #   class HaveHttpStatus < ::RuboCop::Cop::Base; end
        HaveHttpStatus = ::RuboCop::Cop::RSpecRails::HaveHttpStatus
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rubocop-rspec-2.31.0 lib/rubocop/cop/rspec/rails/have_http_status.rb
rubocop-rspec-2.30.0 lib/rubocop/cop/rspec/rails/have_http_status.rb
rubocop-rspec-2.29.2 lib/rubocop/cop/rspec/rails/have_http_status.rb
rubocop-rspec-2.29.1 lib/rubocop/cop/rspec/rails/have_http_status.rb
rubocop-rspec-2.29.0 lib/rubocop/cop/rspec/rails/have_http_status.rb
rubocop-rspec-2.28.0 lib/rubocop/cop/rspec/rails/have_http_status.rb