Skip to content

Instantly share code, notes, and snippets.

@duketon
Created October 7, 2014 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save duketon/b3cdc967d46a6857fdfa to your computer and use it in GitHub Desktop.
Save duketon/b3cdc967d46a6857fdfa to your computer and use it in GitHub Desktop.
require "rails_helper"
RSpec.describe "Students routes" do
describe "GET /students" do
it "routes to #index" do
expect(:get => "http://api.skillscourt.dev/v1/students").to route_to(
:format => "json", :action => "index", :controller => "api/v1/students")
end
context "with valid multiple subdomains" do
it "routes to #index" do
expect(:get => "http://api.this.is.a.test.skillscourt.dev/v1/students").to route_to(
:format => "json", :action => "index", :controller => "api/v1/students")
end
end
context "with invalid multiple subdomains" do
it "does not route to #index" do
expect(:get => "http://0098234.api.this.is.a.test.skillscourt.dev/v1/students").to_not route_to(
:format => "json", :action => "index", :controller => "api/v1/students")
end
end
end
describe "GET /students/:id" do
it "routes to #show" do
expect(:get => "http://api.skillscourt.dev/v1/students/1").to route_to(
:format => "json", :action => "show", :controller => "api/v1/students", :id => "1")
end
context "with valid multiple subdomains" do
it "routes to #show" do
expect(:get => "http://api.this.is.a.test.skillscourt.dev/v1/students/1").to route_to(
:format => "json", :action => "show", :controller => "api/v1/students", :id => "1")
end
end
context "with invalid multiple subdomains" do
it "does not route to #show" do
expect(:get => "http://0098234.api.skillscourt.dev/v1/students").to_not route_to(
:format => "json", :action => "show", :controller => "api/v1/students", :id => "1")
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment