-
Notifications
You must be signed in to change notification settings - Fork 408
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
130 additions
and
10 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
6 changes: 6 additions & 0 deletions
6
...ipts/backbone/broadcasters/faye.js.coffee → .../backbone/broadcasters/faye.js.coffee.erb
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
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,2 +1,2 @@ | ||
<textarea class="chat-input"></textarea> | ||
<textarea class="chat-input" id="chat-input"></textarea> | ||
<button class="post">Post</button> |
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,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 |
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,25 @@ | ||
class ActiveRecord::Base | ||
mattr_accessor :shared_connection | ||
@@shared_connection = nil | ||
|
||
def self.connection | ||
@@shared_connection || retrieve_connection | ||
end | ||
end | ||
|
||
# Forces all threads to share the same connection. This works on | ||
# Capybara because it starts the web server in a thread. | ||
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection | ||
|
||
if Rails.env.javascript_test? | ||
module ActiveRecord | ||
module ConnectionAdapters | ||
module QueryCache | ||
private | ||
def cache_sql(sql,binds) | ||
yield | ||
end | ||
end | ||
end | ||
end | ||
end |