Sha256: 98642b3dbea7e585ddc723753c5bbb447463b69342cc314a5b35a5c3e6936b3a

Contents?: true

Size: 702 Bytes

Versions: 4

Compression:

Stored size: 702 Bytes

Contents

# frozen_string_literal: true

module Clowne
  module RSpec
    module Matchers # :nodoc: all
      # `clone_associations` matcher is just an extension of `contain_exactly` matcher
      class CloneAssociations < ::RSpec::Matchers::BuiltIn::ContainExactly
        include Clowne::RSpec::Helpers

        def convert_actual_to_an_array
          @actual = plan.declarations
            .select { |key, _| key == :association }
            .map { |_, decl| decl.name }
        end
      end
    end
  end
end

RSpec.configure do |config|
  config.include(Module.new do
    def clone_associations(*expected)
      Clowne::RSpec::Matchers::CloneAssociations.new(expected)
    end
  end, type: :cloner)
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
clowne-1.5.0 lib/clowne/rspec/clone_associations.rb
clowne-1.4.0 lib/clowne/rspec/clone_associations.rb
clowne-1.3.0 lib/clowne/rspec/clone_associations.rb
clowne-1.2.0 lib/clowne/rspec/clone_associations.rb