Sha256: fdc51730561f3b9b573fe6f0de88ac3a15151920035abf21f6319bdb0b10e310
Contents?: true
Size: 1.99 KB
Versions: 18
Compression:
Stored size: 1.99 KB
Contents
# frozen_string_literal: true require "spec_helper" # users of this test should delare the `subject` variable. shared_examples "with endorsable permissions can perform actions related to endorsable" do let(:action_subject) { :endorsement } let(:resource) { create :dummy_resource, component: component } before do context[:current_settings] = double(current_settings) context[:resource] = resource end describe "endorsing" do describe "when endorsing" do let(:action_name) { :create } context "when endorsements are disabled" do let(:current_settings) do { endorsements_enabled: false, endorsements_blocked: false } end it { is_expected.to eq false } end context "when endorsements are blocked" do let(:current_settings) do { endorsements_enabled: true, endorsements_blocked: true } end it { is_expected.to eq false } end context "when user is authorized" do let(:current_settings) do { endorsements_enabled: true, endorsements_blocked: false } end it { is_expected.to eq true } end end end describe "unendorsing" do let(:action_name) { :unendorse } context "when endorsements are disabled" do let(:current_settings) do { endorsements_enabled: false, endorsements_blocked: false } end it { is_expected.to eq false } end context "when endorsements are blocked" do let(:current_settings) do { endorsements_enabled: true, endorsements_blocked: true } end it { is_expected.to eq false } end context "when user is authorized" do let(:current_settings) do { endorsements_enabled: true, endorsements_blocked: false } end it { is_expected.to eq true } end end end
Version data entries
18 entries across 18 versions & 1 rubygems