FEATURE: Can bulk update the notification level of topics

This commit is contained in:
Robin Ward
2014-02-14 17:38:55 -05:00
parent d0ecccb7e4
commit 3f3c07f136
11 changed files with 113 additions and 5 deletions

View File

@ -38,6 +38,29 @@ describe TopicsBulkAction do
end
end
describe "change_notification_level" do
let(:topic) { Fabricate(:topic) }
context "when the user can edit the topic" do
it "updates the notification level" do
tba = TopicsBulkAction.new(topic.user, [topic.id], type: 'change_notification_level', notification_level_id: 2)
topic_ids = tba.perform!
topic_ids.should == [topic.id]
TopicUser.get(topic, topic.user).notification_level.should == 2
end
end
context "when the user can't edit the topic" do
it "doesn't change the level" do
Guardian.any_instance.expects(:can_see?).returns(false)
tba = TopicsBulkAction.new(topic.user, [topic.id], type: 'change_notification_level', notification_level_id: 2)
topic_ids = tba.perform!
topic_ids.should == []
TopicUser.get(topic, topic.user).should be_blank
end
end
end
describe "close" do
let(:topic) { Fabricate(:topic) }