Module: Committee::Rails::Test::Methods

Includes:
Test::Methods
Defined in:
lib/committee/rails/test/methods.rb

Instance Method Summary collapse

Instance Method Details

#committee_optionsObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/committee/rails/test/methods.rb', line 11

def committee_options
  if defined?(RSpec) && (options = RSpec.try(:configuration).try(:committee_options))
    options
  elsif !defined?(@committee_schema)
    { schema: default_schema }
  else
    # schema_url_prefix method call this but the user overrite comittee_schema, we got error
    # we can remove in comittee 3.x
    { schema: committee_schema }
  end
end

#committee_schemaObject



6
7
8
9
# File 'lib/committee/rails/test/methods.rb', line 6

def committee_schema
  # this code for 2.4.0, committee 3.x use committee_options
  @committee_schema ||= Committee::Middleware::Base.new(nil, committee_options).send(:get_schema, committee_options)
end

#default_schemaObject



23
24
25
# File 'lib/committee/rails/test/methods.rb', line 23

def default_schema
  @default_schema ||= Committee::Drivers.load_from_file(Rails.root.join('docs', 'schema', 'schema.json').to_s)
end

#request_objectObject



27
28
29
# File 'lib/committee/rails/test/methods.rb', line 27

def request_object
  request
end

#response_dataObject



31
32
33
# File 'lib/committee/rails/test/methods.rb', line 31

def response_data
  [response.status, response.headers, response.body]
end