diff options
Diffstat (limited to 'spec/models/notification_setting_spec.rb')
-rw-r--r-- | spec/models/notification_setting_spec.rb | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/spec/models/notification_setting_spec.rb b/spec/models/notification_setting_spec.rb index c8ab564e3bc..40bd5bd2313 100644 --- a/spec/models/notification_setting_spec.rb +++ b/spec/models/notification_setting_spec.rb @@ -1,7 +1,7 @@ -require 'rails_helper' +require "rails_helper" RSpec.describe NotificationSetting do - it_behaves_like 'having unique enum values' + it_behaves_like "having unique enum values" describe "Associations" do it { is_expected.to belong_to(:user) } @@ -9,12 +9,12 @@ RSpec.describe NotificationSetting do end describe "Validation" do - subject { described_class.new(source_id: 1, source_type: 'Project') } + subject { described_class.new(source_id: 1, source_type: "Project") } it { is_expected.to validate_presence_of(:user) } it { is_expected.to validate_presence_of(:level) } - describe 'user_id' do + describe "user_id" do before do subject.user = create(:user) end @@ -24,7 +24,7 @@ RSpec.describe NotificationSetting do context "events" do let(:user) { create(:user) } - let(:notification_setting) { described_class.new(source_id: 1, source_type: 'Project', user_id: user.id) } + let(:notification_setting) { described_class.new(source_id: 1, source_type: "Project", user_id: user.id) } before do notification_setting.level = "custom" @@ -48,7 +48,7 @@ RSpec.describe NotificationSetting do end end - describe '#for_projects' do + describe "#for_projects" do let(:user) { create(:user) } before do @@ -59,42 +59,42 @@ RSpec.describe NotificationSetting do end end - it 'excludes projects pending delete' do + it "excludes projects pending delete" do expect(user.notification_settings.for_projects).to all(have_attributes(project: an_instance_of(Project))) expect(user.notification_settings.for_projects.map(&:project)).to all(have_attributes(pending_delete: false)) end end - describe '#event_enabled?' do + describe "#event_enabled?" do before do subject.update!(user: create(:user)) end - context 'for an event with a matching column name' do - it 'returns the value of the column' do + context "for an event with a matching column name" do + it "returns the value of the column" do subject.update!(new_note: true) expect(subject.event_enabled?(:new_note)).to be(true) end - context 'when the column has a nil value' do - it 'returns false' do + context "when the column has a nil value" do + it "returns false" do expect(subject.event_enabled?(:new_note)).to be(false) end end end - context 'for an event without a matching column name' do - it 'returns false' do + context "for an event without a matching column name" do + it "returns false" do expect(subject.event_enabled?(:foo_event)).to be(false) end end end - describe '.email_events' do + describe ".email_events" do subject { described_class.email_events } - it 'returns email events' do + it "returns email events" do expect(subject).to include( :new_note, :new_issue, @@ -111,17 +111,17 @@ RSpec.describe NotificationSetting do ) end - it 'includes EXCLUDED_WATCHER_EVENTS' do + it "includes EXCLUDED_WATCHER_EVENTS" do expect(subject).to include(*described_class::EXCLUDED_WATCHER_EVENTS) end end - describe '#email_events' do + describe "#email_events" do let(:source) { build(:group) } subject { build(:notification_setting, source: source) } - it 'calls email_events' do + it "calls email_events" do expect(described_class).to receive(:email_events).with(source) subject.email_events end |