Class: GraphqlRails::RSpecControllerHelpers::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql_rails/rspec_controller_helpers.rb

Overview

contains all details about testing response. Similar as in rspec controllers tests

Instance Method Summary collapse

Constructor Details

#initialize(request) ⇒ Response

Returns a new instance of Response.



25
26
27
# File 'lib/graphql_rails/rspec_controller_helpers.rb', line 25

def initialize(request)
  @request = request
end

Instance Method Details

#action_nameObject



53
54
55
# File 'lib/graphql_rails/rspec_controller_helpers.rb', line 53

def action_name
  request.action_name
end

#controllerObject



49
50
51
# File 'lib/graphql_rails/rspec_controller_helpers.rb', line 49

def controller
  request.controller
end

#errorsObject



33
34
35
# File 'lib/graphql_rails/rspec_controller_helpers.rb', line 33

def errors
  request.errors
end

#failure?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/graphql_rails/rspec_controller_helpers.rb', line 45

def failure?
  !success?
end

#resultObject



29
30
31
# File 'lib/graphql_rails/rspec_controller_helpers.rb', line 29

def result
  request.object_to_return
end

#success?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/graphql_rails/rspec_controller_helpers.rb', line 37

def success?
  request.errors.empty?
end

#successful?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/graphql_rails/rspec_controller_helpers.rb', line 41

def successful?
  success?
end