Sha256: 8e77b0cf82a9419b1fa07f474be7694e90dbb0056fa3b3072f21735a9d303a7f

Contents?: true

Size: 953 Bytes

Versions: 17

Compression:

Stored size: 953 Bytes

Contents

# frozen_string_literal: true

module ConvenientService
  module RSpec
    module Matchers
      module Custom
        ##
        # TODO: Specs.
        #
        class HaveAttrAccessor
          def initialize(attr_name)
            @attr_name = attr_name
          end

          def matches?(object)
            @object = object

            Custom::HaveAttrReader.new(attr_name).matches?(object)
            Custom::HaveAttrWriter.new(attr_name).matches?(object)

            true
          end

          def description
            "have attr accessor `#{attr_name}`"
          end

          def failure_message
            "expected `#{object.class}` to have attr accessor `#{attr_name}`"
          end

          def failure_message_when_negated
            "expected `#{object.class}` NOT to have attr accessor `#{attr_name}`"
          end

          private

          attr_reader :object, :attr_name
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
convenient_service-0.14.0 lib/convenient_service/rspec/matchers/custom/have_attr_accessor.rb
convenient_service-0.13.0 lib/convenient_service/rspec/matchers/custom/have_attr_accessor.rb
convenient_service-0.12.0 lib/convenient_service/rspec/matchers/custom/have_attr_accessor.rb
convenient_service-0.11.0 lib/convenient_service/rspec/matchers/custom/have_attr_accessor.rb
convenient_service-0.10.1 lib/convenient_service/rspec/matchers/custom/have_attr_accessor.rb
convenient_service-0.10.0 lib/convenient_service/rspec/matchers/custom/have_attr_accessor.rb
convenient_service-0.9.0 lib/convenient_service/rspec/matchers/custom/have_attr_accessor.rb
convenient_service-0.8.0 lib/convenient_service/rspec/matchers/custom/have_attr_accessor.rb
convenient_service-0.7.0 lib/convenient_service/rspec/matchers/custom/have_attr_accessor.rb
convenient_service-0.6.0 lib/convenient_service/rspec/matchers/custom/have_attr_accessor.rb
convenient_service-0.5.0 lib/convenient_service/rspec/matchers/custom/have_attr_accessor.rb
convenient_service-0.4.0 lib/convenient_service/rspec/matchers/custom/have_attr_accessor.rb
convenient_service-0.3.1 lib/convenient_service/rspec/matchers/custom/have_attr_accessor.rb
convenient_service-0.3.0 lib/convenient_service/rspec/matchers/custom/have_attr_accessor.rb
convenient_service-0.2.1 lib/convenient_service/rspec/matchers/custom/have_attr_accessor.rb
convenient_service-0.2.0 lib/convenient_service/rspec/matchers/custom/have_attr_accessor.rb
convenient_service-0.1.0 lib/convenient_service/rspec/matchers/custom/have_attr_accessor.rb