Skip to content

Commit 29c602a

Browse files
committed
add tests
1 parent 9a3f2a7 commit 29c602a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+882
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ spec/reports
1515
test/tmp
1616
test/version_tmp
1717
tmp
18+
/spec/dummy/tmp/
19+
/spec/dummy/log/

.rspec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--colour
2+
--format documentation
3+
--require spec_helper

Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
source 'https://rubygems.org'
2+
3+
# Specify your gem's dependencies in rails-fullcalendar.gemspec
4+
gemspec

socket.io-rails.gemspec

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,8 @@ Gem::Specification.new do |gem|
1414
gem.version = Socketio::Rails::VERSION
1515

1616
gem.add_dependency "railties", ">= 3.1"
17+
gem.add_development_dependency "rspec-rails", "~> 3.6.0"
18+
gem.add_development_dependency "capybara", "~> 2.14.0"
19+
gem.add_development_dependency "rails", "5.1.2"
20+
gem.add_development_dependency "sqlite3", "~> 1.3"
1721
end

spec/dummy/Rakefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Add your own tasks in files placed in lib/tasks ending in .rake,
2+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3+
4+
require_relative 'config/application'
5+
6+
Rails.application.load_tasks
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
//= link_tree ../images
3+
//= link_directory ../javascripts .js
4+
//= link_directory ../stylesheets .css

spec/dummy/app/assets/images/.keep

Whitespace-only changes.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// This is a manifest file that'll be compiled into application.js, which will include all the files
2+
// listed below.
3+
//
4+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6+
//
7+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
9+
//
10+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11+
// about supported directives.
12+
//
13+
//= require_tree .
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Action Cable provides the framework to deal with WebSockets in Rails.
2+
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
3+
//
4+
//= require action_cable
5+
//= require_self
6+
//= require_tree ./channels
7+
8+
(function() {
9+
this.App || (this.App = {});
10+
11+
App.cable = ActionCable.createConsumer();
12+
13+
}).call(this);

spec/dummy/app/assets/javascripts/channels/.keep

Whitespace-only changes.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* This is a manifest file that'll be compiled into application.css, which will include all the files
3+
* listed below.
4+
*
5+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7+
*
8+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
9+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10+
* files in this directory. Styles in this file should be added after the last require_* statement.
11+
* It is generally better to create a new file per style scope.
12+
*
13+
*= require_tree .
14+
*= require_self
15+
*/
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module ApplicationCable
2+
class Channel < ActionCable::Channel::Base
3+
end
4+
end
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module ApplicationCable
2+
class Connection < ActionCable::Connection::Base
3+
end
4+
end
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class ApplicationController < ActionController::Base
2+
protect_from_forgery with: :exception
3+
end

spec/dummy/app/controllers/concerns/.keep

Whitespace-only changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
module ApplicationHelper
2+
end
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class ApplicationJob < ActiveJob::Base
2+
end
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class ApplicationMailer < ActionMailer::Base
2+
default from: '[email protected]'
3+
layout 'mailer'
4+
end
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class ApplicationRecord < ActiveRecord::Base
2+
self.abstract_class = true
3+
end

spec/dummy/app/models/concerns/.keep

Whitespace-only changes.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Dummy</title>
5+
<%= csrf_meta_tags %>
6+
7+
<%= stylesheet_link_tag 'application', media: 'all' %>
8+
<%= javascript_include_tag 'application' %>
9+
</head>
10+
11+
<body>
12+
<%= yield %>
13+
</body>
14+
</html>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5+
<style>
6+
/* Email styles need to be inline */
7+
</style>
8+
</head>
9+
10+
<body>
11+
<%= yield %>
12+
</body>
13+
</html>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<%= yield %>

spec/dummy/bin/bundle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env ruby
2+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3+
load Gem.bin_path('bundler', 'bundle')

spec/dummy/bin/rails

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env ruby
2+
APP_PATH = File.expand_path('../config/application', __dir__)
3+
require_relative '../config/boot'
4+
require 'rails/commands'

spec/dummy/bin/rake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env ruby
2+
require_relative '../config/boot'
3+
require 'rake'
4+
Rake.application.run

spec/dummy/bin/setup

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env ruby
2+
require 'pathname'
3+
require 'fileutils'
4+
include FileUtils
5+
6+
# path to your application root.
7+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
8+
9+
def system!(*args)
10+
system(*args) || abort("\n== Command #{args} failed ==")
11+
end
12+
13+
chdir APP_ROOT do
14+
# This script is a starting point to setup your application.
15+
# Add necessary setup steps to this file.
16+
17+
puts '== Installing dependencies =='
18+
system! 'gem install bundler --conservative'
19+
system('bundle check') || system!('bundle install')
20+
21+
# Install JavaScript dependencies if using Yarn
22+
# system('bin/yarn')
23+
24+
25+
# puts "\n== Copying sample files =="
26+
# unless File.exist?('config/database.yml')
27+
# cp 'config/database.yml.sample', 'config/database.yml'
28+
# end
29+
30+
puts "\n== Preparing database =="
31+
system! 'bin/rails db:setup'
32+
33+
puts "\n== Removing old logs and tempfiles =="
34+
system! 'bin/rails log:clear tmp:clear'
35+
36+
puts "\n== Restarting application server =="
37+
system! 'bin/rails restart'
38+
end

