mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 05:07:53 +08:00
493d437e79
* Remove outdated option
04078317ba
* Use the non-globally exposed RSpec syntax
https://github.com/rspec/rspec-core/pull/2803
* Use the non-globally exposed RSpec syntax, cont
https://github.com/rspec/rspec-core/pull/2803
* Comply to strict predicate matchers
See:
- https://github.com/rspec/rspec-expectations/pull/1195
- https://github.com/rspec/rspec-expectations/pull/1196
- https://github.com/rspec/rspec-expectations/pull/1277
25 lines
808 B
Ruby
25 lines
808 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe Jobs::BulkGrantTrustLevel do
|
|
|
|
it "raises an error when trust_level is missing" do
|
|
expect { Jobs::BulkGrantTrustLevel.new.execute(user_ids: [1, 2]) }.to raise_error(Discourse::InvalidParameters)
|
|
end
|
|
|
|
it "raises an error when user_ids are missing" do
|
|
expect { Jobs::BulkGrantTrustLevel.new.execute(trust_level: 0) }.to raise_error(Discourse::InvalidParameters)
|
|
end
|
|
|
|
it "updates the trust_level" do
|
|
user1 = Fabricate(:user, email: "foo@wat.com", trust_level: 0)
|
|
user2 = Fabricate(:user, email: "foo@bar.com", trust_level: 2)
|
|
|
|
Jobs::BulkGrantTrustLevel.new.execute(trust_level: 3, user_ids: [user1.id, user2.id])
|
|
|
|
user1.reload
|
|
user2.reload
|
|
expect(user1.trust_level).to eq(3)
|
|
expect(user2.trust_level).to eq(3)
|
|
end
|
|
end
|