summaryrefslogtreecommitdiff
path: root/spec/models/concerns/issuable_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/concerns/issuable_spec.rb')
-rw-r--r--spec/models/concerns/issuable_spec.rb41
1 files changed, 16 insertions, 25 deletions
diff --git a/spec/models/concerns/issuable_spec.rb b/spec/models/concerns/issuable_spec.rb
index 8842a36f40a..e553e34ab51 100644
--- a/spec/models/concerns/issuable_spec.rb
+++ b/spec/models/concerns/issuable_spec.rb
@@ -337,31 +337,6 @@ RSpec.describe Issuable do
it { expect(MergeRequest.to_ability_name).to eq("merge_request") }
end
- describe "#today?" do
- it "returns true when created today" do
- # Avoid timezone differences and just return exactly what we want
- allow(Date).to receive(:today).and_return(issue.created_at.to_date)
- expect(issue.today?).to be_truthy
- end
-
- it "returns false when not created today" do
- allow(Date).to receive(:today).and_return(Date.yesterday)
- expect(issue.today?).to be_falsey
- end
- end
-
- describe "#new?" do
- it "returns false when created 30 hours ago" do
- allow(issue).to receive(:created_at).and_return(Time.current - 30.hours)
- expect(issue.new?).to be_falsey
- end
-
- it "returns true when created 20 hours ago" do
- allow(issue).to receive(:created_at).and_return(Time.current - 20.hours)
- expect(issue.new?).to be_truthy
- end
- end
-
describe "#sort_by_attribute" do
let(:project) { create(:project) }
@@ -1055,6 +1030,22 @@ RSpec.describe Issuable do
end
end
+ describe '#supports_confidentiality?' do
+ where(:issuable_type, :supports_confidentiality) do
+ :issue | true
+ :incident | true
+ :merge_request | false
+ end
+
+ with_them do
+ let(:issuable) { build_stubbed(issuable_type) }
+
+ subject { issuable.supports_confidentiality? }
+
+ it { is_expected.to eq(supports_confidentiality) }
+ end
+ end
+
describe '#severity' do
subject { issuable.severity }