Created
January 12, 2012 20:50
-
-
Save openfirmware/1603022 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When /^I send a GET request for "([^"]*)"$/ do |path| | |
get path | |
end | |
Then /^the response code should be "([^"]*)"$/ do |code| | |
last_response.status.should == code.to_i | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# features/my_dumb_api.feature | |
Feature: My Dumb API | |
In order to retrieve an API response | |
As a web API developer | |
I want an API to respond to my requests | |
Scenario: API is available | |
When I send a GET request for "http://example.com/api/" | |
Then the response code should be "200" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# routes.rb | |
RailsApp::Application.routes.draw do | |
mount proc { |env| | |
[200, {}, ["OK"]] | |
} => "/api" | |
# your other Rails routes | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment