File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -152,3 +152,27 @@ Feature: request spec
152152 """
153153 When I run `rspec spec`
154154 Then the example should pass
155+
156+ Scenario : testing subdomain constrained requests
157+ Given a file named "spec/requests/widgets_spec.rb" with:
158+ """ruby
159+ require "rails_helper"
160+
161+ Rails.application.routes.draw do
162+ resources :widgets, constraints: { subdomain: "api" }
163+ end
164+
165+ RSpec.describe "Widget management", :type => :request do
166+ before { host! "api.example.com" }
167+
168+ it "creates a Widget" do
169+ headers = { "ACCEPT" => "application/json" }
170+ post "/widgets", :params => { :widget => { :name => "My Widget" } }, :headers => headers
171+
172+ expect(response.content_type).to start_with("application/json")
173+ expect(response).to have_http_status(:created)
174+ end
175+ end
176+ """
177+ When I run `rspec spec`
178+ Then the example should pass
You can’t perform that action at this time.
0 commit comments