Skip to content

NoMethodError: undefined method client #167

Closed
@einSelbst

Description

@einSelbst

Hi all,
I think I'm running out of ideas with this. I have installed rspec_api_documentation according to the docs. I'm trying to use it with rails-api.
When I add a test in "spec/acceptance/tools_spec.rb" with the following content:

require 'rails_helper'
require 'rspec_api_documentation'
require 'rspec_api_documentation/dsl'

resource "Tools", focus: :true do
  header "Content-Type", "application/json"

  let(:tool) { create(:tool) }

  get "/v1/tools/:id" do
    let(:id) { tool.id}
    example "Show tool with given ID" do
      do_request

      status.should == 200
    end
  end

I tried many variations but I always get

Failure/Error: Unable to find matching line from backtrace
     NoMethodError:
       undefined method `client' for #<RSpec::ExampleGroups::Tools_2::GETV1Tools1:0x007fcfdd69c698>

Why can't it find a "client"? I have seen the "client" mentioned in the gotchas, but I think I don't want to define my own.
I have the following in Gemfile:

source 'https://rubygems.org'

gem 'rails', '4.1.4'
gem 'rails-api'
gem 'pg'
gem 'jbuilder'
gem 'oj'
gem 'oj_mimic_json'
gem 'unicorn'
gem 'rails_12factor', group: :production

group :development do
  gem 'spring'
  gem 'debugger'
end

group :development, :test do
  gem 'spring-commands-rspec'
  gem 'rspec-rails', '~> 3.0.0'
  gem 'guard-rspec'
  gem 'rb-fsevent' if `uname` =~ /Darwin/
  gem 'rspec_api_documentation'
  gem 'apitome'
  gem 'factory_girl_rails'
  gem 'database_cleaner'
  gem 'shoulda-matchers', require: false
  gem 'faker'
end
ruby '2.1.1'

Any hints how to solve this issue would be greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions