Code Monkey home page Code Monkey logo

Comments (3)

oestrich avatar oestrich commented on June 18, 2024

Could you give an example of how you're currently using it, then how you would like to to be? I'm not sure I entirely understand.

from rspec_api_documentation.

kevinthompson avatar kevinthompson commented on June 18, 2024

In the example block below, in my get method call, I have to define the full url and I believe that's because my application has a few subdomain constraints. Without the full host specified, the specs fail.

require 'spec_helper'
require 'rspec_api_documentation/dsl'

resource 'Albums' do
  parameter :auth_token, 'Authentication token'

  let(:user){ create(:user) }
  let(:photo){ create(:photo, user: user) }
  let(:auth_token){ user.authentication_token }

  get 'https://app.example.com/api/v1/albums.json' do

    before do
      create(:album, user: user)
    end

    example_request 'List Albums' do
      status.should == 200
      response_json = JSON.parse(response_body)
      response_json['errors'].should be_empty
      albums = response_json['data']
      albums.any?{ |album| album['name'] == 'Example Album' }.should be_true
    end
  end
end

from rspec_api_documentation.

oestrich avatar oestrich commented on June 18, 2024

I'm not entirely sure how to get around this. I think we have to mess with the env["HOST"] which we can't get to from the DSL level and is client specific (rack, oauth). Issue #50 seems to be pretty similar. We can possibly add a new DSL to make the client change the host properly. Seems like it might be a good way around this.

from rspec_api_documentation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.