-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5004 from avalonmediasystem/develop
More bugfixes
- Loading branch information
Showing
10 changed files
with
93 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Copyright 2011-2022, The Trustees of Indiana University and Northwestern | ||
# University. Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software distributed | ||
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
# CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations under the License. | ||
# --- END LICENSE_HEADER BLOCK --- | ||
|
||
require 'rails_helper' | ||
|
||
describe 'Login Redirects' do | ||
let(:user) { FactoryBot.create(:user, :with_identity) } | ||
|
||
describe '/media_objects/:id' do | ||
let(:media_object) { FactoryBot.create(:fully_searchable_media_object, master_files: [master_file]) } | ||
let(:master_file) { FactoryBot.create(:master_file, :with_derivative) } | ||
|
||
it 'redirects to item page' do | ||
visit media_object_path(media_object) | ||
visit hls_manifest_master_file_path(media_object.master_files.first, "high") | ||
sign_in user | ||
expect(page.current_path).to eq media_object_path(media_object) | ||
end | ||
|
||
context 'visiting item after accessing restricted page' do | ||
it 'redirects to item page' do | ||
visit playlists_path | ||
visit media_object_path(media_object) | ||
sign_in user | ||
expect(page.current_path).to eq media_object_path(media_object) | ||
end | ||
end | ||
end | ||
|
||
describe '/collection/:id' do | ||
let(:collection) { FactoryBot.create(:collection) } | ||
let(:media_object) { FactoryBot.create(:fully_searchable_media_object, collection: collection) } | ||
|
||
it 'redirects to collection page' do | ||
visit collections_path(collection, format: :html) | ||
visit poster_collection_path(collection) | ||
sign_in user | ||
expect(page.current_path).to eq collections_path(collection, format: :html) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
require File.expand_path('../features/session_helpers', __FILE__) | ||
|
||
RSpec.configure do |config| | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen_string_literal: true | ||
# Copied from Hyrax: spec/support/features/session_helpers.rb | ||
module Features | ||
module SessionHelpers | ||
def sign_in(who = :user) | ||
user = who.is_a?(User) ? who : FactoryBot.build(:user).tap(&:save!) | ||
visit '/users/sign_in' | ||
within('div.omniauth-form form') do | ||
fill_in 'Login', with: user.email | ||
fill_in 'Password', with: user.password | ||
click_on 'Connect' | ||
end | ||
end | ||
end | ||
end |