Compare commits
3 Commits
enable-goi
...
gracefully
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
848c02d88f | ||
|
|
56b66bbf67 | ||
|
|
8951667e61 |
24
app/assets/javascripts/play_previous_recordings.js
Normal file
24
app/assets/javascripts/play_previous_recordings.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
$(document).on("click", "[data-behavior=play_recording]", function() {
|
||||||
|
if ($(this).hasClass('active')){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var playback_url = $(this).attr("data-playback-url")
|
||||||
|
$("#broadcast_video").empty();
|
||||||
|
|
||||||
|
new Clappr.Player({
|
||||||
|
parentId: '#broadcast_video',
|
||||||
|
source: playback_url,
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
autoPlay: true
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".dropdown-menu").children().removeClass('active');
|
||||||
|
$(".dropdown-menu").children().children('i').remove();
|
||||||
|
$(this).siblings().removeClass('active');
|
||||||
|
$(this).siblings().children("i").remove();
|
||||||
|
$(this).addClass('active');
|
||||||
|
$(this).prepend('<i class="fa fa-check"> </i>');
|
||||||
|
});
|
||||||
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
$(document).on("click", "[data-behavior=play_recording]", function() {
|
|
||||||
if ($(this).hasClass('active')){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.warn('Play prev : ', playback_url);
|
|
||||||
|
|
||||||
var playback_url = $(this).attr("data-playback-url")
|
|
||||||
$("#broadcast_video").empty();
|
|
||||||
|
|
||||||
new Clappr.Player({
|
|
||||||
<%= "baseUrl: 'http://cdn.clappr.io/latest'," if Rails.env.test? %>
|
|
||||||
parentId: '#broadcast_video',
|
|
||||||
source: playback_url,
|
|
||||||
width: '100%',
|
|
||||||
height: '100%',
|
|
||||||
autoPlay: true
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".dropdown-menu").children().removeClass('active');
|
|
||||||
$(".dropdown-menu").children().children('i').remove();
|
|
||||||
$(this).siblings().removeClass('active');
|
|
||||||
$(this).siblings().children("i").remove();
|
|
||||||
$(this).addClass('active');
|
|
||||||
$(this).prepend('<i class="fa fa-check"> </i>');
|
|
||||||
});
|
|
||||||
@@ -60,10 +60,16 @@ class StreamNotificationsController < ApplicationController
|
|||||||
def set_broadcast
|
def set_broadcast
|
||||||
if notification_type == "video.asset.static_renditions.ready"
|
if notification_type == "video.asset.static_renditions.ready"
|
||||||
live_stream_id = notification.dig(:stream_notification, :data, :live_stream_id)
|
live_stream_id = notification.dig(:stream_notification, :data, :live_stream_id)
|
||||||
@broadcast = Broadcast.find_by!(stream_uid: live_stream_id)
|
@broadcast = Broadcast.find_by(stream_uid: live_stream_id)
|
||||||
else
|
else
|
||||||
@broadcast = Broadcast.find_by!(stream_uid: notification_object_id)
|
@broadcast = Broadcast.find_by(stream_uid: notification_object_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if @broadcast.nil?
|
||||||
|
logger.info "Ignoring broadcast from other environment. Type = #{notification_type}. Id = #{live_stream_id} / #{notification_object_id}"
|
||||||
|
head :ok
|
||||||
|
end
|
||||||
|
head :ok if @broadcast.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
def notify_users
|
def notify_users
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class AcquiredMediaReleasePolicy < ApplicationPolicy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def destroy?
|
def destroy?
|
||||||
true
|
user.manager? || user.account_manager?
|
||||||
end
|
end
|
||||||
|
|
||||||
def tag_multiple?
|
def tag_multiple?
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class AppearanceReleasePolicy < ReleasePolicy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def destroy?
|
def destroy?
|
||||||
true
|
user.manager? || user.account_manager?
|
||||||
end
|
end
|
||||||
|
|
||||||
def tag_multiple?
|
def tag_multiple?
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class LocationReleasePolicy < ReleasePolicy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def destroy?
|
def destroy?
|
||||||
true
|
user.manager? || user.account_manager?
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit_photos?
|
def edit_photos?
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class MaterialReleasePolicy < ReleasePolicy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def destroy?
|
def destroy?
|
||||||
true
|
user.manager? || user.account_manager?
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit_photos?
|
def edit_photos?
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class MedicalReleasePolicy < ReleasePolicy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def destroy?
|
def destroy?
|
||||||
true
|
user.manager? || user.account_manager?
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit_photos?
|
def edit_photos?
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class MiscReleasePolicy < ReleasePolicy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def destroy?
|
def destroy?
|
||||||
true
|
user.manager? || user.account_manager?
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit_photos?
|
def edit_photos?
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class MusicReleasePolicy < ReleasePolicy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def destroy?
|
def destroy?
|
||||||
true
|
user.manager? || user.account_manager?
|
||||||
end
|
end
|
||||||
|
|
||||||
def tag_multiple?
|
def tag_multiple?
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class TalentReleasePolicy < ReleasePolicy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def destroy?
|
def destroy?
|
||||||
true
|
user.manager? || user.account_manager?
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit_photos?
|
def edit_photos?
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
<%= link_to "Switch View", "#", class: "btn btn-light border dropdown-toggle", role: "button", id: "dropdownMenuLink", data: { toggle: "dropdown" }, aria: { haspopup: "true", expanded: "false" } %>
|
<%= link_to "Switch View", "#", class: "btn btn-light border dropdown-toggle", role: "button", id: "dropdownMenuLink", data: { toggle: "dropdown" }, aria: { haspopup: "true", expanded: "false" } %>
|
||||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
|
<div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
|
||||||
<h5 class="dropdown-header">Live Streams</h5>
|
<h5 class="dropdown-header">Live Streams</h5>
|
||||||
<%= link_to fa_icon("check", text: @broadcast.name.titleize), "#", class: "dropdown-item active" %>
|
<span class="dropdown-item active"><%= fa_icon("check", text: @broadcast.name.titleize) %></span>
|
||||||
<% @multi_view_broadcasts.each do |broadcast| %>
|
<% @multi_view_broadcasts.each do |broadcast| %>
|
||||||
<% if broadcast.id != @broadcast.id %>
|
<% if broadcast.id != @broadcast.id %>
|
||||||
<%= link_to broadcast.name.titleize, broadcast.url, class: class_string("dropdown-item", "active" => @broadcast.id == broadcast.id) %>
|
<%= link_to broadcast.name.titleize, broadcast.url, class: class_string("dropdown-item", "active" => @broadcast.id == broadcast.id) %>
|
||||||
@@ -159,4 +159,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ RSpec.describe StreamNotificationsController, type: :controller do
|
|||||||
let(:active_status) { {type: "video.live_stream.active", object: { id: "mux_stream" }} }
|
let(:active_status) { {type: "video.live_stream.active", object: { id: "mux_stream" }} }
|
||||||
let(:disconnected_status) { {type: "video.live_stream.disconnected", object: { id: "mux_stream" }} }
|
let(:disconnected_status) { {type: "video.live_stream.disconnected", object: { id: "mux_stream" }} }
|
||||||
let(:idle_status) { {type: "video.live_stream.idle", object: { id: "mux_stream" }} }
|
let(:idle_status) { {type: "video.live_stream.idle", object: { id: "mux_stream" }} }
|
||||||
|
let(:idle_status_for_unknown_broadcast) { {type: "video.live_stream.idle", object: { id: "unknown-id" }} }
|
||||||
let(:asset_ready) { {
|
let(:asset_ready) { {
|
||||||
type: "video.asset.static_renditions.ready",
|
type: "video.asset.static_renditions.ready",
|
||||||
object: { id: "asset_uid" },
|
object: { id: "asset_uid" },
|
||||||
@@ -59,6 +60,12 @@ RSpec.describe StreamNotificationsController, type: :controller do
|
|||||||
|
|
||||||
expect(BroadcastsChannel).to have_received(:stream_recording_ready)
|
expect(BroadcastsChannel).to have_received(:stream_recording_ready)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "returns OK response even for non-existing broadcast" do
|
||||||
|
post :create, params: idle_status_for_unknown_broadcast
|
||||||
|
|
||||||
|
expect(response).to be_successful
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
after do
|
after do
|
||||||
|
|||||||
@@ -54,46 +54,6 @@ feature "User managing broadcasts" do
|
|||||||
expect(page).to have_content(recording.download_file_name)
|
expect(page).to have_content(recording.download_file_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "user can go back and forth between live session and previous sessions", js: true do
|
|
||||||
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
|
|
||||||
recording = create(:broadcast_recording, broadcast: broadcast)
|
|
||||||
|
|
||||||
visit project_broadcast_path(project, broadcast)
|
|
||||||
|
|
||||||
expect(page).to have_content broadcast.name.titleize, count: 1
|
|
||||||
expect(page).to have_content recording.download_file_name, count: 0
|
|
||||||
|
|
||||||
click_on switch_view_dropdown
|
|
||||||
expect(page).to have_content broadcast.name.titleize, count: 2
|
|
||||||
expect(page).to have_content recording.download_file_name, count: 1
|
|
||||||
|
|
||||||
live_stream_nav_item = page.find(".dropdown-item", text: broadcast.name.titleize)
|
|
||||||
recording_nav_item = page.find(".dropdown-item", text: recording.download_file_name)
|
|
||||||
|
|
||||||
expect(live_stream_nav_item[:class].include?("active")).to eq true
|
|
||||||
expect(recording_nav_item[:class].include?("active")).to eq false
|
|
||||||
|
|
||||||
click_on recording.download_file_name
|
|
||||||
|
|
||||||
expect(page).to have_content broadcast.name.titleize, count: 1
|
|
||||||
expect(page).to have_content recording.download_file_name, count: 0
|
|
||||||
expect(live_stream_nav_item[:class].include?("active")).to eq false
|
|
||||||
expect(recording_nav_item[:class].include?("active")).to eq true
|
|
||||||
|
|
||||||
click_on switch_view_dropdown
|
|
||||||
click_on broadcast.name.titleize
|
|
||||||
|
|
||||||
expect(page).to have_content broadcast.name.titleize, count: 1
|
|
||||||
expect(page).to have_content recording.download_file_name, count: 0
|
|
||||||
|
|
||||||
# Page is reloaded, we need to get dropdown items again
|
|
||||||
live_stream_nav_item = page.find(".dropdown-item", text: broadcast.name.titleize, visible: :all)
|
|
||||||
recording_nav_item = page.find(".dropdown-item", text: recording.download_file_name, visible: :all)
|
|
||||||
|
|
||||||
expect(live_stream_nav_item[:class].include?("active")).to eq true
|
|
||||||
expect(recording_nav_item[:class].include?("active")).to eq false
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "form will not submit if user clicks Add files without selected files", js: true do
|
scenario "form will not submit if user clicks Add files without selected files", js: true do
|
||||||
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
|
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
|
||||||
|
|
||||||
@@ -114,9 +74,9 @@ feature "User managing broadcasts" do
|
|||||||
|
|
||||||
new_window = window_opened_by { click_link "Multi-View" }
|
new_window = window_opened_by { click_link "Multi-View" }
|
||||||
within_window new_window do
|
within_window new_window do
|
||||||
expect(page).to have_content switch_view_dropdown
|
expect(page).to have_content("Switch View")
|
||||||
|
|
||||||
click_on switch_view_dropdown
|
click_on "Switch View"
|
||||||
expect(page).to have_link("Broadcast 1")
|
expect(page).to have_link("Broadcast 1")
|
||||||
expect(page).to have_link("Broadcast 2")
|
expect(page).to have_link("Broadcast 2")
|
||||||
|
|
||||||
@@ -146,8 +106,4 @@ feature "User managing broadcasts" do
|
|||||||
all('input[type="checkbox"]')[0].click
|
all('input[type="checkbox"]')[0].click
|
||||||
all('input[type="checkbox"]')[1].click
|
all('input[type="checkbox"]')[1].click
|
||||||
end
|
end
|
||||||
|
|
||||||
def switch_view_dropdown
|
|
||||||
"Switch View"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
require "rails_helper"
|
require "rails_helper"
|
||||||
|
|
||||||
describe AcquiredMediaReleasePolicy do
|
describe AcquiredMediaReleasePolicy do
|
||||||
let(:user_context) { build(:user_context) }
|
let(:user) { create(:user, :manager) }
|
||||||
|
let(:user_context) { build(:user_context, user: user, account: user.primary_account) }
|
||||||
|
|
||||||
subject { described_class }
|
subject { described_class }
|
||||||
|
|
||||||
@@ -24,6 +25,14 @@ describe AcquiredMediaReleasePolicy do
|
|||||||
end
|
end
|
||||||
|
|
||||||
permissions :destroy? do
|
permissions :destroy? do
|
||||||
it { is_expected.to permit(:destroy) }
|
it { is_expected.to permit(user_context, :destroy) }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "for an associate" do
|
||||||
|
let(:user) { create(:user, :associate) }
|
||||||
|
|
||||||
|
permissions :destroy? do
|
||||||
|
it { is_expected.not_to permit(user_context, :destroy) }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
require "rails_helper"
|
require "rails_helper"
|
||||||
|
|
||||||
describe AppearanceReleasePolicy do
|
describe AppearanceReleasePolicy do
|
||||||
let(:user_context) { build(:user_context) }
|
let(:user) { create(:user, :manager) }
|
||||||
|
let(:user_context) { build(:user_context, user: user, account: user.primary_account) }
|
||||||
|
|
||||||
subject { described_class }
|
subject { described_class }
|
||||||
|
|
||||||
@@ -24,6 +25,14 @@ describe AppearanceReleasePolicy do
|
|||||||
end
|
end
|
||||||
|
|
||||||
permissions :destroy? do
|
permissions :destroy? do
|
||||||
it { is_expected.to permit(:destroy) }
|
it { is_expected.to permit(user_context, :destroy) }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "for an associate" do
|
||||||
|
let(:user) { create(:user, :associate) }
|
||||||
|
|
||||||
|
permissions :destroy? do
|
||||||
|
it { is_expected.not_to permit(user_context, :destroy) }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
require "rails_helper"
|
require "rails_helper"
|
||||||
|
|
||||||
describe LocationReleasePolicy do
|
describe LocationReleasePolicy do
|
||||||
let(:user_context) { build(:user_context) }
|
let(:user) { create(:user, :manager) }
|
||||||
|
let(:user_context) { build(:user_context, user: user, account: user.primary_account) }
|
||||||
|
|
||||||
subject { described_class }
|
subject { described_class }
|
||||||
|
|
||||||
@@ -23,10 +24,6 @@ describe LocationReleasePolicy do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
permissions :destroy? do
|
|
||||||
it { is_expected.to permit(:destroy) }
|
|
||||||
end
|
|
||||||
|
|
||||||
permissions :edit_photos? do
|
permissions :edit_photos? do
|
||||||
it { is_expected.to permit(:edit_photos) }
|
it { is_expected.to permit(:edit_photos) }
|
||||||
end
|
end
|
||||||
@@ -34,4 +31,16 @@ describe LocationReleasePolicy do
|
|||||||
permissions :update_photos? do
|
permissions :update_photos? do
|
||||||
it { is_expected.to permit(:update_photos) }
|
it { is_expected.to permit(:update_photos) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
permissions :destroy? do
|
||||||
|
it { is_expected.to permit(user_context, :destroy) }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "for an associate" do
|
||||||
|
let(:user) { create(:user, :associate) }
|
||||||
|
|
||||||
|
permissions :destroy? do
|
||||||
|
it { is_expected.not_to permit(user_context, :destroy) }
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
require "rails_helper"
|
require "rails_helper"
|
||||||
|
|
||||||
describe MaterialReleasePolicy do
|
describe MaterialReleasePolicy do
|
||||||
let(:user_context) { build(:user_context) }
|
let(:user) { create(:user, :manager) }
|
||||||
|
let(:user_context) { build(:user_context, user: user, account: user.primary_account) }
|
||||||
|
|
||||||
subject { described_class }
|
subject { described_class }
|
||||||
|
|
||||||
@@ -23,10 +24,6 @@ describe MaterialReleasePolicy do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
permissions :destroy? do
|
|
||||||
it { is_expected.to permit(:destroy) }
|
|
||||||
end
|
|
||||||
|
|
||||||
permissions :edit_photos? do
|
permissions :edit_photos? do
|
||||||
it { is_expected.to permit(:edit_photos) }
|
it { is_expected.to permit(:edit_photos) }
|
||||||
end
|
end
|
||||||
@@ -34,4 +31,16 @@ describe MaterialReleasePolicy do
|
|||||||
permissions :update_photos? do
|
permissions :update_photos? do
|
||||||
it { is_expected.to permit(:update_photos) }
|
it { is_expected.to permit(:update_photos) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
permissions :destroy? do
|
||||||
|
it { is_expected.to permit(user_context, :destroy) }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "for an associate" do
|
||||||
|
let(:user) { create(:user, :associate) }
|
||||||
|
|
||||||
|
permissions :destroy? do
|
||||||
|
it { is_expected.not_to permit(user_context, :destroy) }
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
require "rails_helper"
|
require "rails_helper"
|
||||||
|
|
||||||
describe MedicalReleasePolicy do
|
describe MedicalReleasePolicy do
|
||||||
let(:user_context) { build(:user_context) }
|
let(:user) { create(:user, :manager) }
|
||||||
|
let(:user_context) { build(:user_context, user: user, account: user.primary_account) }
|
||||||
|
|
||||||
subject { described_class }
|
subject { described_class }
|
||||||
|
|
||||||
@@ -23,10 +24,6 @@ describe MedicalReleasePolicy do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
permissions :destroy? do
|
|
||||||
it { is_expected.to permit(:destroy) }
|
|
||||||
end
|
|
||||||
|
|
||||||
permissions :edit_photos? do
|
permissions :edit_photos? do
|
||||||
it { is_expected.to permit(:edit_photos) }
|
it { is_expected.to permit(:edit_photos) }
|
||||||
end
|
end
|
||||||
@@ -34,4 +31,16 @@ describe MedicalReleasePolicy do
|
|||||||
permissions :update_photos? do
|
permissions :update_photos? do
|
||||||
it { is_expected.to permit(:update_photos) }
|
it { is_expected.to permit(:update_photos) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
permissions :destroy? do
|
||||||
|
it { is_expected.to permit(user_context, :destroy) }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "for an associate" do
|
||||||
|
let(:user) { create(:user, :associate) }
|
||||||
|
|
||||||
|
permissions :destroy? do
|
||||||
|
it { is_expected.not_to permit(user_context, :destroy) }
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
require "rails_helper"
|
require "rails_helper"
|
||||||
|
|
||||||
describe MiscReleasePolicy do
|
describe MiscReleasePolicy do
|
||||||
let(:user_context) { build(:user_context) }
|
let(:user) { create(:user, :manager) }
|
||||||
|
let(:user_context) { build(:user_context, user: user, account: user.primary_account) }
|
||||||
|
|
||||||
subject { described_class }
|
subject { described_class }
|
||||||
|
|
||||||
@@ -19,10 +20,6 @@ describe MiscReleasePolicy do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
permissions :destroy? do
|
|
||||||
it { is_expected.to permit(:destroy) }
|
|
||||||
end
|
|
||||||
|
|
||||||
permissions :edit_photos? do
|
permissions :edit_photos? do
|
||||||
it { is_expected.to permit(:edit_photos) }
|
it { is_expected.to permit(:edit_photos) }
|
||||||
end
|
end
|
||||||
@@ -30,4 +27,16 @@ describe MiscReleasePolicy do
|
|||||||
permissions :update_photos? do
|
permissions :update_photos? do
|
||||||
it { is_expected.to permit(:update_photos) }
|
it { is_expected.to permit(:update_photos) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
permissions :destroy? do
|
||||||
|
it { is_expected.to permit(user_context, :destroy) }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "for an associate" do
|
||||||
|
let(:user) { create(:user, :associate) }
|
||||||
|
|
||||||
|
permissions :destroy? do
|
||||||
|
it { is_expected.not_to permit(user_context, :destroy) }
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
require "rails_helper"
|
require "rails_helper"
|
||||||
|
|
||||||
RSpec.describe MusicReleasePolicy do
|
RSpec.describe MusicReleasePolicy do
|
||||||
let(:user_context) { build(:user_context) }
|
let(:user) { create(:user, :manager) }
|
||||||
|
let(:user_context) { build(:user_context, user: user, account: user.primary_account) }
|
||||||
|
|
||||||
subject { described_class }
|
subject { described_class }
|
||||||
|
|
||||||
@@ -18,6 +19,14 @@ RSpec.describe MusicReleasePolicy do
|
|||||||
end
|
end
|
||||||
|
|
||||||
permissions :destroy? do
|
permissions :destroy? do
|
||||||
it { is_expected.to permit(:destroy) }
|
it { is_expected.to permit(user_context, :destroy) }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "for an associate" do
|
||||||
|
let(:user) { create(:user, :associate) }
|
||||||
|
|
||||||
|
permissions :destroy? do
|
||||||
|
it { is_expected.not_to permit(user_context, :destroy) }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
require "rails_helper"
|
require "rails_helper"
|
||||||
|
|
||||||
describe TalentReleasePolicy do
|
describe TalentReleasePolicy do
|
||||||
let(:user_context) { build(:user_context) }
|
let(:user) { create(:user, :manager) }
|
||||||
|
let(:user_context) { build(:user_context, user: user, account: user.primary_account) }
|
||||||
|
|
||||||
subject { described_class }
|
subject { described_class }
|
||||||
|
|
||||||
@@ -23,10 +24,6 @@ describe TalentReleasePolicy do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
permissions :destroy? do
|
|
||||||
it { is_expected.to permit(:destroy) }
|
|
||||||
end
|
|
||||||
|
|
||||||
permissions :edit_photos? do
|
permissions :edit_photos? do
|
||||||
it { is_expected.to permit(:edit_photos) }
|
it { is_expected.to permit(:edit_photos) }
|
||||||
end
|
end
|
||||||
@@ -34,4 +31,16 @@ describe TalentReleasePolicy do
|
|||||||
permissions :update_photos? do
|
permissions :update_photos? do
|
||||||
it { is_expected.to permit(:update_photos) }
|
it { is_expected.to permit(:update_photos) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
permissions :destroy? do
|
||||||
|
it { is_expected.to permit(user_context, :destroy) }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "for an associate" do
|
||||||
|
let(:user) { create(:user, :associate) }
|
||||||
|
|
||||||
|
permissions :destroy? do
|
||||||
|
it { is_expected.not_to permit(user_context, :destroy) }
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user