spec/features/authentication_pages_spec.rb
531ecd5f
 require 'spec_helper'
 
 describe "Authentication" do
 
 	subject { page }
 
 	describe "signin page" do
 		before { visit signin_path }
 
 		it { should have_selector('h1',    text: 'Login') }
 		it { should have_title('Login') }
 	end
 
 	describe "signin" do
 		before { visit signin_path }
 
 		describe "with invalid information" do
925c5fd0
 			before { click_button I18n.t("sessions.new.form-send") }
531ecd5f
 
 			it { should have_title('Login') }
 			it { should have_selector('div.alert.alert-error', text: 'Invalid') }
 		end
 
 		describe "with valid information" do
f835d40d
 			before { signin }
531ecd5f
 
f835d40d
 			it { should have_title(I18n.t("chat.title")) }
531ecd5f
 			#it { should have_link('Profile', href: user_path(user)) }
 			#it { should have_link('Logout', href: signout_path) }
f835d40d
 			it { should_not have_link('Login', href: signin_path) }
531ecd5f
 
f835d40d
 			it {should have_selector('div.alert.alert-notice', text: I18n.t("login.success"))}
         end
 
         describe "remember and redirect" do
             before do
                 signin
                 visit root_path
             end
 
             it { should have_title(I18n.t("chat.title")) }
             it { should_not have_link('Login', href: signin_path) }
         end
531ecd5f
 	end
 end