Skip to content

Commit

Permalink
Add a proof of concept login test
Browse files Browse the repository at this point in the history
  • Loading branch information
oponder committed Mar 12, 2013
1 parent c95ab13 commit 47e6f19
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions spec/features/login_spec.rb
@@ -0,0 +1,41 @@
require 'spec_helper'

describe "Login" do
before do
@user = FactoryGirl.create(:user, :password => "mypassword")
@channel = FactoryGirl.create(:channel, :name => "Cool")
end

it "shows the login form when visiting the site", js: true do
visit root_path

page.should have_content("Sign In")

end

it "allows someone to log in and chat", js: true do
visit root_path
fill_in "Username", :with => @user.username
fill_in "Password", :with => "mypassword"

click_button "Sign in"

page.should have_content(@user.first_name)
page.should have_content(@user.last_name)

fill_in "chat-input", :with => "Hello there"
click_button "Post"

within("#channel-activities-1") do
page.should have_content("Hello there")
end

fill_in "chat-input", :with => "Hi again"
click_button "Post"

within("#channel-activities-1") do
page.should have_content("Hi again")
end

end
end

0 comments on commit 47e6f19

Please sign in to comment.