Module: JsonapiRspec

Included in:
BeJsonApiResponse, BeJsonApiResponseFor
Defined in:
lib/jsonapi_rspec.rb,
lib/jsonapi_rspec/version.rb,
lib/jsonapi_rspec/configuration.rb

Defined Under Namespace

Classes: Configuration

Constant Summary collapse

VERSION =
'0.2.3'.freeze

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.configurationObject

Returns the value of attribute configuration.



10
11
12
# File 'lib/jsonapi_rspec.rb', line 10

def configuration
  @configuration
end

Class Method Details

.configure {|configuration| ... } ⇒ Object

Yields:



16
17
18
19
# File 'lib/jsonapi_rspec.rb', line 16

def configure
  self.configuration ||= Configuration.new
  yield(configuration)
end

.rootObject



12
13
14
# File 'lib/jsonapi_rspec.rb', line 12

def root
  Pathname.new(File.dirname(__FILE__)).parent
end

Instance Method Details

#failure_messageString

Called by RSpec when an the json:api response doesn’t match the object instance

Returns:

  • (String)

    The failure message to display in the RSpec output



26
27
28
# File 'lib/jsonapi_rspec.rb', line 26

def failure_message
  "#{@failure_message} - parsed response: #{pretty_response}"
end

#failure_message_when_negatedObject



30
31
32
33
# File 'lib/jsonapi_rspec.rb', line 30

def failure_message_when_negated
  @failure_message = "handle method 'failure_message_when_negated' in custom_matchers.rb"
  "#{@failure_message}: #{pretty_response}"
end