Skip to content

Commit 02081f2

Browse files
committed
address code review changes and fix test
1 parent b1bf78e commit 02081f2

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

spec/requests/preview/preview_spec.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,24 @@
33
RSpec.describe Preview::PreviewController, type: :request do
44
describe 'GET /preview' do
55
context 'with the preview environment enabled' do
6-
it 'shows a test UI in when SERVE_TEST_UI is true' do
6+
before do
77
allow(ENV).to receive(:[]).with('SERVE_TEST_UI').and_return(true)
8+
end
9+
10+
it 'shows a test UI in when SERVE_TEST_UI is true' do
811
get preview_path
912
expect(response).to have_http_status(:ok)
1013
expect(response.content_type).to start_with('text/html')
1114
end
1215

1316
context 'sets the API URL correctly' do
1417
it 'sets the url for staging API in production' do
15-
allow(ENV).to receive(:[]).with('SERVE_TEST_UI').and_return(true)
1618
allow(Rails.env).to receive(:production?).and_return(true)
1719
get preview_path
1820
expect(assigns(:api_url)).to eq('https://galc-api.ucblib.org')
1921
end
2022

2123
it 'sets the url for API to be localhost in dev/test' do
22-
allow(ENV).to receive(:[]).with('SERVE_TEST_UI').and_return(true)
2324
allow(Rails.env).to receive(:production?).and_return(false)
2425
get preview_path
2526
expect(assigns(:api_url)).to eq('http://localhost:3000')

spec/views/preview/preview/index.html.erb_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'rails_helper'
22

3-
RSpec.describe 'preview/preview#index', type: :view do
3+
RSpec.describe 'preview/preview/index', type: :view do
44
let(:endpoint) { 'https://galc.oski.cat' }
55

66
it 'sets the API endpoint' do

0 commit comments

Comments
 (0)