mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
make specs more robust
This commit is contained in:
parent
957d7a31dd
commit
943f88fb88
1 changed files with 4 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Admin::GroupsController do
|
||||
|
||||
it "is a subclass of AdminController" do
|
||||
(Admin::GroupsController < Admin::AdminController).should be_true
|
||||
end
|
||||
|
@ -13,7 +14,7 @@ describe Admin::GroupsController do
|
|||
|
||||
xhr :get, :index
|
||||
response.status.should == 200
|
||||
::JSON.parse(response.body).should == [{
|
||||
::JSON.parse(response.body).keep_if{|r| r["id"] == group.id}.should == [{
|
||||
"id"=>group.id,
|
||||
"name"=>group.name,
|
||||
"user_count"=>1,
|
||||
|
@ -36,7 +37,7 @@ describe Admin::GroupsController do
|
|||
xhr :delete, :destroy, id: group.id
|
||||
response.status.should == 200
|
||||
|
||||
Group.count.should == 0
|
||||
Group.where(id: group.id).count.should == 0
|
||||
end
|
||||
|
||||
it "is able to create a group" do
|
||||
|
@ -49,7 +50,7 @@ describe Admin::GroupsController do
|
|||
|
||||
response.status.should == 200
|
||||
|
||||
groups = Group.all.to_a
|
||||
groups = Group.where(name: "bob").to_a
|
||||
|
||||
groups.count.should == 1
|
||||
groups[0].usernames.should == a.username
|
||||
|
|
Loading…
Reference in a new issue