-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adds spec for API controller and fixes channels controller spec * Changes FactoryGirl definitions
- Loading branch information
Showing
5 changed files
with
46 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
require "spec_helper" | ||
|
||
describe ApisController do | ||
|
||
before :each do | ||
@user = Factory :user | ||
request.env['warden'].stub :authenticate! => @user | ||
controller.stub :current_user => @user | ||
end | ||
|
||
|
||
describe "active_users" do | ||
it "should return json" do | ||
get :active_users, :format => :json | ||
ActiveUsers.stub!(:all).and_return([]) | ||
JSON(response.body).should be_kind_of(Array) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
Factory.sequence :ido_id do |n| | ||
"abc-#{ n }" | ||
end | ||
FactoryGirl.define do | ||
sequence :ido_id do |n| | ||
"abc-#{n}" | ||
end | ||
|
||
Factory.sequence :email do |n| | ||
"email#{ n }@factory.com" | ||
end | ||
sequence :email do |n| | ||
"email#{n}@example.com" | ||
end | ||
|
||
Factory.define :channel do |f| | ||
f.name "Test channel" | ||
end | ||
factory :channel do |f| | ||
f.name "Test channel" | ||
end | ||
|
||
Factory.define :user do |f| | ||
f.first_name "Test" | ||
f.last_name "User" | ||
f.email { Factory.next(:email) } | ||
f.ido_id { Factory.next(:ido_id) } | ||
end | ||
factory :user do |f| | ||
f.first_name "Test" | ||
f.last_name "User" | ||
f.email { Factory.next(:email) } | ||
f.ido_id { Factory.next(:ido_id) } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters