mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
Initial release of Discourse
This commit is contained in:
37
spec/controllers/admin/flags_controller_spec.rb
Normal file
37
spec/controllers/admin/flags_controller_spec.rb
Normal file
@ -0,0 +1,37 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Admin::FlagsController do
|
||||
|
||||
it "is a subclass of AdminController" do
|
||||
(Admin::FlagsController < Admin::AdminController).should be_true
|
||||
end
|
||||
|
||||
context 'while logged in as an admin' do
|
||||
before do
|
||||
@user = log_in(:admin)
|
||||
end
|
||||
|
||||
context 'index' do
|
||||
it 'returns empty json when nothing is flagged' do
|
||||
xhr :get, :index
|
||||
|
||||
data = ::JSON.parse(response.body)
|
||||
data["users"].should == []
|
||||
data["posts"].should == []
|
||||
end
|
||||
|
||||
it 'returns a valid json payload when some thing is flagged' do
|
||||
p = Fabricate(:post)
|
||||
u = Fabricate(:user)
|
||||
|
||||
PostAction.act(u, p, PostActionType.Types[:spam])
|
||||
xhr :get, :index
|
||||
|
||||
data = ::JSON.parse(response.body)
|
||||
data["users"].length == 2
|
||||
data["posts"].length == 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user