DEV: Bump rubocop-discourse and correct violations (#409)
This commit is contained in:
parent
993f7faa8d
commit
4902ba6993
2
Gemfile
2
Gemfile
|
@ -3,6 +3,6 @@
|
|||
source "https://rubygems.org"
|
||||
|
||||
group :development do
|
||||
gem "rubocop-discourse", git: "https://github.com/discourse/rubocop-discourse/", branch: "stree"
|
||||
gem "rubocop-discourse"
|
||||
gem "syntax_tree"
|
||||
end
|
||||
|
|
28
Gemfile.lock
28
Gemfile.lock
|
@ -1,37 +1,31 @@
|
|||
GIT
|
||||
remote: https://github.com/discourse/rubocop-discourse/
|
||||
revision: 8afca6460a423a11a2e0bf1f7051b18dd9a7231b
|
||||
branch: stree
|
||||
specs:
|
||||
rubocop-discourse (2.5.0)
|
||||
rubocop (>= 1.1.0)
|
||||
rubocop-rspec (>= 2.0.0)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
ast (2.4.2)
|
||||
json (2.6.2)
|
||||
json (2.6.3)
|
||||
parallel (1.22.1)
|
||||
parser (3.1.2.1)
|
||||
parser (3.1.3.0)
|
||||
ast (~> 2.4.1)
|
||||
prettier_print (0.1.0)
|
||||
rainbow (3.1.1)
|
||||
regexp_parser (2.6.0)
|
||||
regexp_parser (2.6.1)
|
||||
rexml (3.2.5)
|
||||
rubocop (1.36.0)
|
||||
rubocop (1.41.1)
|
||||
json (~> 2.3)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 3.1.2.1)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
regexp_parser (>= 1.8, < 3.0)
|
||||
rexml (>= 3.2.5, < 4.0)
|
||||
rubocop-ast (>= 1.20.1, < 2.0)
|
||||
rubocop-ast (>= 1.23.0, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 3.0)
|
||||
rubocop-ast (1.21.0)
|
||||
rubocop-ast (1.24.0)
|
||||
parser (>= 3.1.1.0)
|
||||
rubocop-rspec (2.13.2)
|
||||
rubocop-discourse (3.0.1)
|
||||
rubocop (>= 1.1.0)
|
||||
rubocop-rspec (>= 2.0.0)
|
||||
rubocop-rspec (2.16.0)
|
||||
rubocop (~> 1.33)
|
||||
ruby-progressbar (1.11.0)
|
||||
syntax_tree (3.2.1)
|
||||
|
@ -42,7 +36,7 @@ PLATFORMS
|
|||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
rubocop-discourse!
|
||||
rubocop-discourse
|
||||
syntax_tree
|
||||
|
||||
BUNDLED WITH
|
||||
|
|
|
@ -23,9 +23,9 @@ class RandomAssignUtils
|
|||
min_hours = fields.dig("minimum_time_between_assignments", "value").presence
|
||||
if min_hours &&
|
||||
TopicCustomField
|
||||
.where(name: "assigned_to_id", topic_id: topic_id)
|
||||
.where("created_at < ?", min_hours.to_i.hours.ago)
|
||||
.exists?
|
||||
.where(name: "assigned_to_id", topic_id: topic_id)
|
||||
.where("created_at < ?", min_hours.to_i.hours.ago)
|
||||
.exists?
|
||||
log_info(automation, "Topic(#{topic_id}) has already been assigned recently")
|
||||
return
|
||||
end
|
||||
|
|
|
@ -12,8 +12,8 @@ describe Search do
|
|||
SiteSetting.assign_enabled = true
|
||||
end
|
||||
|
||||
context "Advanced search" do
|
||||
include_context "A group that is allowed to assign"
|
||||
describe "Advanced search" do
|
||||
include_context "with group that is allowed to assign"
|
||||
|
||||
let(:post1) { Fabricate(:post) }
|
||||
let(:post2) { Fabricate(:post) }
|
||||
|
|
|
@ -11,7 +11,7 @@ describe TopicQuery do
|
|||
fab!(:user3) { Fabricate(:user) }
|
||||
fab!(:user4) { Fabricate(:user) }
|
||||
|
||||
include_context "A group that is allowed to assign"
|
||||
include_context "with group that is allowed to assign"
|
||||
|
||||
before do
|
||||
add_to_assign_allowed_group(user)
|
||||
|
@ -183,7 +183,7 @@ describe TopicQuery do
|
|||
end
|
||||
end
|
||||
|
||||
context "assigned filter" do
|
||||
describe "assigned filter" do
|
||||
it "filters topics assigned to a user" do
|
||||
assigned_topic = Fabricate(:post).topic
|
||||
assigned_topic2 = Fabricate(:post).topic
|
||||
|
|
|
@ -13,7 +13,7 @@ describe TopicsBulkAction do
|
|||
let(:user) { Fabricate(:user) }
|
||||
let(:user2) { Fabricate(:user) }
|
||||
|
||||
include_context "A group that is allowed to assign"
|
||||
include_context "with group that is allowed to assign"
|
||||
|
||||
before { add_to_assign_allowed_group(user) }
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ describe "integration tests" do
|
|||
let(:channel) { "/private-messages/assigned" }
|
||||
fab!(:group) { Fabricate(:group, assignable_level: Group::ALIAS_LEVELS[:everyone]) }
|
||||
|
||||
include_context "A group that is allowed to assign"
|
||||
include_context "with group that is allowed to assign"
|
||||
|
||||
before do
|
||||
add_to_assign_allowed_group(user)
|
||||
|
@ -102,7 +102,7 @@ describe "integration tests" do
|
|||
let(:user1) { Fabricate(:user) }
|
||||
let(:user2) { Fabricate(:user) }
|
||||
|
||||
include_context "A group that is allowed to assign"
|
||||
include_context "with group that is allowed to assign"
|
||||
|
||||
before do
|
||||
add_to_assign_allowed_group(user1)
|
||||
|
@ -138,13 +138,13 @@ describe "integration tests" do
|
|||
end
|
||||
end
|
||||
|
||||
context "already assigned" do
|
||||
context "when already assigned" do
|
||||
fab!(:post) { Fabricate(:post) }
|
||||
fab!(:post_2) { Fabricate(:post, topic: post.topic) }
|
||||
let(:topic) { post.topic }
|
||||
fab!(:user) { Fabricate(:user) }
|
||||
|
||||
include_context "A group that is allowed to assign"
|
||||
include_context "with group that is allowed to assign"
|
||||
|
||||
it "does not allow to assign topic if post is already assigned" do
|
||||
add_to_assign_allowed_group(user)
|
||||
|
@ -164,7 +164,7 @@ describe "integration tests" do
|
|||
end
|
||||
end
|
||||
|
||||
context "move post" do
|
||||
describe "move post" do
|
||||
fab!(:old_topic) { Fabricate(:topic) }
|
||||
fab!(:post) { Fabricate(:post, topic: old_topic) }
|
||||
fab!(:user) { Fabricate(:user) }
|
||||
|
|
|
@ -21,7 +21,7 @@ RSpec.describe Jobs::AssignNotification do
|
|||
|
||||
before { assign_allowed_group.add(user1) }
|
||||
|
||||
context "User" do
|
||||
describe "User" do
|
||||
it "sends notification alert" do
|
||||
messages =
|
||||
MessageBus.track_publish("/notification-alert/#{user2.id}") do
|
||||
|
@ -89,7 +89,7 @@ RSpec.describe Jobs::AssignNotification do
|
|||
end
|
||||
end
|
||||
|
||||
context "Group" do
|
||||
describe "Group" do
|
||||
fab!(:user3) { Fabricate(:user, last_seen_at: 1.day.ago) }
|
||||
fab!(:user4) { Fabricate(:user, suspended_till: 1.year.from_now) }
|
||||
fab!(:group) { Fabricate(:group, name: "Developers") }
|
||||
|
|
|
@ -21,7 +21,7 @@ RSpec.describe Jobs::UnassignNotification do
|
|||
expect(message.user_ids).to eq([user.id])
|
||||
end
|
||||
|
||||
context "User" do
|
||||
describe "User" do
|
||||
it "deletes notifications" do
|
||||
Jobs::AssignNotification.new.execute(
|
||||
{
|
||||
|
@ -64,7 +64,7 @@ RSpec.describe Jobs::UnassignNotification do
|
|||
end
|
||||
end
|
||||
|
||||
context "Group" do
|
||||
describe "Group" do
|
||||
fab!(:assign_allowed_group) { Group.find_by(name: "staff") }
|
||||
fab!(:user3) { Fabricate(:user) }
|
||||
fab!(:group) { Fabricate(:group) }
|
||||
|
|
|
@ -12,7 +12,7 @@ RSpec.describe Assigner do
|
|||
let(:pm_post) { Fabricate(:private_message_post) }
|
||||
let(:pm) { pm_post.topic }
|
||||
|
||||
context "assigning and unassigning" do
|
||||
describe "assigning and unassigning" do
|
||||
let(:post) { Fabricate(:post) }
|
||||
let(:topic) { post.topic }
|
||||
let(:secure_category) { Fabricate(:private_category, group: Fabricate(:group)) }
|
||||
|
@ -53,7 +53,7 @@ RSpec.describe Assigner do
|
|||
expect {
|
||||
described_class.new(topic, admin).assign(moderator_2)
|
||||
}.to change { moderator.notifications.count }.by(-1)
|
||||
.and change { moderator_2.notifications.count }.by(1)
|
||||
.and change { moderator_2.notifications.count }.by(1)
|
||||
end
|
||||
|
||||
it "can assign with note" do
|
||||
|
@ -186,7 +186,7 @@ RSpec.describe Assigner do
|
|||
assigner.assign(assignee).fetch(:success)
|
||||
end
|
||||
|
||||
context "forbidden reasons" do
|
||||
describe "forbidden reasons" do
|
||||
it "doesn't assign if the topic has more than 5 assignments" do
|
||||
other_post = nil
|
||||
|
||||
|
@ -487,7 +487,7 @@ RSpec.describe Assigner do
|
|||
end
|
||||
end
|
||||
|
||||
context "assign_self_regex" do
|
||||
describe "assign_self_regex" do
|
||||
fab!(:me) { Fabricate(:admin) }
|
||||
fab!(:op) { Fabricate(:post) }
|
||||
fab!(:reply) do
|
||||
|
@ -528,7 +528,7 @@ RSpec.describe Assigner do
|
|||
end
|
||||
end
|
||||
|
||||
context "assign_other_regex" do
|
||||
describe "assign_other_regex" do
|
||||
fab!(:me) { Fabricate(:admin) }
|
||||
fab!(:other) { Fabricate(:admin) }
|
||||
fab!(:op) { Fabricate(:post) }
|
||||
|
@ -553,12 +553,12 @@ RSpec.describe Assigner do
|
|||
end
|
||||
end
|
||||
|
||||
context "unassign_on_close" do
|
||||
describe "unassign_on_close" do
|
||||
let(:post) { Fabricate(:post) }
|
||||
let(:topic) { post.topic }
|
||||
let(:moderator) { Fabricate(:moderator) }
|
||||
|
||||
context "topic" do
|
||||
context "with topic" do
|
||||
let(:assigner) { described_class.new(topic, moderator) }
|
||||
|
||||
before do
|
||||
|
@ -595,7 +595,7 @@ RSpec.describe Assigner do
|
|||
end
|
||||
end
|
||||
|
||||
context "post" do
|
||||
context "with post" do
|
||||
let(:post_2) { Fabricate(:post, topic: topic) }
|
||||
let(:assigner) { described_class.new(post_2, moderator) }
|
||||
let(:post_3) { Fabricate(:post, topic: topic) }
|
||||
|
@ -650,12 +650,12 @@ RSpec.describe Assigner do
|
|||
end
|
||||
end
|
||||
|
||||
context "reassign_on_open" do
|
||||
describe "reassign_on_open" do
|
||||
let(:post) { Fabricate(:post) }
|
||||
let(:topic) { post.topic }
|
||||
let(:moderator) { Fabricate(:moderator) }
|
||||
|
||||
context "topic" do
|
||||
describe "topic" do
|
||||
let(:assigner) { described_class.new(topic, moderator) }
|
||||
|
||||
before do
|
||||
|
@ -677,7 +677,7 @@ RSpec.describe Assigner do
|
|||
end
|
||||
end
|
||||
|
||||
context "post" do
|
||||
context "with post" do
|
||||
let(:post_2) { Fabricate(:post, topic: topic) }
|
||||
let(:assigner) { described_class.new(post_2, moderator) }
|
||||
|
||||
|
@ -702,7 +702,7 @@ RSpec.describe Assigner do
|
|||
end
|
||||
end
|
||||
|
||||
context "assign_emailer" do
|
||||
describe "assign_emailer" do
|
||||
let(:post) { Fabricate(:post) }
|
||||
let(:topic) { post.topic }
|
||||
let(:moderator) { Fabricate(:moderator) }
|
||||
|
@ -719,9 +719,9 @@ RSpec.describe Assigner do
|
|||
it "doesn't send an email if assignee is a group" do
|
||||
SiteSetting.assign_mailer = AssignMailer.levels[:always]
|
||||
|
||||
expect { described_class.new(topic, moderator).assign(assign_allowed_group) }.to change {
|
||||
expect { described_class.new(topic, moderator).assign(assign_allowed_group) }.not_to change {
|
||||
ActionMailer::Base.deliveries.size
|
||||
}.by(0)
|
||||
}
|
||||
end
|
||||
|
||||
it "doesn't send an email if the assigner and assignee are not different" do
|
||||
|
@ -735,17 +735,17 @@ RSpec.describe Assigner do
|
|||
it "doesn't send an email if the assigner and assignee are not different" do
|
||||
SiteSetting.assign_mailer = AssignMailer.levels[:different_users]
|
||||
|
||||
expect { described_class.new(topic, moderator).assign(moderator) }.to change {
|
||||
expect { described_class.new(topic, moderator).assign(moderator) }.not_to change {
|
||||
ActionMailer::Base.deliveries.size
|
||||
}.by(0)
|
||||
}
|
||||
end
|
||||
|
||||
it "doesn't send an email" do
|
||||
SiteSetting.assign_mailer = AssignMailer.levels[:never]
|
||||
|
||||
expect { described_class.new(topic, moderator).assign(moderator_2) }.to change {
|
||||
expect { described_class.new(topic, moderator).assign(moderator_2) }.not_to change {
|
||||
ActionMailer::Base.deliveries.size
|
||||
}.by(0)
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ require "rails_helper"
|
|||
require_relative "../support/assign_allowed_group"
|
||||
|
||||
def assert_reminder_not_created
|
||||
expect { subject.remind(user) }.to change { Post.count }.by(0)
|
||||
expect { subject.remind(user) }.not_to change { Post.count }
|
||||
end
|
||||
|
||||
RSpec.describe PendingAssignsReminder do
|
||||
|
@ -26,7 +26,7 @@ RSpec.describe PendingAssignsReminder do
|
|||
describe "when the user has multiple tasks" do
|
||||
let(:system) { Discourse.system_user }
|
||||
|
||||
include_context "A group that is allowed to assign"
|
||||
include_context "with group that is allowed to assign"
|
||||
|
||||
before do
|
||||
add_to_assign_allowed_group(user)
|
||||
|
|
|
@ -20,7 +20,7 @@ describe RandomAssignUtils do
|
|||
let!(:automation) { FakeAutomation.new(1) }
|
||||
|
||||
describe ".automation_script!" do
|
||||
context "all users of group are on holidays" do
|
||||
context "when all users of group are on holidays" do
|
||||
fab!(:topic_1) { Fabricate(:topic) }
|
||||
fab!(:group_1) { Fabricate(:group) }
|
||||
fab!(:user_1) { Fabricate(:user) }
|
||||
|
@ -49,7 +49,7 @@ describe RandomAssignUtils do
|
|||
end
|
||||
end
|
||||
|
||||
context "all users of group have been assigned recently" do
|
||||
context "when all users of group have been assigned recently" do
|
||||
fab!(:topic_1) { Fabricate(:topic) }
|
||||
fab!(:group_1) { Fabricate(:group) }
|
||||
fab!(:user_1) { Fabricate(:user) }
|
||||
|
@ -78,7 +78,7 @@ describe RandomAssignUtils do
|
|||
end
|
||||
end
|
||||
|
||||
context "no users can be assigned because none are members of assign_allowed_on_groups groups" do
|
||||
context "when no users can be assigned because none are members of assign_allowed_on_groups groups" do
|
||||
fab!(:topic_1) { Fabricate(:topic) }
|
||||
fab!(:group_1) { Fabricate(:group) }
|
||||
fab!(:user_1) { Fabricate(:user) }
|
||||
|
@ -104,7 +104,7 @@ describe RandomAssignUtils do
|
|||
end
|
||||
end
|
||||
|
||||
context "user can be assigned" do
|
||||
context "when user can be assigned" do
|
||||
fab!(:group_1) { Fabricate(:group) }
|
||||
fab!(:user_1) { Fabricate(:user) }
|
||||
fab!(:topic_1) { Fabricate(:topic) }
|
||||
|
@ -114,7 +114,7 @@ describe RandomAssignUtils do
|
|||
group_1.add(user_1)
|
||||
end
|
||||
|
||||
context "post_template is set" do
|
||||
context "when post_template is set" do
|
||||
it "creates a post with the template and assign the user" do
|
||||
described_class.automation_script!(
|
||||
{},
|
||||
|
@ -135,7 +135,7 @@ describe RandomAssignUtils do
|
|||
end
|
||||
end
|
||||
|
||||
context "post_template is not set" do
|
||||
context "when post_template is not set" do
|
||||
fab!(:post_1) { Fabricate(:post, topic: topic_1) }
|
||||
|
||||
it "assigns the user to the topic" do
|
||||
|
@ -156,7 +156,7 @@ describe RandomAssignUtils do
|
|||
end
|
||||
end
|
||||
|
||||
context "all users in working hours" do
|
||||
context "when all users are in working hours" do
|
||||
fab!(:topic_1) { Fabricate(:topic) }
|
||||
fab!(:group_1) { Fabricate(:group) }
|
||||
fab!(:user_1) { Fabricate(:user) }
|
||||
|
@ -189,7 +189,7 @@ describe RandomAssignUtils do
|
|||
end
|
||||
end
|
||||
|
||||
context "assignees_group not provided" do
|
||||
context "when assignees_group is not provided" do
|
||||
fab!(:topic_1) { Fabricate(:topic) }
|
||||
|
||||
it "raises an error" do
|
||||
|
@ -203,7 +203,7 @@ describe RandomAssignUtils do
|
|||
end
|
||||
end
|
||||
|
||||
context "assignees_group not found" do
|
||||
context "when assignees_group not found" do
|
||||
fab!(:topic_1) { Fabricate(:topic) }
|
||||
|
||||
it "raises an error" do
|
||||
|
@ -224,7 +224,7 @@ describe RandomAssignUtils do
|
|||
end
|
||||
end
|
||||
|
||||
context "assigned_topic not provided" do
|
||||
context "when assigned_topic not provided" do
|
||||
it "raises an error" do
|
||||
expect { described_class.automation_script!({}, {}, automation) }.to raise_error(
|
||||
/`assigned_topic` not provided/,
|
||||
|
@ -232,7 +232,7 @@ describe RandomAssignUtils do
|
|||
end
|
||||
end
|
||||
|
||||
context "assigned_topic is not found" do
|
||||
context "when assigned_topic is not found" do
|
||||
it "raises an error" do
|
||||
expect {
|
||||
described_class.automation_script!(
|
||||
|
@ -244,8 +244,8 @@ describe RandomAssignUtils do
|
|||
end
|
||||
end
|
||||
|
||||
context "minimum_time_between_assignments is set" do
|
||||
context "the topic has been assigned recently" do
|
||||
context "when minimum_time_between_assignments is set" do
|
||||
context "when the topic has been assigned recently" do
|
||||
fab!(:topic_1) { Fabricate(:topic) }
|
||||
|
||||
before do
|
||||
|
@ -277,7 +277,7 @@ describe RandomAssignUtils do
|
|||
end
|
||||
end
|
||||
|
||||
context "skip_new_users_for_days is set" do
|
||||
context "when skip_new_users_for_days is set" do
|
||||
fab!(:topic_1) { Fabricate(:topic) }
|
||||
fab!(:post_1) { Fabricate(:post, topic: topic_1) }
|
||||
fab!(:group_1) { Fabricate(:group) }
|
||||
|
@ -332,14 +332,14 @@ describe RandomAssignUtils do
|
|||
end
|
||||
|
||||
describe ".recently_assigned_users_ids" do
|
||||
context "no one has been assigned" do
|
||||
context "when no one has been assigned" do
|
||||
it "returns an empty array" do
|
||||
assignees_ids = described_class.recently_assigned_users_ids(post.topic_id, 2.months.ago)
|
||||
expect(assignees_ids).to eq([])
|
||||
end
|
||||
end
|
||||
|
||||
context "users have been assigned" do
|
||||
context "when users have been assigned" do
|
||||
let(:admin) { Fabricate(:admin) }
|
||||
let(:assign_allowed_group) { Group.find_by(name: "staff") }
|
||||
let(:user_1) { Fabricate(:user, groups: [assign_allowed_group]) }
|
||||
|
|
|
@ -8,7 +8,7 @@ RSpec.describe Group do
|
|||
|
||||
before { SiteSetting.assign_enabled = true }
|
||||
|
||||
context "Tracking changes that could affect the allow assign on groups site setting" do
|
||||
describe "Tracking changes that could affect the allow assign on groups site setting" do
|
||||
let(:removed_group_setting) { "3|4" }
|
||||
let(:group_attribute) { group.id }
|
||||
|
||||
|
@ -38,13 +38,13 @@ RSpec.describe Group do
|
|||
end
|
||||
end
|
||||
|
||||
context "includes can_show_assigned_tab? method" do
|
||||
describe "includes can_show_assigned_tab? method" do
|
||||
let(:admin) { Fabricate(:admin) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:user1) { Fabricate(:user) }
|
||||
let(:user2) { Fabricate(:user) }
|
||||
|
||||
include_context "A group that is allowed to assign"
|
||||
include_context "with group that is allowed to assign"
|
||||
|
||||
before do
|
||||
add_to_assign_allowed_group(user)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require "rails_helper"
|
||||
|
||||
describe "plugin" do
|
||||
describe DiscourseAssign do
|
||||
before { SiteSetting.assign_enabled = true }
|
||||
|
||||
describe "events" do
|
||||
|
|
|
@ -16,7 +16,7 @@ RSpec.describe DiscourseAssign::AssignController do
|
|||
fab!(:normal_user) { Fabricate(:user) }
|
||||
fab!(:normal_admin) { Fabricate(:admin) }
|
||||
|
||||
context "only allow users from allowed groups" do
|
||||
describe "only allow users from allowed groups" do
|
||||
before { sign_in(user2) }
|
||||
|
||||
it "filters requests where current_user is not member of an allowed group" do
|
||||
|
@ -143,7 +143,7 @@ RSpec.describe DiscourseAssign::AssignController do
|
|||
end
|
||||
|
||||
describe "#assign" do
|
||||
include_context "A group that is allowed to assign"
|
||||
include_context "with group that is allowed to assign"
|
||||
|
||||
before do
|
||||
sign_in(user)
|
||||
|
@ -299,7 +299,7 @@ RSpec.describe DiscourseAssign::AssignController do
|
|||
end
|
||||
|
||||
describe "#assigned" do
|
||||
include_context "A group that is allowed to assign"
|
||||
include_context "with group that is allowed to assign"
|
||||
|
||||
fab!(:post1) { Fabricate(:post) }
|
||||
fab!(:post2) { Fabricate(:post) }
|
||||
|
@ -357,7 +357,7 @@ RSpec.describe DiscourseAssign::AssignController do
|
|||
end
|
||||
|
||||
describe "#group_members" do
|
||||
include_context "A group that is allowed to assign"
|
||||
include_context "with group that is allowed to assign"
|
||||
|
||||
fab!(:post1) { Fabricate(:post) }
|
||||
fab!(:post2) { Fabricate(:post) }
|
||||
|
|
|
@ -12,7 +12,7 @@ describe ListController do
|
|||
let(:post) { Fabricate(:post) }
|
||||
|
||||
describe "only allow users from allowed groups" do
|
||||
include_context "A group that is allowed to assign"
|
||||
include_context "with group that is allowed to assign"
|
||||
|
||||
it "filters requests where current_user is not member of an allowed group" do
|
||||
sign_in(user)
|
||||
|
@ -43,8 +43,8 @@ describe ListController do
|
|||
end
|
||||
end
|
||||
|
||||
context "#group_topics_assigned" do
|
||||
include_context "A group that is allowed to assign"
|
||||
describe "#group_topics_assigned" do
|
||||
include_context "with group that is allowed to assign"
|
||||
|
||||
fab!(:post1) { Fabricate(:post) }
|
||||
fab!(:post2) { Fabricate(:post) }
|
||||
|
@ -105,8 +105,8 @@ describe ListController do
|
|||
end
|
||||
end
|
||||
|
||||
context "#sorting messages_assigned and group_topics_assigned" do
|
||||
include_context "A group that is allowed to assign"
|
||||
describe "#sorting messages_assigned and group_topics_assigned" do
|
||||
include_context "with group that is allowed to assign"
|
||||
|
||||
fab!(:post1) { Fabricate(:post) }
|
||||
fab!(:post2) { Fabricate(:post) }
|
||||
|
@ -219,8 +219,8 @@ describe ListController do
|
|||
end
|
||||
end
|
||||
|
||||
context "filtering of topics as per parameter" do
|
||||
include_context "A group that is allowed to assign"
|
||||
describe "filtering of topics as per parameter" do
|
||||
include_context "with group that is allowed to assign"
|
||||
|
||||
fab!(:post1) { Fabricate(:post) }
|
||||
fab!(:post2) { Fabricate(:post) }
|
||||
|
@ -302,8 +302,8 @@ describe ListController do
|
|||
end
|
||||
end
|
||||
|
||||
context "#messages_assigned" do
|
||||
include_context "A group that is allowed to assign"
|
||||
describe "#messages_assigned" do
|
||||
include_context "with group that is allowed to assign"
|
||||
|
||||
fab!(:post1) { Fabricate(:post) }
|
||||
fab!(:post2) { Fabricate(:post) }
|
||||
|
|
|
@ -7,7 +7,7 @@ describe FlaggedTopicSerializer do
|
|||
fab!(:user) { Fabricate(:user) }
|
||||
let(:guardian) { Guardian.new(user) }
|
||||
|
||||
include_context "A group that is allowed to assign"
|
||||
include_context "with group that is allowed to assign"
|
||||
|
||||
before do
|
||||
SiteSetting.assign_enabled = true
|
||||
|
|
|
@ -9,7 +9,7 @@ describe PostSerializer do
|
|||
fab!(:post) { Fabricate(:post, topic: topic) }
|
||||
let(:guardian) { Guardian.new(user) }
|
||||
|
||||
include_context "A group that is allowed to assign"
|
||||
include_context "with group that is allowed to assign"
|
||||
|
||||
before do
|
||||
SiteSetting.assign_enabled = true
|
||||
|
|
|
@ -32,7 +32,7 @@ RSpec.describe TopicListSerializer do
|
|||
let(:guardian) { Guardian.new(user) }
|
||||
let(:serializer) { TopicListSerializer.new(topic_list, scope: guardian) }
|
||||
|
||||
include_context "A group that is allowed to assign"
|
||||
include_context "with group that is allowed to assign"
|
||||
|
||||
before do
|
||||
SiteSetting.assign_enabled = true
|
||||
|
|
|
@ -9,7 +9,7 @@ RSpec.describe TopicViewSerializer do
|
|||
fab!(:post) { Fabricate(:post, topic: topic) }
|
||||
let(:guardian) { Guardian.new(user) }
|
||||
|
||||
include_context "A group that is allowed to assign"
|
||||
include_context "with group that is allowed to assign"
|
||||
|
||||
before do
|
||||
SiteSetting.assign_enabled = true
|
||||
|
|
|
@ -4,7 +4,7 @@ require "rails_helper"
|
|||
require_relative "../support/assign_allowed_group"
|
||||
|
||||
describe UserBookmarkBaseSerializer do
|
||||
include_context "A group that is allowed to assign"
|
||||
include_context "with group that is allowed to assign"
|
||||
|
||||
before do
|
||||
SiteSetting.assign_enabled = true
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
shared_context "A group that is allowed to assign" do
|
||||
shared_context "with group that is allowed to assign" do
|
||||
fab!(:assign_allowed_group) do
|
||||
Fabricate(:group, assignable_level: Group::ALIAS_LEVELS[:everyone])
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue