2020-10-26 20:45:38 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later
|
|
|
|
# Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE
|
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe WidgetController, type: :controller do
|
2021-02-24 17:51:38 +00:00
|
|
|
describe 'v2' do
|
|
|
|
it 'accepts requests without a CORS error' do
|
|
|
|
expect { get :v2, format: :js }.to_not raise_error
|
|
|
|
end
|
2020-10-26 20:45:38 +00:00
|
|
|
|
2021-02-24 17:51:38 +00:00
|
|
|
it 'has a cache-control header of 10 minutes' do
|
|
|
|
get :v2, format: :js
|
|
|
|
expect(response.headers['Cache-Control']).to include 'max-age=600'
|
|
|
|
end
|
2020-10-26 20:45:38 +00:00
|
|
|
|
2021-02-24 17:51:38 +00:00
|
|
|
it 'does redirect' do
|
|
|
|
get :v2, format: :js
|
|
|
|
expect(response.headers.has_key?('Location')).to eq true
|
|
|
|
end
|
|
|
|
end
|
2020-10-26 20:45:38 +00:00
|
|
|
end
|