spec/dummy/bin/update

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env ruby
2+
require 'pathname'
3+
require 'fileutils'
4+
include FileUtils
5+
6+
# path to your application root.
7+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
8+
9+
def system!(*args)
10+
system(*args) || abort("\n== Command #{args} failed ==")
11+
end
12+
13+
chdir APP_ROOT do
14+
# This script is a way to update your development environment automatically.
15+
# Add necessary update steps to this file.
16+
17+
puts '== Installing dependencies =='
18+
system! 'gem install bundler --conservative'
19+
system('bundle check') || system!('bundle install')
20+
21+
puts "\n== Updating database =="
22+
system! 'bin/rails db:migrate'
23+
24+
puts "\n== Removing old logs and tempfiles =="
25+
system! 'bin/rails log:clear tmp:clear'
26+
27+
puts "\n== Restarting application server =="
28+
system! 'bin/rails restart'
29+
end

spec/dummy/bin/yarn

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env ruby
2+
VENDOR_PATH = File.expand_path('..', __dir__)
3+
Dir.chdir(VENDOR_PATH) do
4+
begin
5+
exec "yarnpkg #{ARGV.join(" ")}"
6+
rescue Errno::ENOENT
7+
$stderr.puts "Yarn executable was not detected in the system."
8+
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
9+
exit 1
10+
end
11+
end

spec/dummy/config.ru

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# This file is used by Rack-based servers to start the application.
2+
3+
require_relative 'config/environment'
4+
5+
run Rails.application

spec/dummy/config/application.rb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
require_relative 'boot'
2+
3+
# Pick the frameworks you want:
4+
require "active_record/railtie"
5+
require "action_controller/railtie"
6+
require "action_view/railtie"
7+
require "action_mailer/railtie"
8+
require "active_job/railtie"
9+
require "action_cable/engine"
10+
# require "rails/test_unit/railtie"
11+
require "sprockets/railtie"
12+
13+
Bundler.require(*Rails.groups)
14+
15+
module Dummy
16+
class Application < Rails::Application
17+
# Initialize configuration defaults for originally generated Rails version.
18+
config.load_defaults 5.1
19+
20+
# Settings in config/environments/* take precedence over those specified here.
21+
# Application configuration should go into files in config/initializers
22+
# -- all .rb files in that directory are automatically loaded.
23+
end
24+
end
25+

spec/dummy/config/boot.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Set up gems listed in the Gemfile.
2+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
3+
4+
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5+
$LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)

spec/dummy/config/cable.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
development:
2+
adapter: async
3+
4+
test:
5+
adapter: async
6+
7+
production:
8+
adapter: redis
9+
url: redis://localhost:6379/1
10+
channel_prefix: dummy_production

spec/dummy/config/database.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
#
7+
default: &default
8+
adapter: sqlite3
9+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10+
timeout: 5000
11+
12+
development:
13+
<<: *default
14+
database: db/development.sqlite3
15+
16+
# Warning: The database defined as "test" will be erased and
17+
# re-generated from your development database when you run "rake".
18+
# Do not set this db to the same as development or production.
19+
test:
20+
<<: *default
21+
database: db/test.sqlite3
22+
23+
production:
24+
<<: *default
25+
database: db/production.sqlite3

spec/dummy/config/environment.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Load the Rails application.
2+
require_relative 'application'
3+
4+
# Initialize the Rails application.
5+
Rails.application.initialize!
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
Rails.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+
# Do not eager load code on boot.
10+
config.eager_load = false
11+
12+
# Show full error reports.
13+
config.consider_all_requests_local = true
14+
15+
# Enable/disable caching. By default caching is disabled.
16+
if Rails.root.join('tmp/caching-dev.txt').exist?
17+
config.action_controller.perform_caching = true
18+
19+
config.cache_store = :memory_store
20+
config.public_file_server.headers = {
21+
'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}"
22+
}
23+
else
24+
config.action_controller.perform_caching = false
25+
26+
config.cache_store = :null_store
27+
end
28+
29+
# Don't care if the mailer can't send.
30+
config.action_mailer.raise_delivery_errors = false
31+
32+
config.action_mailer.perform_caching = false
33+
34+
# Print deprecation notices to the Rails logger.
35+
config.active_support.deprecation = :log
36+
37+
# Raise an error on page load if there are pending migrations.
38+
config.active_record.migration_error = :page_load
39+
40+
# Debug mode disables concatenation and preprocessing of assets.
41+
# This option may cause significant delays in view rendering with a large
42+
# number of complex assets.
43+
config.assets.debug = true
44+
45+
# Suppress logger output for asset requests.
46+
config.assets.quiet = true
47+
48+
# Raises error for missing translations
49+
# config.action_view.raise_on_missing_translations = true
50+
51+
# Use an evented file watcher to asynchronously detect changes in source code,
52+
# routes, locales, etc. This feature depends on the listen gem.
53+
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
54+
end

0 commit comments

Comments
 (0)