Skip to content

Commit

Permalink
Set default host for system and request specs to CLAIMS_HOST
Browse files Browse the repository at this point in the history
  • Loading branch information
Nitemaeric committed Dec 22, 2023
1 parent 460043b commit c0449d8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
12 changes: 12 additions & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@
config.filter_rails_from_backtrace!
# arbitrary gems may also be filtered via:
# config.filter_gems_from_backtrace("gem name")

config.around(:each, type: :request) do |example|
host! ENV['CLAIMS_HOST']
example.run
host! nil
end

config.around(:each, type: :system) do |example|
Capybara.app_host = "http://#{ENV['CLAIMS_HOST']}"
example.run
Capybara.app_host = nil
end
end

Shoulda::Matchers.configure do |config|
Expand Down
20 changes: 8 additions & 12 deletions spec/requests/sessions_spec.rb
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
require "rails_helper"

RSpec.describe "Sessions", type: :request do
around do |example|
host! ENV["PLACEMENTS_HOST"]
example.run
host! nil
end

describe "POST /auth/developer/callback" do
it "returns http success" do
placements_user = create(:placements_user)
post auth_developer_callback_path,
claims_user = create(:claims_user)

post "/auth/developer/callback",
params: {
first_name: placements_user.first_name,
last_name: placements_user.last_name,
email: placements_user.email
first_name: claims_user.first_name,
last_name: claims_user.last_name,
email: claims_user.email
}

follow_redirect!

expect(response).to have_http_status(:success)
# TODO: Change render_template once redirect to service specific
# roots implemented
expect(response).to render_template("placements/pages/index")
expect(response).to render_template("claims/pages/index")
end
end
end

0 comments on commit c0449d8

Please sign in to comment.