File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change 3
3
RSpec . describe Preview ::PreviewController , type : :request do
4
4
describe 'GET /preview' do
5
5
context 'with the preview environment enabled' do
6
- it 'shows a test UI in when SERVE_TEST_UI is true' do
6
+ before do
7
7
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
8
11
get preview_path
9
12
expect ( response ) . to have_http_status ( :ok )
10
13
expect ( response . content_type ) . to start_with ( 'text/html' )
11
14
end
12
15
13
16
context 'sets the API URL correctly' do
14
17
it 'sets the url for staging API in production' do
15
- allow ( ENV ) . to receive ( :[] ) . with ( 'SERVE_TEST_UI' ) . and_return ( true )
16
18
allow ( Rails . env ) . to receive ( :production? ) . and_return ( true )
17
19
get preview_path
18
20
expect ( assigns ( :api_url ) ) . to eq ( 'https://galc-api.ucblib.org' )
19
21
end
20
22
21
23
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 )
23
24
allow ( Rails . env ) . to receive ( :production? ) . and_return ( false )
24
25
get preview_path
25
26
expect ( assigns ( :api_url ) ) . to eq ( 'http://localhost:3000' )
Original file line number Diff line number Diff line change 1
1
require 'rails_helper'
2
2
3
- RSpec . describe 'preview/preview# index' , type : :view do
3
+ RSpec . describe 'preview/preview/ index' , type : :view do
4
4
let ( :endpoint ) { 'https://galc.oski.cat' }
5
5
6
6
it 'sets the API endpoint' do
You can’t perform that action at this time.
0 commit comments