-
Notifications
You must be signed in to change notification settings - Fork 998
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
redirect user to app's page only if there is any app for this user
- Loading branch information
Showing
2 changed files
with
28 additions
and
2 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,26 @@ | ||
require 'spec_helper' | ||
|
||
describe Devise::SessionsController do | ||
render_views | ||
|
||
describe "POST /users/sign_in" do | ||
before do | ||
@request.env["devise.mapping"] = Devise.mappings[:user] | ||
end | ||
|
||
let(:app) { Fabricate(:app) } | ||
let(:user) { Fabricate(:user) } | ||
|
||
it 'redirects to app index page if there are no apps for the user' do | ||
post :create, { :user => { 'email' => user.email, 'password' => user.password } } | ||
response.should redirect_to(root_path) | ||
end | ||
|
||
it 'redirects to app page if there is app for the user' do | ||
Fabricate(:user_watcher, :app => app, :user => user) | ||
post :create, { :user => { 'email' => user.email, 'password' => user.password } } | ||
response.should redirect_to(app_path(app)) | ||
end | ||
end | ||
end | ||
|