|
|
|
|
@ -74,7 +74,7 @@ RSpec.describe CreateLogActionsComponent, type: :component do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when has data sharing agremeent" do |
|
|
|
|
let(:user) { create(:user, :support) } |
|
|
|
|
let(:user) { create(:user) } |
|
|
|
|
|
|
|
|
|
it "renders actions" do |
|
|
|
|
expect(component.display_actions?).to eq(true) |
|
|
|
|
@ -114,6 +114,34 @@ RSpec.describe CreateLogActionsComponent, type: :component do
|
|
|
|
|
expect(component.create_button_href).to eq("/sales-logs") |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when organisation doesn't own stock" do |
|
|
|
|
before do |
|
|
|
|
user.organisation.update!(holds_own_stock: false) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "and stock owners that have signed data sharing agreement" do |
|
|
|
|
before do |
|
|
|
|
parent_organisation = create(:organisation) |
|
|
|
|
create(:organisation_relationship, child_organisation: user.organisation, parent_organisation:) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "renders actions" do |
|
|
|
|
expect(component.display_actions?).to eq(true) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "and no stock owners have signed data sharing agreement" do |
|
|
|
|
before do |
|
|
|
|
parent_organisation = create(:organisation, :without_dpc) |
|
|
|
|
create(:organisation_relationship, child_organisation: user.organisation, parent_organisation:) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "does not render actions" do |
|
|
|
|
expect(component.display_actions?).to eq(false) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|