mirror of
https://github.com/discourse/discourse.git
synced 2024-12-13 03:13:41 +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
31 lines
818 B
Ruby
31 lines
818 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "rails_helper"
|
|
|
|
RSpec.describe Admin::UsersController do
|
|
|
|
let(:admin) { Fabricate(:admin) }
|
|
|
|
before { sign_in(admin) }
|
|
|
|
describe '#destroy' do
|
|
let(:delete_me) { Fabricate(:user) }
|
|
|
|
context "user has voted" do
|
|
let!(:topic) { Fabricate(:topic, user: admin) }
|
|
let!(:post) { Fabricate(:post, topic: topic, user: admin, raw: "[poll]\n- a\n- b\n[/poll]") }
|
|
|
|
it "deletes the user" do
|
|
poll = Poll.last
|
|
PollVote.create!(user: delete_me, poll: poll, poll_option: poll.poll_options.first)
|
|
|
|
delete "/admin/users/#{delete_me.id}.json"
|
|
expect(response.status).to eq(200)
|
|
expect(User.exists?(id: delete_me.id)).to eq(false)
|
|
expect(PollVote.exists?(user_id: delete_me.id)).to eq(false)
|
|
end
|
|
end
|
|
end
|
|
|
|
end
|