Skip to content

Commit

Permalink
Add spec for subdir mounting
Browse files Browse the repository at this point in the history
  • Loading branch information
jc00ke committed Nov 11, 2014
1 parent 2bdbc09 commit 9bd497e
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions spec/config_spec.rb
@@ -0,0 +1,32 @@
require "spec_helper"

describe "Rack config" do
include Rack::Test::Methods
let(:app) {
Rack::Builder.parse_file('config.ru').first
}
describe "when RAILS_RELATIVE_URL_ROOT is absent" do
it "mounts the app to '/'" do
get '/'
expect(last_response).to be_ok
end
end

describe "when RAILS_RELATIVE_URL_ROOT is present" do
let(:new_root) { "/foobar" }

before do
@root = ENV["RAILS_RELATIVE_URL_ROOT"]
ENV["RAILS_RELATIVE_URL_ROOT"] = new_root
end

after do
ENV["RAILS_RELATIVE_URL_ROOT"] = @root
end

it "mounts the app to the subdirectory" do
get new_root
expect(last_response).to be_ok
end
end
end

0 comments on commit 9bd497e

Please sign in to comment.