Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an HTTP test client #131

Merged
merged 1 commit into from
Oct 9, 2014
Merged

Add an HTTP test client #131

merged 1 commit into from
Oct 9, 2014

Conversation

lvarvel
Copy link

@lvarvel lvarvel commented May 20, 2014

This commit adds RspecApiDocumentation::HttpTestClient, which can be used to test any website, either on your local development box or out on the internet somewhere.

To use, just add the following line to the top of your spec:

let(:client) { RspecApiDocumentation::HttpTestClient.new(self, {host: 'http://yourtestsite.com/'}) }

This commit adds RspecApiDocumentation::HttpTestClient, which can be used to
test *any* website, either on your local development box or out on the
internet somewhere.

To use, just add the following line to the top of your spec:

```
let(:client) { RspecApiDocumentation::HttpTestClient.new(self, {host: 'http://base.url.of.the.site.you.want.to.test.com/'}) }
```
@lvarvel
Copy link
Author

lvarvel commented May 20, 2014

Full disclosure: There's a few outstanding nits I have with the tests (the client is fine).

  1. The output from the sinatra test app makes the tests noisy.
  2. The way the sinatra test app is being launched may not work on Windows
  3. There's a "sleep 3" to let the sinatra test app come up before running the specs

@snuggs
Copy link

snuggs commented May 21, 2014

Why the need for referencing the current Rspec ExampleGroup?

self

?

@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency "i18n", ">= 0.1.0"
s.add_runtime_dependency "mustache", ">= 0.99.4"
s.add_runtime_dependency "json", ">= 1.4.6"
s.add_runtime_dependency "faraday", ">= 0.9.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should include this similar to how webmock is required.

@oestrich
Copy link
Contributor

oestrich commented Oct 8, 2014

Any updates on this?

@oestrich oestrich merged commit c5f83ee into zipmark:master Oct 9, 2014
@oestrich
Copy link
Contributor

oestrich commented Oct 9, 2014

I merged this locally and then did some updates. Fixing my previous issue and then making it use the same StubApp as the RackTestClient.

@oestrich
Copy link
Contributor

oestrich commented Oct 9, 2014

It also uses Capybara to launch the server so we're not doing a separate process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants