Sha256: f5475a07f291088b5261e3507c25ef8d8359e48d9d486febc1998c234c5570e5

Contents?: true

Size: 597 Bytes

Versions: 11

Compression:

Stored size: 597 Bytes

Contents

# @private
module Evil::Client::RSpec
  #
  # Checks whether an operation schema matches klass and name
  #
  # @example
  #   expect(schema).to evil_client_schema_matching(MyClient, /users/)
  #
  ::RSpec::Matchers.define :evil_client_schema_matching do |klass, name = nil|
    match do |schema|
      expect(schema).to be_instance_of(Evil::Client::Schema::Operation)
      expect(schema.client.ancestors).to include(klass)

      case name
      when NilClass then true
      when Regexp   then schema.to_s[name]
      else          schema.to_s == "#{klass}.#{name}"
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
evil-client-3.2.0 lib/evil/client/rspec/evil_client_schema_matching.rb
evil-client-3.1.0 lib/evil/client/rspec/evil_client_schema_matching.rb
evil-client-3.0.4 lib/evil/client/rspec/evil_client_schema_matching.rb
evil-client-3.0.3 lib/evil/client/rspec/evil_client_schema_matching.rb
evil-client-3.0.2 lib/evil/client/rspec/evil_client_schema_matching.rb
evil-client-3.0.1 lib/evil/client/rspec/evil_client_schema_matching.rb
evil-client-3.0.0 lib/evil/client/rspec/evil_client_schema_matching.rb
evil-client-2.1.1 lib/evil/client/rspec/evil_client_schema_matching.rb
evil-client-2.1.0 lib/evil/client/rspec/evil_client_schema_matching.rb
evil-client-2.0.0 lib/evil/client/rspec/evil_client_schema_matching.rb
evil-client-1.1.0 lib/evil/client/rspec/evil_client_schema_matching.rb