alondra 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +9 -0
- data/Gemfile +22 -0
- data/Gemfile.lock +166 -0
- data/MIT-LICENSE +20 -0
- data/README.md +177 -0
- data/Rakefile +34 -0
- data/alondra.gemspec +23 -0
- data/app/assets/javascripts/alondra-client.js.coffee.erb +71 -0
- data/app/assets/javascripts/moz_websocket.js +5 -0
- data/app/assets/javascripts/vendor/jquery.json-2.2.js +178 -0
- data/app/assets/javascripts/vendor/json2.js +480 -0
- data/app/assets/javascripts/vendor/swfobject.js +4 -0
- data/app/assets/javascripts/vendor/web_socket.js +379 -0
- data/app/assets/swf/WebSocketMain.swf +0 -0
- data/app/helpers/alondra_helper.rb +24 -0
- data/lib/alondra/changes_callbacks.rb +52 -0
- data/lib/alondra/changes_push.rb +23 -0
- data/lib/alondra/channel.rb +84 -0
- data/lib/alondra/command.rb +38 -0
- data/lib/alondra/command_dispatcher.rb +22 -0
- data/lib/alondra/connection.rb +52 -0
- data/lib/alondra/event.rb +74 -0
- data/lib/alondra/event_listener.rb +86 -0
- data/lib/alondra/event_router.rb +27 -0
- data/lib/alondra/listener_callback.rb +37 -0
- data/lib/alondra/message.rb +35 -0
- data/lib/alondra/message_queue.rb +70 -0
- data/lib/alondra/message_queue_client.rb +71 -0
- data/lib/alondra/push_controller.rb +53 -0
- data/lib/alondra/pushing.rb +14 -0
- data/lib/alondra/server.rb +44 -0
- data/lib/alondra/session_parser.rb +57 -0
- data/lib/alondra.rb +80 -0
- data/lib/generators/alondra/USAGE +8 -0
- data/lib/generators/alondra/alondra_generator.rb +7 -0
- data/lib/generators/alondra/templates/alondra +33 -0
- data/lib/tasks/alondra_tasks.rake +4 -0
- data/script/rails +6 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +9 -0
- data/test/dummy/app/assets/stylesheets/application.css +7 -0
- data/test/dummy/app/controllers/application_controller.rb +14 -0
- data/test/dummy/app/controllers/chats_controller.rb +85 -0
- data/test/dummy/app/controllers/messages_controller.rb +12 -0
- data/test/dummy/app/controllers/sessions_controller.rb +20 -0
- data/test/dummy/app/controllers/users_controller.rb +30 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/helpers/chats_helper.rb +6 -0
- data/test/dummy/app/helpers/error_messages_helper.rb +23 -0
- data/test/dummy/app/helpers/layout_helper.rb +22 -0
- data/test/dummy/app/mailers/.gitkeep +0 -0
- data/test/dummy/app/models/.gitkeep +0 -0
- data/test/dummy/app/models/chat.rb +5 -0
- data/test/dummy/app/models/message.rb +4 -0
- data/test/dummy/app/models/user.rb +37 -0
- data/test/dummy/app/views/chats/_form.html.erb +21 -0
- data/test/dummy/app/views/chats/edit.html.erb +6 -0
- data/test/dummy/app/views/chats/index.html.erb +23 -0
- data/test/dummy/app/views/chats/new.html.erb +5 -0
- data/test/dummy/app/views/chats/show.html.erb +49 -0
- data/test/dummy/app/views/layouts/application.html.erb +19 -0
- data/test/dummy/app/views/sessions/new.html.erb +15 -0
- data/test/dummy/app/views/shared/_message.js.erb +1 -0
- data/test/dummy/app/views/users/_form.html.erb +20 -0
- data/test/dummy/app/views/users/edit.html.erb +3 -0
- data/test/dummy/app/views/users/index.html.erb +25 -0
- data/test/dummy/app/views/users/new.html.erb +5 -0
- data/test/dummy/app/views/users/show.html.erb +15 -0
- data/test/dummy/config/application.rb +42 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +31 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +27 -0
- data/test/dummy/config/environments/production.rb +54 -0
- data/test/dummy/config/environments/test.rb +39 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +10 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +9 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +12 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +19 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/migrate/20110719090458_create_chats.rb +9 -0
- data/test/dummy/db/migrate/20110719090538_create_messages.rb +10 -0
- data/test/dummy/db/migrate/20110720193249_create_users.rb +16 -0
- data/test/dummy/db/schema.rb +38 -0
- data/test/dummy/lib/controller_authentication.rb +48 -0
- data/test/dummy/log/.gitkeep +0 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +26 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/public/stylesheets/application.css +75 -0
- data/test/dummy/script/rails +6 -0
- data/test/integration/push_changes_test.rb +41 -0
- data/test/integration/push_messages_test.rb +40 -0
- data/test/models/channel_test.rb +49 -0
- data/test/models/command_test.rb +29 -0
- data/test/models/configuration_test.rb +22 -0
- data/test/models/connection_test.rb +18 -0
- data/test/models/event_listener_test.rb +217 -0
- data/test/models/event_router_test.rb +7 -0
- data/test/models/message_queue_client_test.rb +26 -0
- data/test/models/message_queue_test.rb +70 -0
- data/test/models/pushing_test.rb +34 -0
- data/test/performance/message_queue_performance.rb +66 -0
- data/test/support/factories.rb +19 -0
- data/test/support/integration_helper.rb +18 -0
- data/test/support/integration_test.rb +6 -0
- data/test/support/mocks/bogus_event.rb +15 -0
- data/test/support/mocks/mock_connection.rb +24 -0
- data/test/support/mocks/mock_event_router.rb +12 -0
- data/test/support/mocks/mock_listener.rb +9 -0
- data/test/test_helper.rb +14 -0
- metadata +316 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3
|
3
|
+
#
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
# gem 'sqlite3'
|
6
|
+
development:
|
7
|
+
adapter: mysql2
|
8
|
+
host: localhost
|
9
|
+
encoding: utf8
|
10
|
+
database: alondra_development
|
11
|
+
pool: 5
|
12
|
+
timeout: 5000
|
13
|
+
|
14
|
+
# Warning: The database defined as "test" will be erased and
|
15
|
+
# re-generated from your development database when you run "rake".
|
16
|
+
# Do not set this db to the same as development or production.
|
17
|
+
test:
|
18
|
+
adapter: mysql2
|
19
|
+
host: localhost
|
20
|
+
encoding: utf8
|
21
|
+
database: alondra_test
|
22
|
+
pool: 5
|
23
|
+
timeout: 5000
|
24
|
+
|
25
|
+
production:
|
26
|
+
adapter: mysql2
|
27
|
+
host: localhost
|
28
|
+
encoding: utf8
|
29
|
+
database: alondra_production
|
30
|
+
pool: 5
|
31
|
+
timeout: 5000
|
@@ -0,0 +1,27 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Don't care if the mailer can't send
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
18
|
+
|
19
|
+
# Print deprecation notices to the Rails logger
|
20
|
+
config.active_support.deprecation = :log
|
21
|
+
|
22
|
+
# Only use best-standards-support built into browsers
|
23
|
+
config.action_dispatch.best_standards_support = :builtin
|
24
|
+
|
25
|
+
# Do not compress assets
|
26
|
+
config.assets.compress = false
|
27
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# Code is not reloaded between requests
|
5
|
+
config.cache_classes = true
|
6
|
+
|
7
|
+
# Full error reports are disabled and caching is turned on
|
8
|
+
config.consider_all_requests_local = false
|
9
|
+
config.action_controller.perform_caching = true
|
10
|
+
|
11
|
+
# Disable Rails's static asset server (Apache or nginx will already do this)
|
12
|
+
config.serve_static_assets = false
|
13
|
+
|
14
|
+
# Compress JavaScripts and CSS
|
15
|
+
config.assets.compress = true
|
16
|
+
|
17
|
+
# Specify the default JavaScript compressor
|
18
|
+
config.assets.js_compressor = :uglifier
|
19
|
+
|
20
|
+
# Specifies the header that your server uses for sending files
|
21
|
+
# (comment out if your front-end server doesn't support this)
|
22
|
+
config.action_dispatch.x_sendfile_header = "X-Sendfile" # Use 'X-Accel-Redirect' for nginx
|
23
|
+
|
24
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
25
|
+
# config.force_ssl = true
|
26
|
+
|
27
|
+
# See everything in the log (default is :info)
|
28
|
+
# config.log_level = :debug
|
29
|
+
|
30
|
+
# Use a different logger for distributed setups
|
31
|
+
# config.logger = SyslogLogger.new
|
32
|
+
|
33
|
+
# Use a different cache store in production
|
34
|
+
# config.cache_store = :mem_cache_store
|
35
|
+
|
36
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server
|
37
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
38
|
+
|
39
|
+
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
40
|
+
# config.assets.precompile += %w( search.js )
|
41
|
+
|
42
|
+
# Disable delivery errors, bad email addresses will be ignored
|
43
|
+
# config.action_mailer.raise_delivery_errors = false
|
44
|
+
|
45
|
+
# Enable threaded mode
|
46
|
+
# config.threadsafe!
|
47
|
+
|
48
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
49
|
+
# the I18n.default_locale when a translation can not be found)
|
50
|
+
config.i18n.fallbacks = true
|
51
|
+
|
52
|
+
# Send deprecation notices to registered listeners
|
53
|
+
config.active_support.deprecation = :notify
|
54
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Configure static asset server for tests with Cache-Control for performance
|
11
|
+
config.serve_static_assets = true
|
12
|
+
config.static_cache_control = "public, max-age=3600"
|
13
|
+
|
14
|
+
# Log error messages when you accidentally call methods on nil
|
15
|
+
config.whiny_nils = true
|
16
|
+
|
17
|
+
# Show full error reports and disable caching
|
18
|
+
config.consider_all_requests_local = true
|
19
|
+
config.action_controller.perform_caching = false
|
20
|
+
|
21
|
+
# Raise exceptions instead of rendering exception templates
|
22
|
+
config.action_dispatch.show_exceptions = false
|
23
|
+
|
24
|
+
# Disable request forgery protection in test environment
|
25
|
+
config.action_controller.allow_forgery_protection = false
|
26
|
+
|
27
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
28
|
+
# The :test delivery method accumulates sent emails in the
|
29
|
+
# ActionMailer::Base.deliveries array.
|
30
|
+
config.action_mailer.delivery_method = :test
|
31
|
+
|
32
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
33
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
34
|
+
# like if you have constraints or database-specific column types
|
35
|
+
# config.active_record.schema_format = :sql
|
36
|
+
|
37
|
+
# Print deprecation notices to the stderr
|
38
|
+
config.active_support.deprecation = :stderr
|
39
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format
|
4
|
+
# (all these examples are active by default):
|
5
|
+
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
+
# inflect.singular /^(ox)en/i, '\1'
|
8
|
+
# inflect.irregular 'person', 'people'
|
9
|
+
# inflect.uncountable %w( fish sheep )
|
10
|
+
# end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
Dummy::Application.config.secret_token = 'baf3fe98ca3a7b2b5d5cf116cc3b9c2264db831b2bd91d1b056d5b81757455c3d6efcbdb07039ca75821229c32fde58677ac37861071fc2aa6b61a59a8dcda28'
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
|
4
|
+
Dummy::Application.config.session_store :cookie_store, httponly: false
|
5
|
+
|
6
|
+
# Use the database for sessions instead of the cookie-based default,
|
7
|
+
# which shouldn't be used to store highly confidential information
|
8
|
+
# (create the session table with "rails generate session_migration")
|
9
|
+
# Dummy::Application.config.session_store :active_record_store
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
#
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActionController::Base.wrap_parameters format: [:json]
|
8
|
+
|
9
|
+
# Disable root element in JSON by default.
|
10
|
+
if defined?(ActiveRecord)
|
11
|
+
ActiveRecord::Base.include_root_in_json = false
|
12
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Dummy::Application.routes.draw do
|
2
|
+
match 'user/edit' => 'users#edit', :as => :edit_current_user
|
3
|
+
|
4
|
+
match 'signup' => 'users#new', :as => :signup
|
5
|
+
|
6
|
+
match 'logout' => 'sessions#destroy', :as => :logout
|
7
|
+
|
8
|
+
match 'login' => 'sessions#new', :as => :login
|
9
|
+
|
10
|
+
resources :sessions
|
11
|
+
|
12
|
+
resources :users
|
13
|
+
|
14
|
+
resources :chats do
|
15
|
+
resources :messages
|
16
|
+
end
|
17
|
+
|
18
|
+
root :to => 'chats#index'
|
19
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateUsers < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :users do |t|
|
4
|
+
t.string :username
|
5
|
+
t.string :email
|
6
|
+
t.string :password_hash
|
7
|
+
t.string :password_salt
|
8
|
+
t.string :access_token
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.down
|
14
|
+
drop_table :users
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# This file is auto-generated from the current state of the database. Instead
|
2
|
+
# of editing this file, please use the migrations feature of Active Record to
|
3
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
4
|
+
#
|
5
|
+
# Note that this schema.rb definition is the authoritative source for your
|
6
|
+
# database schema. If you need to create the application database on another
|
7
|
+
# system, you should be using db:schema:load, not running all the migrations
|
8
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
9
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
10
|
+
#
|
11
|
+
# It's strongly recommended to check this file into your version control system.
|
12
|
+
|
13
|
+
ActiveRecord::Schema.define(:version => 20110720193249) do
|
14
|
+
|
15
|
+
create_table "chats", :force => true do |t|
|
16
|
+
t.string "name"
|
17
|
+
t.datetime "created_at"
|
18
|
+
t.datetime "updated_at"
|
19
|
+
end
|
20
|
+
|
21
|
+
create_table "messages", :force => true do |t|
|
22
|
+
t.integer "chat_id"
|
23
|
+
t.string "text"
|
24
|
+
t.datetime "created_at"
|
25
|
+
t.datetime "updated_at"
|
26
|
+
end
|
27
|
+
|
28
|
+
create_table "users", :force => true do |t|
|
29
|
+
t.string "username"
|
30
|
+
t.string "email"
|
31
|
+
t.string "password_hash"
|
32
|
+
t.string "password_salt"
|
33
|
+
t.string "access_token"
|
34
|
+
t.datetime "created_at"
|
35
|
+
t.datetime "updated_at"
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# This module is included in your application controller which makes
|
2
|
+
# several methods available to all controllers and views. Here's a
|
3
|
+
# common example you might add to your application layout file.
|
4
|
+
#
|
5
|
+
# <% if logged_in? %>
|
6
|
+
# Welcome <%= current_user.username %>.
|
7
|
+
# <%= link_to "Edit profile", edit_current_user_path %> or
|
8
|
+
# <%= link_to "Log out", logout_path %>
|
9
|
+
# <% else %>
|
10
|
+
# <%= link_to "Sign up", signup_path %> or
|
11
|
+
# <%= link_to "log in", login_path %>.
|
12
|
+
# <% end %>
|
13
|
+
#
|
14
|
+
# You can also restrict unregistered users from accessing a controller using
|
15
|
+
# a before filter. For example.
|
16
|
+
#
|
17
|
+
# before_filter :login_required, :except => [:index, :show]
|
18
|
+
module ControllerAuthentication
|
19
|
+
def self.included(controller)
|
20
|
+
controller.send :helper_method, :current_user, :logged_in?, :redirect_to_target_or_default
|
21
|
+
end
|
22
|
+
|
23
|
+
def current_user
|
24
|
+
@current_user ||= User.find(session[:user_id]) if session[:user_id]
|
25
|
+
end
|
26
|
+
|
27
|
+
def logged_in?
|
28
|
+
current_user
|
29
|
+
end
|
30
|
+
|
31
|
+
def login_required
|
32
|
+
unless logged_in?
|
33
|
+
store_target_location
|
34
|
+
redirect_to login_url, :alert => "You must first log in or sign up before accessing this page."
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def redirect_to_target_or_default(default, *args)
|
39
|
+
redirect_to(session[:return_to] || default, *args)
|
40
|
+
session[:return_to] = nil
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def store_target_location
|
46
|
+
session[:return_to] = request.url
|
47
|
+
end
|
48
|
+
end
|
File without changes
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/404.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/422.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The change you wanted was rejected.</h1>
|
23
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/500.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>We're sorry, but something went wrong.</h1>
|
23
|
+
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
File without changes
|
@@ -0,0 +1,75 @@
|
|
1
|
+
body {
|
2
|
+
background-color: #4B7399;
|
3
|
+
font-family: Verdana, Helvetica, Arial;
|
4
|
+
font-size: 14px;
|
5
|
+
}
|
6
|
+
|
7
|
+
a img {
|
8
|
+
border: none;
|
9
|
+
}
|
10
|
+
|
11
|
+
a {
|
12
|
+
color: #0000FF;
|
13
|
+
}
|
14
|
+
|
15
|
+
.clear {
|
16
|
+
clear: both;
|
17
|
+
height: 0;
|
18
|
+
overflow: hidden;
|
19
|
+
}
|
20
|
+
|
21
|
+
#container {
|
22
|
+
width: 75%;
|
23
|
+
margin: 0 auto;
|
24
|
+
background-color: #FFF;
|
25
|
+
padding: 20px 40px;
|
26
|
+
border: solid 1px black;
|
27
|
+
margin-top: 20px;
|
28
|
+
}
|
29
|
+
|
30
|
+
#flash_notice, #flash_error, #flash_alert {
|
31
|
+
padding: 5px 8px;
|
32
|
+
margin: 10px 0;
|
33
|
+
}
|
34
|
+
|
35
|
+
#flash_notice {
|
36
|
+
background-color: #CFC;
|
37
|
+
border: solid 1px #6C6;
|
38
|
+
}
|
39
|
+
|
40
|
+
#flash_error, #flash_alert {
|
41
|
+
background-color: #FCC;
|
42
|
+
border: solid 1px #C66;
|
43
|
+
}
|
44
|
+
|
45
|
+
.fieldWithErrors {
|
46
|
+
display: inline;
|
47
|
+
}
|
48
|
+
|
49
|
+
.error_messages {
|
50
|
+
width: 400px;
|
51
|
+
border: 2px solid #CF0000;
|
52
|
+
padding: 0px;
|
53
|
+
padding-bottom: 12px;
|
54
|
+
margin-bottom: 20px;
|
55
|
+
background-color: #f0f0f0;
|
56
|
+
font-size: 12px;
|
57
|
+
}
|
58
|
+
|
59
|
+
.error_messages h2 {
|
60
|
+
text-align: left;
|
61
|
+
font-weight: bold;
|
62
|
+
padding: 5px 10px;
|
63
|
+
font-size: 12px;
|
64
|
+
margin: 0;
|
65
|
+
background-color: #c00;
|
66
|
+
color: #fff;
|
67
|
+
}
|
68
|
+
|
69
|
+
.error_messages p {
|
70
|
+
margin: 8px 10px;
|
71
|
+
}
|
72
|
+
|
73
|
+
.error_messages ul {
|
74
|
+
margin: 0;
|
75
|
+
}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
|
+
require 'rails/commands'
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Alondra
|
4
|
+
class ChatPushingTest < ActiveSupport::IntegrationCase
|
5
|
+
|
6
|
+
self.use_transactional_fixtures = false
|
7
|
+
|
8
|
+
setup do
|
9
|
+
clean_db
|
10
|
+
Capybara.default_driver = :webkit
|
11
|
+
end
|
12
|
+
|
13
|
+
teardown do
|
14
|
+
clean_db
|
15
|
+
end
|
16
|
+
|
17
|
+
test "push chat changes to client" do
|
18
|
+
|
19
|
+
user = Factory.create :user
|
20
|
+
chat = Factory.create :chat, :name => 'A chat about nothing'
|
21
|
+
|
22
|
+
login_as user
|
23
|
+
|
24
|
+
chat_path = chat_path(chat)
|
25
|
+
|
26
|
+
visit chat_path
|
27
|
+
|
28
|
+
wait_until(5) do
|
29
|
+
page.has_content? 'A chat about nothing'
|
30
|
+
end
|
31
|
+
|
32
|
+
chat.update_attributes! :name => 'A chat about everything'
|
33
|
+
|
34
|
+
sleep(0.5)
|
35
|
+
|
36
|
+
wait_until(15) do
|
37
|
+
page.has_content? 'A chat about everything'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Alondra
|
4
|
+
class PushMessagesTest < ActiveSupport::IntegrationCase
|
5
|
+
self.use_transactional_fixtures = false
|
6
|
+
|
7
|
+
setup do
|
8
|
+
clean_db
|
9
|
+
Capybara.default_driver = :webkit
|
10
|
+
end
|
11
|
+
|
12
|
+
teardown do
|
13
|
+
clean_db
|
14
|
+
end
|
15
|
+
|
16
|
+
test "execute messages in client" do
|
17
|
+
self.extend Pushing
|
18
|
+
|
19
|
+
@user = Factory.create :user
|
20
|
+
@text = 'hola!'
|
21
|
+
|
22
|
+
chat = Factory.create :chat, :name => 'A chat to receive messages'
|
23
|
+
|
24
|
+
login_as @user
|
25
|
+
|
26
|
+
chat_path = chat_path(chat)
|
27
|
+
visit chat_path(chat)
|
28
|
+
|
29
|
+
wait_until 10 do
|
30
|
+
page.has_content? 'Subscribed to channel'
|
31
|
+
end
|
32
|
+
|
33
|
+
push :partial => '/shared/message', :to => chat_path
|
34
|
+
|
35
|
+
wait_until 20 do
|
36
|
+
page.has_content? "#{@user.username} says hola!"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|