mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 15:20:13 +01:00
commit
7748253388
41 changed files with 378 additions and 274 deletions
13
Gemfile
13
Gemfile
|
|
@ -1,8 +1,8 @@
|
|||
source 'https://rubygems.org'
|
||||
|
||||
gem 'rails', '~>4.1.11'
|
||||
gem 'sass-rails', '~>4.0'
|
||||
gem 'coffee-rails', '~>4.0'
|
||||
gem 'rails', '~> 4.2.6'
|
||||
gem 'sass-rails', '~> 5.0'
|
||||
gem 'coffee-rails', '~> 4.1.0'
|
||||
|
||||
#gem 'json'
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ group :development do
|
|||
gem "spring-commands-cucumber"
|
||||
gem "yard"
|
||||
|
||||
gem 'tolk', '~> 1.6.0'
|
||||
gem 'tolk', '~> 1.9.3'
|
||||
|
||||
gem "bullet"
|
||||
gem "rack-mini-profiler"
|
||||
|
|
@ -65,12 +65,17 @@ group :development, :test do
|
|||
end
|
||||
|
||||
group :test do
|
||||
# Pull in the fix for rails-dom-testing issue #42
|
||||
# TODO: Remove with Rails 5 and rails-dom-testing 2.x
|
||||
gem 'rails-dom-testing', github: 'rails/rails-dom-testing', ref: 'a64f30514ee65f172c43f42cfd4500b5e11a561a'
|
||||
|
||||
gem "factory_girl_rails"
|
||||
gem "capybara"
|
||||
gem "cucumber-rails", :require => false
|
||||
gem "rspec-expectations"
|
||||
gem "database_cleaner"
|
||||
gem "mocha", :require => false
|
||||
gem "minitest-stub-const"
|
||||
|
||||
gem "aruba", ">=0.5.4", :require => false
|
||||
|
||||
|
|
|
|||
159
Gemfile.lock
159
Gemfile.lock
|
|
@ -1,40 +1,59 @@
|
|||
GIT
|
||||
remote: git://github.com/rails/rails-dom-testing.git
|
||||
revision: a64f30514ee65f172c43f42cfd4500b5e11a561a
|
||||
ref: a64f30514ee65f172c43f42cfd4500b5e11a561a
|
||||
specs:
|
||||
rails-dom-testing (1.0.7)
|
||||
activesupport (>= 4.2.0.beta, < 5.0)
|
||||
nokogiri (~> 1.6.0)
|
||||
rails-deprecated_sanitizer (>= 1.0.1)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
RedCloth (4.2.9)
|
||||
aasm (3.4.0)
|
||||
actionmailer (4.1.14.1)
|
||||
actionpack (= 4.1.14.1)
|
||||
actionview (= 4.1.14.1)
|
||||
actionmailer (4.2.6)
|
||||
actionpack (= 4.2.6)
|
||||
actionview (= 4.2.6)
|
||||
activejob (= 4.2.6)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
actionpack (4.1.14.1)
|
||||
actionview (= 4.1.14.1)
|
||||
activesupport (= 4.1.14.1)
|
||||
rack (~> 1.5.2)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
actionpack (4.2.6)
|
||||
actionview (= 4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
rack (~> 1.6)
|
||||
rack-test (~> 0.6.2)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
actionpack-xml_parser (1.0.1)
|
||||
actionpack (>= 4.0.0.rc1)
|
||||
actionview (4.1.14.1)
|
||||
activesupport (= 4.1.14.1)
|
||||
actionview (4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
builder (~> 3.1)
|
||||
erubis (~> 2.7.0)
|
||||
activemodel (4.1.14.1)
|
||||
activesupport (= 4.1.14.1)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
activejob (4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
globalid (>= 0.3.0)
|
||||
activemodel (4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
builder (~> 3.1)
|
||||
activerecord (4.1.14.1)
|
||||
activemodel (= 4.1.14.1)
|
||||
activesupport (= 4.1.14.1)
|
||||
arel (~> 5.0.0)
|
||||
activerecord (4.2.6)
|
||||
activemodel (= 4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
arel (~> 6.0)
|
||||
activerecord-deprecated_finders (1.0.3)
|
||||
activesupport (4.1.14.1)
|
||||
i18n (~> 0.6, >= 0.6.9)
|
||||
activesupport (4.2.6)
|
||||
i18n (~> 0.7)
|
||||
json (~> 1.7, >= 1.7.7)
|
||||
minitest (~> 5.1)
|
||||
thread_safe (~> 0.1)
|
||||
thread_safe (~> 0.3, >= 0.3.4)
|
||||
tzinfo (~> 1.1)
|
||||
acts_as_list (0.5.0)
|
||||
acts_as_list (0.7.2)
|
||||
activerecord (>= 3.0)
|
||||
arel (5.0.1.20140414130214)
|
||||
arel (6.0.3)
|
||||
aruba (0.6.1)
|
||||
childprocess (>= 0.3.6)
|
||||
cucumber (>= 1.1.1)
|
||||
|
|
@ -68,10 +87,11 @@ GEM
|
|||
coffee-rails (4.1.0)
|
||||
coffee-script (>= 2.2.0)
|
||||
railties (>= 4.0.0, < 5.0)
|
||||
coffee-script (2.3.0)
|
||||
coffee-script (2.4.1)
|
||||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.8.0)
|
||||
coffee-script-source (1.9.1.1)
|
||||
concurrent-ruby (1.0.2)
|
||||
crass (0.2.1)
|
||||
cucumber (1.3.18)
|
||||
builder (>= 2.1.2)
|
||||
|
|
@ -102,7 +122,8 @@ GEM
|
|||
sass (>= 3.2)
|
||||
gherkin (2.12.2)
|
||||
multi_json (~> 1.3)
|
||||
hike (1.2.3)
|
||||
globalid (0.3.6)
|
||||
activesupport (>= 4.1.0)
|
||||
htmlentities (4.3.3)
|
||||
i18n (0.7.0)
|
||||
jquery-rails (3.1.3)
|
||||
|
|
@ -112,20 +133,23 @@ GEM
|
|||
railties (>= 3.2.16)
|
||||
json (1.8.3)
|
||||
libv8 (3.16.14.7)
|
||||
mail (2.6.3)
|
||||
mime-types (>= 1.16, < 3)
|
||||
loofah (2.0.3)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.6.4)
|
||||
mime-types (>= 1.16, < 4)
|
||||
metaclass (0.0.4)
|
||||
method_source (0.8.2)
|
||||
mime-types (2.99)
|
||||
mime-types (2.99.2)
|
||||
mimemagic (0.3.0)
|
||||
mini_portile2 (2.0.0)
|
||||
minitest (5.8.4)
|
||||
minitest (5.9.0)
|
||||
minitest-stub-const (0.5)
|
||||
mocha (1.1.0)
|
||||
metaclass (~> 0.0.1)
|
||||
multi_json (1.11.2)
|
||||
multi_test (0.1.1)
|
||||
mysql2 (0.3.20)
|
||||
nokogiri (1.6.7)
|
||||
nokogiri (1.6.7.2)
|
||||
mini_portile2 (~> 2.0.0.rc2)
|
||||
nokogumbo (1.1.12)
|
||||
nokogiri
|
||||
|
|
@ -139,31 +163,36 @@ GEM
|
|||
coderay (~> 1.1.0)
|
||||
method_source (~> 0.8.1)
|
||||
slop (~> 3.4)
|
||||
rack (1.5.5)
|
||||
rack (1.6.4)
|
||||
rack-dev-mark (0.7.3)
|
||||
rack (>= 1.1)
|
||||
rack-mini-profiler (0.9.2)
|
||||
rack (>= 1.1.3)
|
||||
rack-test (0.6.3)
|
||||
rack (>= 1.0)
|
||||
rails (4.1.14.1)
|
||||
actionmailer (= 4.1.14.1)
|
||||
actionpack (= 4.1.14.1)
|
||||
actionview (= 4.1.14.1)
|
||||
activemodel (= 4.1.14.1)
|
||||
activerecord (= 4.1.14.1)
|
||||
activesupport (= 4.1.14.1)
|
||||
rails (4.2.6)
|
||||
actionmailer (= 4.2.6)
|
||||
actionpack (= 4.2.6)
|
||||
actionview (= 4.2.6)
|
||||
activejob (= 4.2.6)
|
||||
activemodel (= 4.2.6)
|
||||
activerecord (= 4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
bundler (>= 1.3.0, < 2.0)
|
||||
railties (= 4.1.14.1)
|
||||
sprockets-rails (~> 2.0)
|
||||
railties (= 4.2.6)
|
||||
sprockets-rails
|
||||
rails-deprecated_sanitizer (1.0.3)
|
||||
activesupport (>= 4.2.0.alpha)
|
||||
rails-html-sanitizer (1.0.3)
|
||||
loofah (~> 2.0)
|
||||
rails_autolink (1.1.6)
|
||||
rails (> 3.1)
|
||||
railties (4.1.14.1)
|
||||
actionpack (= 4.1.14.1)
|
||||
activesupport (= 4.1.14.1)
|
||||
railties (4.2.6)
|
||||
actionpack (= 4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
rake (10.5.0)
|
||||
rake (11.1.2)
|
||||
ref (1.0.5)
|
||||
rspec-expectations (3.1.2)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
|
|
@ -175,12 +204,13 @@ GEM
|
|||
crass (~> 0.2.0)
|
||||
nokogiri (>= 1.4.4)
|
||||
nokogumbo (= 1.1.12)
|
||||
sass (3.2.19)
|
||||
sass-rails (4.0.4)
|
||||
sass (3.4.22)
|
||||
sass-rails (5.0.4)
|
||||
railties (>= 4.0.0, < 5.0)
|
||||
sass (~> 3.2.2)
|
||||
sprockets (~> 2.8, < 2.12)
|
||||
sprockets-rails (~> 2.0)
|
||||
sass (~> 3.1)
|
||||
sprockets (>= 2.8, < 4.0)
|
||||
sprockets-rails (>= 2.0, < 4.0)
|
||||
tilt (>= 1.1, < 3)
|
||||
selenium-webdriver (2.50.0)
|
||||
childprocess (~> 0.5)
|
||||
multi_json (~> 1.0)
|
||||
|
|
@ -195,15 +225,13 @@ GEM
|
|||
spring (1.1.3)
|
||||
spring-commands-cucumber (1.0.1)
|
||||
spring (>= 0.9.1)
|
||||
sprockets (2.11.3)
|
||||
hike (~> 1.2)
|
||||
multi_json (~> 1.0)
|
||||
rack (~> 1.0)
|
||||
tilt (~> 1.1, != 1.3.0)
|
||||
sprockets-rails (2.3.3)
|
||||
actionpack (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
sprockets (>= 2.8, < 4.0)
|
||||
sprockets (3.6.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
sprockets-rails (3.0.4)
|
||||
actionpack (>= 4.0)
|
||||
activesupport (>= 4.0)
|
||||
sprockets (>= 3.0.0)
|
||||
sqlite3 (1.3.10)
|
||||
swf_fu (2.0.4)
|
||||
coffee-script
|
||||
|
|
@ -217,11 +245,10 @@ GEM
|
|||
rack (~> 1.0)
|
||||
thor (0.19.1)
|
||||
thread_safe (0.3.5)
|
||||
tilt (1.4.1)
|
||||
tolk (1.6.0)
|
||||
rails (>= 4.0, < 4.2)
|
||||
tilt (2.0.4)
|
||||
tolk (1.9.3)
|
||||
rails (>= 4.0, < 4.3)
|
||||
safe_yaml (>= 0.8.6)
|
||||
will_paginate
|
||||
tzinfo (1.2.2)
|
||||
thread_safe (~> 0.1)
|
||||
uglifier (2.7.2)
|
||||
|
|
@ -249,7 +276,7 @@ DEPENDENCIES
|
|||
bullet
|
||||
capybara
|
||||
codeclimate-test-reporter
|
||||
coffee-rails (~> 4.0)
|
||||
coffee-rails (~> 4.1.0)
|
||||
cucumber-rails
|
||||
database_cleaner
|
||||
factory_girl_rails
|
||||
|
|
@ -257,17 +284,19 @@ DEPENDENCIES
|
|||
htmlentities
|
||||
jquery-rails
|
||||
jquery-ui-rails
|
||||
minitest-stub-const
|
||||
mocha
|
||||
mysql2 (~> 0.3.17)
|
||||
paperclip
|
||||
pry
|
||||
rack-dev-mark
|
||||
rack-mini-profiler
|
||||
rails (~> 4.1.11)
|
||||
rails (~> 4.2.6)
|
||||
rails-dom-testing!
|
||||
rails_autolink
|
||||
rspec-expectations
|
||||
sanitize (>= 3.0.0)
|
||||
sass-rails (~> 4.0)
|
||||
sass-rails (~> 5.0)
|
||||
selenium-webdriver (>= 2.50)
|
||||
simplecov
|
||||
spring
|
||||
|
|
@ -276,10 +305,10 @@ DEPENDENCIES
|
|||
swf_fu
|
||||
therubyracer
|
||||
thin
|
||||
tolk (~> 1.6.0)
|
||||
tolk (~> 1.9.3)
|
||||
uglifier (>= 1.3.0)
|
||||
will_paginate
|
||||
yard
|
||||
|
||||
BUNDLED WITH
|
||||
1.10.6
|
||||
1.11.2
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// listed below.
|
||||
//
|
||||
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
||||
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
||||
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
||||
//
|
||||
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
||||
// compiled file.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* listed below.
|
||||
*
|
||||
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
||||
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
||||
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
||||
*
|
||||
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
||||
* compiled file so the styles you add here take precedence over styles defined in any styles
|
||||
3
bin/bundle
Executable file
3
bin/bundle
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env ruby
|
||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
||||
load Gem.bin_path('bundler', 'bundle')
|
||||
|
|
@ -1,10 +1,4 @@
|
|||
#!/usr/bin/env ruby
|
||||
begin
|
||||
load File.expand_path("../spring", __FILE__)
|
||||
rescue LoadError
|
||||
end
|
||||
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
||||
|
||||
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
||||
require File.expand_path('../../config/boot', __FILE__)
|
||||
require_relative '../config/boot'
|
||||
require 'rails/commands'
|
||||
|
|
|
|||
9
bin/rake
9
bin/rake
|
|
@ -1,7 +1,4 @@
|
|||
#!/usr/bin/env ruby
|
||||
begin
|
||||
load File.expand_path("../spring", __FILE__)
|
||||
rescue LoadError
|
||||
end
|
||||
require 'bundler/setup'
|
||||
load Gem.bin_path('rake', 'rake')
|
||||
require_relative '../config/boot'
|
||||
require 'rake'
|
||||
Rake.application.run
|
||||
|
|
|
|||
29
bin/setup
Executable file
29
bin/setup
Executable file
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env ruby
|
||||
require 'pathname'
|
||||
|
||||
# path to your application root.
|
||||
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
||||
|
||||
Dir.chdir APP_ROOT do
|
||||
# This script is a starting point to setup your application.
|
||||
# Add necessary setup steps to this file:
|
||||
|
||||
puts "== Installing dependencies =="
|
||||
system "gem install bundler --conservative"
|
||||
system "bundle check || bundle install"
|
||||
|
||||
# puts "\n== Copying sample files =="
|
||||
# unless File.exist?("config/database.yml")
|
||||
# system "cp config/database.yml.sample config/database.yml"
|
||||
# end
|
||||
|
||||
puts "\n== Preparing database =="
|
||||
system "bin/rake db:setup"
|
||||
|
||||
puts "\n== Removing old logs and tempfiles =="
|
||||
system "rm -f log/*"
|
||||
system "rm -rf tmp/cache"
|
||||
|
||||
puts "\n== Restarting application server =="
|
||||
system "touch tmp/restart.txt"
|
||||
end
|
||||
|
|
@ -28,12 +28,12 @@ module Tracksapp
|
|||
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
||||
# config.i18n.default_locale = :de
|
||||
|
||||
# Do not swallow errors in after_commit/after_rollback callbacks.
|
||||
config.active_record.raise_in_transactional_callbacks = true
|
||||
|
||||
# configure Tracks to handle deployment in a subdir
|
||||
config.relative_url_root = SITE_CONFIG['subdir'] if SITE_CONFIG['subdir']
|
||||
|
||||
# allow onenote:// and message:// as protocols for urls
|
||||
config.action_view.sanitized_allowed_protocols = 'onenote', 'message'
|
||||
|
||||
config.middleware.insert_after ActionDispatch::ParamsParser, ActionDispatch::XmlParamsParser
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
# Set up gems listed in the Gemfile.
|
||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
||||
|
||||
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
||||
require 'bundler/setup' # Set up gems listed in the Gemfile.
|
||||
|
|
|
|||
|
|
@ -27,6 +27,10 @@ Rails.application.configure do
|
|||
# number of complex assets.
|
||||
config.assets.debug = true
|
||||
|
||||
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
||||
# yet still be able to expire them through the digest params.
|
||||
config.assets.digest = true
|
||||
|
||||
# Adds additional error checking when serving assets at runtime.
|
||||
# Checks for improperly declared sprockets dependencies.
|
||||
# Raises helpful error messages.
|
||||
|
|
|
|||
|
|
@ -16,11 +16,13 @@ Rails.application.configure do
|
|||
|
||||
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
||||
# Add `rack-cache` to your Gemfile before enabling this.
|
||||
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
|
||||
# For large-scale production use, consider using a caching reverse proxy like
|
||||
# NGINX, varnish or squid.
|
||||
# config.action_dispatch.rack_cache = true
|
||||
|
||||
# Disable Rails's static asset server (Apache or nginx will already do this).
|
||||
config.serve_static_assets = SITE_CONFIG['serve_static_assets'] || false
|
||||
# Disable serving static files from the `/public` folder by default since
|
||||
# Apache or NGINX already handles this.
|
||||
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? || SITE_CONFIG['serve_static_assets'] || false
|
||||
|
||||
# Compress JavaScripts and CSS.
|
||||
config.assets.js_compressor = :uglifier
|
||||
|
|
@ -29,20 +31,22 @@ Rails.application.configure do
|
|||
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
||||
config.assets.compile = false
|
||||
|
||||
# Generate digests for assets URLs.
|
||||
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
||||
# yet still be able to expire them through the digest params.
|
||||
config.assets.digest = true
|
||||
|
||||
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
||||
|
||||
# Specifies the header that your server uses for sending files.
|
||||
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
||||
|
||||
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||
# config.force_ssl = true
|
||||
|
||||
# Set to :debug to see everything in the log.
|
||||
config.log_level = :info
|
||||
# Use the lowest log level to ensure availability of diagnostic information
|
||||
# when problems arise.
|
||||
config.log_level = :debug
|
||||
|
||||
# Prepend all log lines with the following tags.
|
||||
# config.log_tags = [ :subdomain, :uuid ]
|
||||
|
|
@ -54,7 +58,7 @@ Rails.application.configure do
|
|||
# config.cache_store = :mem_cache_store
|
||||
|
||||
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
||||
# config.action_controller.asset_host = "http://assets.example.com"
|
||||
# config.action_controller.asset_host = 'http://assets.example.com'
|
||||
|
||||
# Ignore bad email addresses and do not raise email delivery errors.
|
||||
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
||||
|
|
@ -67,9 +71,6 @@ Rails.application.configure do
|
|||
# Send deprecation notices to registered listeners.
|
||||
config.active_support.deprecation = :notify
|
||||
|
||||
# Disable automatic flushing of the log to improve performance.
|
||||
# config.autoflush_log = false
|
||||
|
||||
# Use default logging formatter so that PID and timestamp are not suppressed.
|
||||
config.log_formatter = ::Logger::Formatter.new
|
||||
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ Rails.application.configure do
|
|||
# preloads Rails for running tests, you may have to set it to true.
|
||||
config.eager_load = false
|
||||
|
||||
# Configure static asset server for tests with Cache-Control for performance.
|
||||
config.serve_static_assets = true
|
||||
# Configure static file server for tests with Cache-Control for performance.
|
||||
config.serve_static_files = true
|
||||
config.static_cache_control = 'public, max-age=3600'
|
||||
|
||||
# Show full error reports and disable caching.
|
||||
|
|
@ -31,6 +31,9 @@ Rails.application.configure do
|
|||
# ActionMailer::Base.deliveries array.
|
||||
config.action_mailer.delivery_method = :test
|
||||
|
||||
# Randomize the order test cases are executed.
|
||||
config.active_support.test_order = :random
|
||||
|
||||
# Print deprecation notices to the stderr.
|
||||
config.active_support.deprecation = :stderr
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@
|
|||
# Version of your assets, change this if you want to expire all your assets.
|
||||
Rails.application.config.assets.version = '1.0'
|
||||
|
||||
# Add additional assets to the asset load path
|
||||
# Rails.application.config.assets.paths << Emoji.images_path
|
||||
|
||||
# Precompile additional assets.
|
||||
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
||||
Rails.application.config.assets.precompile += %w( print.css mobile.css jquery-ui/datepicker-*.js )
|
||||
|
|
|
|||
3
config/initializers/cookies_serializer.rb
Normal file
3
config/initializers/cookies_serializer.rb
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
Rails.application.config.action_dispatch.cookies_serializer = :marshal
|
||||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
# Add new mime types for use in respond_to blocks:
|
||||
# Mime::Type.register "text/richtext", :rtf
|
||||
# Mime::Type.register_alias "text/html", :iphone
|
||||
|
||||
Mime::Type.register_alias "text/html", :m
|
||||
Mime::Type.register_alias "text/plain", :autocomplete
|
||||
|
|
|
|||
1
config/initializers/sanitizer.rb
Normal file
1
config/initializers/sanitizer.rb
Normal file
|
|
@ -0,0 +1 @@
|
|||
Loofah::HTML5::WhiteList::ALLOWED_PROTOCOLS.merge(%w(message onenote))
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
* Removed support for deprecated password-hashing algorithm. This
|
||||
eliminates config.salt. Note the addition of a pre-upgrade step to
|
||||
check for obsolete passwords.
|
||||
* Rails 4.2
|
||||
* Thin replaces WEBrick as the included web server
|
||||
* Tracks is tested on Ruby 1.9.3, 2.0.0, 2.1, and 2.2.
|
||||
* The MessageGateway will save the received email as an attachement to the todo
|
||||
|
|
|
|||
|
|
@ -94,11 +94,11 @@ While still in the Terminal inside the Tracks root directory, issue the followin
|
|||
|
||||
bundle exec rails server -e production
|
||||
|
||||
If all goes well, you should see some text informing you that the server is running: `=> Rails application starting in production on http://0.0.0.0:3000`. If you are already running other services on port 3000, you need to select a different port when running the server, using the `-p` option.
|
||||
If all goes well, you should see some text informing you that the server is running: `=> Rails application starting in production on http://localhost:3000`. If you are already running other services on port 3000, you need to select a different port when running the server, using the `-p` option.
|
||||
|
||||
## Visit Tracks in a browser
|
||||
|
||||
Visit `http://0.0.0.0:3000/signup` in a browser (or whatever URL and port was reported when you started the server in the step above) and chose a user name and password for admin user. Once logged in as admin, you can add other (ordinary level) users. If you need to access Tracks from a mobile/cellular phone browser, visit `http://yourdomain.com/mobile/`. This mobile version is a special, lightweight version of Tracks, designed to use on a mobile browser.
|
||||
Visit `http://localhost:3000/signup` in a browser (or whatever URL and port was reported when you started the server in the step above) and chose a user name and password for admin user. Once logged in as admin, you can add other (ordinary level) users. If you need to access Tracks from a mobile/cellular phone browser, visit `http://yourdomain.com/mobile/`. This mobile version is a special, lightweight version of Tracks, designed to use on a mobile browser.
|
||||
|
||||
## Customise Tracks
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ require 'activeresource'
|
|||
module Tracks
|
||||
|
||||
class Base < ActiveResource::Base
|
||||
self.site = ENV["SITE"] || "http://username:password@0.0.0.0:3000/"
|
||||
self.site = ENV["SITE"] || "http://username:password@localhost:3000/"
|
||||
end
|
||||
|
||||
class Todo < Base
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace :ci do
|
|||
|
||||
puts 'Running "lite" test suite'
|
||||
|
||||
[:environment, 'db:create', 'test:all'].each do |t|
|
||||
[:environment, 'db:create', :test].each do |t|
|
||||
Rake::Task[t].invoke
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
require 'test_helper'
|
||||
require 'support/html_entity_helper'
|
||||
|
||||
class ContextsControllerTest < ActionController::TestCase
|
||||
include HTMLEntityHelper
|
||||
|
||||
fixtures :users, :preferences, :contexts
|
||||
|
||||
def test_contexts_list
|
||||
|
|
@ -96,7 +99,7 @@ class ContextsControllerTest < ActionController::TestCase
|
|||
login_as :admin_user
|
||||
get :show, { :id => "0", :format => 'xml' }
|
||||
assert_response 404
|
||||
assert_xml_select 'error', 'Context not found'
|
||||
assert_select 'error', 'Context not found'
|
||||
end
|
||||
|
||||
# RSS
|
||||
|
|
@ -107,7 +110,7 @@ class ContextsControllerTest < ActionController::TestCase
|
|||
assert_equal 'application/rss+xml', @response.content_type
|
||||
#puts @response.body
|
||||
|
||||
assert_xml_select 'rss[version="2.0"]' do
|
||||
assert_select 'rss[version="2.0"]' do
|
||||
assert_select 'channel' do
|
||||
assert_select '>title', 'Tracks Contexts'
|
||||
assert_select '>description', "Lists all the contexts for #{users(:admin_user).display_name}"
|
||||
|
|
@ -118,7 +121,7 @@ class ContextsControllerTest < ActionController::TestCase
|
|||
assert_select 'title', /.+/
|
||||
assert_select 'description' do
|
||||
assert_select_encoded do
|
||||
assert_select 'p', /\d+ actions. Context is (Active|Hidden)./
|
||||
assert_select 'p', /\d+#{nbsp}actions. Context is (Active|Hidden)./
|
||||
end
|
||||
end
|
||||
%w(guid link).each do |node|
|
||||
|
|
@ -153,16 +156,15 @@ class ContextsControllerTest < ActionController::TestCase
|
|||
login_as :admin_user
|
||||
get :index, { :format => "atom" }
|
||||
assert_equal 'application/atom+xml', @response.content_type
|
||||
#puts @response.body
|
||||
|
||||
assert_xml_select 'feed[xmlns="http://www.w3.org/2005/Atom"]' do
|
||||
assert_equal 'http://www.w3.org/2005/Atom', html_document.children[0].namespace.href
|
||||
assert_select 'feed' do
|
||||
assert_select '>title', 'Tracks Contexts'
|
||||
assert_select '>subtitle', "Lists all the contexts for #{users(:admin_user).display_name}"
|
||||
assert_select 'entry', 10 do
|
||||
assert_select 'title', /.+/
|
||||
assert_select 'content[type="html"]' do
|
||||
assert_select_encoded do
|
||||
assert_select 'p', /\d+ actions. Context is (Active|Hidden)./
|
||||
assert_select 'p', /\d+#{nbsp}actions. Context is (Active|Hidden)./
|
||||
end
|
||||
end
|
||||
assert_select 'published', /(#{Regexp.escape(contexts(:agenda).created_at.xmlschema)}|#{Regexp.escape(contexts(:library).created_at.xmlschema)})/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
require 'test_helper'
|
||||
require 'support/stub_site_config_helper'
|
||||
|
||||
class IntegrationsControllerTest < ActionController::TestCase
|
||||
include StubSiteConfigHelper
|
||||
|
||||
def setup
|
||||
end
|
||||
|
|
@ -12,6 +14,7 @@ class IntegrationsControllerTest < ActionController::TestCase
|
|||
end
|
||||
|
||||
def test_cloudmailin_integration_success
|
||||
stub_site_config do
|
||||
SITE_CONFIG['cloudmailin'] = "123456789"
|
||||
SITE_CONFIG['email_dispatch'] = 'from'
|
||||
post :cloudmailin, {
|
||||
|
|
@ -29,8 +32,10 @@ class IntegrationsControllerTest < ActionController::TestCase
|
|||
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
|
||||
def test_cloudmailin_integration_invalid_signature
|
||||
stub_site_config do
|
||||
SITE_CONFIG['cloudmailin'] = "12345678901234567890"
|
||||
post :cloudmailin, {
|
||||
"html"=>"",
|
||||
|
|
@ -47,8 +52,10 @@ class IntegrationsControllerTest < ActionController::TestCase
|
|||
|
||||
assert_response 403
|
||||
end
|
||||
end
|
||||
|
||||
def test_cloudmailin_integration_unknown_address
|
||||
stub_site_config do
|
||||
SITE_CONFIG['cloudmailin'] = "123456789"
|
||||
post :cloudmailin, {
|
||||
"html"=>"",
|
||||
|
|
@ -65,5 +72,6 @@ class IntegrationsControllerTest < ActionController::TestCase
|
|||
|
||||
assert_response 404
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
require 'test_helper'
|
||||
require 'support/stub_site_config_helper'
|
||||
|
||||
class MailgunControllerTest < ActionController::TestCase
|
||||
include StubSiteConfigHelper
|
||||
|
||||
def setup
|
||||
@user = users(:sms_user)
|
||||
|
|
@ -12,6 +14,7 @@ class MailgunControllerTest < ActionController::TestCase
|
|||
end
|
||||
|
||||
def test_mailgun_signature_verifies
|
||||
stub_site_config do
|
||||
SITE_CONFIG['mailgun_api_key'] = "123456789"
|
||||
SITE_CONFIG['email_dispatch'] = 'from'
|
||||
|
||||
|
|
@ -24,8 +27,10 @@ class MailgunControllerTest < ActionController::TestCase
|
|||
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
|
||||
def test_mailgun_creates_todo_with_mailmap
|
||||
stub_site_config do
|
||||
SITE_CONFIG['mailgun_api_key'] = "123456789"
|
||||
SITE_CONFIG['email_dispatch'] = 'to'
|
||||
SITE_CONFIG['mailmap'] = {
|
||||
|
|
@ -48,8 +53,10 @@ class MailgunControllerTest < ActionController::TestCase
|
|||
assert_equal(@inbox, message_todo.context)
|
||||
assert_equal(@user, message_todo.user)
|
||||
end
|
||||
end
|
||||
|
||||
def test_mailgun_signature_fails
|
||||
stub_site_config do
|
||||
SITE_CONFIG['mailgun_api_key'] = "invalidkey"
|
||||
SITE_CONFIG['email_dispatch'] = 'from'
|
||||
|
||||
|
|
@ -62,5 +69,6 @@ class MailgunControllerTest < ActionController::TestCase
|
|||
|
||||
assert_response 406
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
require 'test_helper'
|
||||
require 'support/html_entity_helper'
|
||||
|
||||
class ProjectsControllerTest < ActionController::TestCase
|
||||
include HTMLEntityHelper
|
||||
|
||||
def setup
|
||||
end
|
||||
|
|
@ -83,7 +85,7 @@ class ProjectsControllerTest < ActionController::TestCase
|
|||
assert_equal 'application/rss+xml', @response.content_type
|
||||
#puts @response.body
|
||||
|
||||
assert_xml_select 'rss[version="2.0"]' do
|
||||
assert_select 'rss[version="2.0"]' do
|
||||
assert_select 'channel' do
|
||||
assert_select '>title', 'Tracks Projects'
|
||||
assert_select '>description', "Lists all the projects for #{users(:admin_user).display_name}"
|
||||
|
|
@ -94,7 +96,7 @@ class ProjectsControllerTest < ActionController::TestCase
|
|||
assert_select 'title', /.+/
|
||||
assert_select 'description' do
|
||||
assert_select_encoded do
|
||||
assert_select 'p', /^\d+ actions\. Project is (active|hidden|completed)\.$/
|
||||
assert_select 'p', /^\d+#{nbsp}actions\. Project is (active|hidden|completed)\.$/
|
||||
end
|
||||
end
|
||||
%w(guid link).each do |node|
|
||||
|
|
@ -127,16 +129,15 @@ class ProjectsControllerTest < ActionController::TestCase
|
|||
login_as :admin_user
|
||||
get :index, { :format => "atom" }
|
||||
assert_equal 'application/atom+xml', @response.content_type
|
||||
# puts @response.body
|
||||
|
||||
assert_xml_select 'feed[xmlns="http://www.w3.org/2005/Atom"]' do
|
||||
assert_equal 'http://www.w3.org/2005/Atom', html_document.children[0].namespace.href
|
||||
assert_select 'feed' do
|
||||
assert_select '>title', 'Tracks Projects'
|
||||
assert_select '>subtitle', "Lists all the projects for #{users(:admin_user).display_name}"
|
||||
assert_select 'entry', 3 do
|
||||
assert_select 'title', /.+/
|
||||
assert_select 'content[type="html"]' do
|
||||
assert_select_encoded do
|
||||
assert_select 'p', /\d+ actions. Project is (active|hidden|completed)./
|
||||
assert_select 'p', /\d+#{nbsp}actions. Project is (active|hidden|completed)./
|
||||
end
|
||||
end
|
||||
assert_select 'published', /(#{Regexp.escape(projects(:timemachine).updated_at.xmlschema)}|#{Regexp.escape(projects(:moremoney).updated_at.xmlschema)})/
|
||||
|
|
@ -239,7 +240,7 @@ class ProjectsControllerTest < ActionController::TestCase
|
|||
get :index, { :format => "xml" }
|
||||
assert_equal 'application/xml', @response.content_type
|
||||
|
||||
assert_xml_select 'projects' do
|
||||
assert_select 'projects' do
|
||||
assert_select 'project', 3 do
|
||||
assert_select 'name', /.+/
|
||||
assert_select 'state', 'active'
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
require 'test_helper'
|
||||
|
||||
class TodosControllerTest < ActionController::TestCase
|
||||
|
||||
def test_get_index_when_not_logged_in
|
||||
get :index
|
||||
assert_redirected_to login_url
|
||||
|
|
@ -235,8 +234,8 @@ class TodosControllerTest < ActionController::TestCase
|
|||
"project_name"=>"Build a working time machine",
|
||||
"todo"=>{"notes"=>"", "description"=>"Call Warren Buffet to find out how much he makes per day", "due"=>"30/11/2006"}, "tag_list"=>"foo bar" }
|
||||
assert_response 409
|
||||
assert_xml_select "errors" do
|
||||
assert_xml_select "error", "Context can't be blank"
|
||||
assert_select "errors" do
|
||||
assert_select "error", "Context can't be blank"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -467,7 +466,7 @@ class TodosControllerTest < ActionController::TestCase
|
|||
assert_equal 'application/rss+xml', @response.content_type
|
||||
# puts @response.body
|
||||
|
||||
assert_xml_select 'rss[version="2.0"]' do
|
||||
assert_select 'rss[version="2.0"]' do
|
||||
assert_select 'channel' do
|
||||
assert_select '>title', 'Tracks Actions'
|
||||
assert_select '>description', "Actions for #{users(:admin_user).display_name}"
|
||||
|
|
@ -488,7 +487,7 @@ class TodosControllerTest < ActionController::TestCase
|
|||
login_as(:admin_user)
|
||||
get :index, { :format => "rss", :limit => '5' }
|
||||
|
||||
assert_xml_select 'rss[version="2.0"]' do
|
||||
assert_select 'rss[version="2.0"]' do
|
||||
assert_select 'channel' do
|
||||
assert_select '>title', 'Tracks Actions'
|
||||
assert_select '>description', "Actions for #{users(:admin_user).display_name}"
|
||||
|
|
@ -522,15 +521,14 @@ class TodosControllerTest < ActionController::TestCase
|
|||
login_as :admin_user
|
||||
get :index, { :format => "atom" }
|
||||
assert_equal 'application/atom+xml', @response.content_type
|
||||
# #puts @response.body
|
||||
|
||||
assert_xml_select 'feed[xmlns="http://www.w3.org/2005/Atom"]' do
|
||||
assert_xml_select '>title', 'Tracks Actions'
|
||||
assert_xml_select '>subtitle', "Actions for #{users(:admin_user).display_name}"
|
||||
assert_xml_select 'entry', 17 do
|
||||
assert_xml_select 'title', /.+/
|
||||
assert_xml_select 'content[type="html"]', /.*/
|
||||
assert_xml_select 'published', /(#{Regexp.escape(todos(:book).updated_at.xmlschema)}|#{Regexp.escape(projects(:moremoney).updated_at.xmlschema)})/
|
||||
assert_equal 'http://www.w3.org/2005/Atom', html_document.children[0].namespace.href
|
||||
assert_select 'feed' do
|
||||
assert_select '>title', 'Tracks Actions'
|
||||
assert_select '>subtitle', "Actions for #{users(:admin_user).display_name}"
|
||||
assert_select 'entry', 17 do
|
||||
assert_select 'title', /.+/
|
||||
assert_select 'content[type="html"]', /.*/
|
||||
assert_select 'published', /(#{Regexp.escape(todos(:book).updated_at.xmlschema)}|#{Regexp.escape(projects(:moremoney).updated_at.xmlschema)})/
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -846,7 +844,7 @@ class TodosControllerTest < ActionController::TestCase
|
|||
todo.notes = "foo #{url} bar"
|
||||
todo.save!
|
||||
get :index
|
||||
assert_select "a[href=#{url}]"
|
||||
assert_select "a[href='#{url}']"
|
||||
end
|
||||
|
||||
def test_link_opened_in_new_window
|
||||
|
|
@ -886,7 +884,7 @@ class TodosControllerTest < ActionController::TestCase
|
|||
todo.save!
|
||||
get :index
|
||||
assert_select("div#notes_todo_#{todo.id}", 'A link to http://github.com/.')
|
||||
assert_select("div#notes_todo_#{todo.id} a[href=http://github.com/]", 'http://github.com/')
|
||||
assert_select("div#notes_todo_#{todo.id} a[href='http://github.com/']", 'http://github.com/')
|
||||
end
|
||||
|
||||
def test_format_note_link_message
|
||||
|
|
@ -895,9 +893,9 @@ class TodosControllerTest < ActionController::TestCase
|
|||
todo.raw_notes = "A Mail.app message://<ABCDEF-GHADB-123455-FOO-BAR@example.com> link"
|
||||
todo.save!
|
||||
get :index
|
||||
assert_select("div#notes_todo_#{todo.id}", 'A Mail.app message://<ABCDEF-GHADB-123455-FOO-BAR@example.com> link')
|
||||
assert_select("div#notes_todo_#{todo.id} a", 'message://<ABCDEF-GHADB-123455-FOO-BAR@example.com>')
|
||||
assert_select("div#notes_todo_#{todo.id} a[href=message://<ABCDEF-GHADB-123455-FOO-BAR@example.com>]", 'message://<ABCDEF-GHADB-123455-FOO-BAR@example.com>')
|
||||
assert_select("div#notes_todo_#{todo.id}", 'A Mail.app message://<ABCDEF-GHADB-123455-FOO-BAR@example.com> link')
|
||||
assert_select("div#notes_todo_#{todo.id} a", 'message://<ABCDEF-GHADB-123455-FOO-BAR@example.com>')
|
||||
assert_select("div#notes_todo_#{todo.id} a[href='message://<ABCDEF-GHADB-123455-FOO-BAR@example.com>']", "message://<ABCDEF-GHADB-123455-FOO-BAR@example.com>")
|
||||
end
|
||||
|
||||
def test_format_note_link_onenote
|
||||
|
|
@ -908,7 +906,7 @@ class TodosControllerTest < ActionController::TestCase
|
|||
get :index
|
||||
assert_select("div#notes_todo_#{todo.id}", 'link me to onenote')
|
||||
assert_select("div#notes_todo_#{todo.id} a", 'link me to onenote')
|
||||
assert_select("div#notes_todo_#{todo.id} a[href=onenote:///E:%5COneNote%5Cdir%5Cnotes.one#PAGE&section-id=%7BFD597D3A-3793-495F-8345-23D34A00DD3B%7D&page-id=%7B1C95A1C7-6408-4804-B3B5-96C28426022B%7D&end]", 'link me to onenote')
|
||||
assert_select("div#notes_todo_#{todo.id} a[href='onenote:///E:%5COneNote%5Cdir%5Cnotes.one#PAGE§ion-id=%7BFD597D3A-3793-495F-8345-23D34A00DD3B%7D&page-id=%7B1C95A1C7-6408-4804-B3B5-96C28426022B%7D&end']", 'link me to onenote')
|
||||
end
|
||||
|
||||
##############
|
||||
|
|
|
|||
|
|
@ -5,23 +5,23 @@ class TodosHelpersTest < ActionView::TestCase
|
|||
|
||||
test "remote_edit_button" do
|
||||
html = remote_edit_button(todos(:call_bill))
|
||||
assert_equal "<a class=\"icon edit_item\" href=\"/todos/1/edit\" id=\"icon_edit_todo_1\" title=\"Edit the action 'Call Bill Gates to find out how much he makes per day'\"><img align=\"absmiddle\" alt=\"Edit\" class=\"edit_item\" id=\"edit_icon_todo_1\" src=\"/images/blank.png\" /></a>", html
|
||||
assert_equal "<a class=\"icon edit_item\" id=\"icon_edit_todo_1\" title=\"Edit the action 'Call Bill Gates to find out how much he makes per day'\" href=\"/todos/1/edit\"><img alt=\"Edit\" align=\"absmiddle\" id=\"edit_icon_todo_1\" class=\"edit_item\" src=\"/images/blank.png\" /></a>", html
|
||||
end
|
||||
|
||||
test "remote_delete_menu" do
|
||||
html = remote_delete_menu_item(todos(:call_bill))
|
||||
assert_equal "<a class=\"icon_delete_item\" href=\"/todos/1\" id=\"delete_todo_1\" title=\"Delete action\" x_confirm_message=\"Are you sure that you want to delete the action 'Call Bill Gates to find out how much he makes per day'?\">Delete</a>", html
|
||||
assert_equal "<a class=\"icon_delete_item\" id=\"delete_todo_1\" x_confirm_message=\"Are you sure that you want to delete the action 'Call Bill Gates to find out how much he makes per day'?\" title=\"Delete action\" href=\"/todos/1\">Delete</a>", html
|
||||
end
|
||||
|
||||
test "remote_delete_dependency" do
|
||||
todo = todos(:call_bill_gates_every_day)
|
||||
predecessor = todos(:call_bill)
|
||||
html = remote_delete_dependency(todo, predecessor)
|
||||
assert_equal "<a class=\"delete_dependency_button\" href=\"/todos/18/remove_predecessor\" x_predecessors_id=\"1\"><img align=\"absmiddle\" alt=\"Blank\" class=\"delete_item\" src=\"/images/blank.png\" title=\"Remove dependency (does not delete the action)\" /></a>", html
|
||||
assert_equal "<a class=\"delete_dependency_button\" x_predecessors_id=\"1\" href=\"/todos/18/remove_predecessor\"><img title=\"Remove dependency (does not delete the action)\" align=\"absmiddle\" class=\"delete_item\" src=\"/images/blank.png\" alt=\"Blank\" /></a>", html
|
||||
end
|
||||
|
||||
test "remote_promote_to_project_menu_item" do
|
||||
html = remote_promote_to_project_menu_item(todos(:call_bill))
|
||||
assert_equal "<a class=\"icon_item_to_project\" href=\"/todos/1/convert_to_project?_source_view=\" id=\"to_project_todo_1\">Make project</a>", html
|
||||
assert_equal "<a class=\"icon_item_to_project\" id=\"to_project_todo_1\" href=\"/todos/1/convert_to_project?_source_view=\">Make project</a>", html
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,11 +6,12 @@ class ProjectXmlApiTest < ActionDispatch::IntegrationTest
|
|||
|
||||
def test_retrieve_project
|
||||
authenticated_get_xml "/projects/1.xml", users(:admin_user).login, 'abracadabra', {}
|
||||
assert_tag :tag => "project"
|
||||
assert_tag :tag => "project", :child => {:tag => "not_done" }
|
||||
assert_tag :tag => "project", :child => {:tag => "deferred" }
|
||||
assert_tag :tag => "project", :child => {:tag => "pending" }
|
||||
assert_tag :tag => "project", :child => {:tag => "done" }
|
||||
assert_select 'project' do
|
||||
assert_select 'not_done'
|
||||
assert_select 'deferred'
|
||||
assert_select 'pending'
|
||||
assert_select 'done'
|
||||
end
|
||||
assert_response 200
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
require 'test_helper'
|
||||
require 'support/stub_site_config_helper'
|
||||
|
||||
class StoriesTest < ActionDispatch::IntegrationTest
|
||||
include StubSiteConfigHelper
|
||||
|
||||
# ####################################################
|
||||
# Testing login and signup by different kinds of users
|
||||
|
|
@ -14,12 +16,15 @@ class StoriesTest < ActionDispatch::IntegrationTest
|
|||
end
|
||||
|
||||
def test_signup_new_user_by_nonadmin
|
||||
stub_site_config do
|
||||
SITE_CONFIG['open_signups'] = false
|
||||
other_user = new_session_as(:other_user,"sesame")
|
||||
other_user.goes_to_signup_as_nonadmin
|
||||
end
|
||||
end
|
||||
|
||||
def test_open_signup_new_user
|
||||
stub_site_config do
|
||||
SITE_CONFIG['open_signups'] = true
|
||||
get "/signup"
|
||||
assert_response :success
|
||||
|
|
@ -32,6 +37,7 @@ class StoriesTest < ActionDispatch::IntegrationTest
|
|||
assert_response :success
|
||||
assert_template "todos/index"
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
|
|
|||
|
|
@ -24,12 +24,14 @@ class TodoXmlApiTest < ActionDispatch::IntegrationTest
|
|||
def test_get_tickler_returns_all_deferred_and_pending_todos
|
||||
number = @user.todos.deferred.count + @user.todos.pending.count
|
||||
authenticated_get_xml "/tickler.xml", @user.login, @password, {}
|
||||
assert_tag :tag => "todos", :children => { :count => number }
|
||||
assert_select 'todos' do
|
||||
assert_select 'todo', count: number
|
||||
end
|
||||
end
|
||||
|
||||
def test_get_tickler_omits_user_id
|
||||
authenticated_get_xml "/tickler.xml", @user.login, @password, {}
|
||||
assert_no_tag :tag => "user_id"
|
||||
assert_select 'user_id', false
|
||||
end
|
||||
|
||||
def test_get_index_with_only_active_todos
|
||||
|
|
@ -245,7 +247,7 @@ class TodoXmlApiTest < ActionDispatch::IntegrationTest
|
|||
<project_id type='integer'>-11</project_id>
|
||||
</todo>"
|
||||
assert_response 409
|
||||
assert_xml_select 'errors' do
|
||||
assert_select 'errors' do
|
||||
assert_select 'error', 2
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -69,16 +69,17 @@ class UsersXmlApiTest < ActionDispatch::IntegrationTest
|
|||
def test_get_users_as_xml
|
||||
get '/users.xml', {}, basic_auth_headers()
|
||||
assert_response :success
|
||||
assert_tag :tag => "users",
|
||||
:children => { :count => 4, :only => { :tag => "user" } }
|
||||
assert_no_tag :tag => "password"
|
||||
assert_select 'users' do
|
||||
assert_select 'user', count: 4
|
||||
end
|
||||
assert_select 'password', false
|
||||
end
|
||||
|
||||
def test_get_user_as_xml
|
||||
get "/users/#{users(:other_user).id}.xml", {}, basic_auth_headers()
|
||||
assert_response :success
|
||||
assert_tag :tag => "user"
|
||||
assert_no_tag :tag => "password"
|
||||
assert_select 'user'
|
||||
assert_select 'password', false
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
11
test/support/html_entity_helper.rb
Normal file
11
test/support/html_entity_helper.rb
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
require 'htmlentities'
|
||||
|
||||
module HTMLEntityHelper
|
||||
def entity(name)
|
||||
HTMLEntities.new.decode("&#{name};")
|
||||
end
|
||||
|
||||
def nbsp
|
||||
entity('nbsp')
|
||||
end
|
||||
end
|
||||
9
test/support/stub_site_config_helper.rb
Normal file
9
test/support/stub_site_config_helper.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
require 'minitest/stub_const'
|
||||
|
||||
module StubSiteConfigHelper
|
||||
def stub_site_config
|
||||
Object.stub_const(:SITE_CONFIG, SITE_CONFIG.clone) do
|
||||
yield
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -56,15 +56,6 @@ class ActiveSupport::TestCase
|
|||
def assert_equal_dmy(date1, date2)
|
||||
assert_equal date1.strftime("%d-%m-%y"), date2.strftime("%d-%m-%y")
|
||||
end
|
||||
|
||||
def xml_document
|
||||
@xml_document ||= HTML::Document.new(@response.body, false, true)
|
||||
end
|
||||
|
||||
def assert_xml_select(*args, &block)
|
||||
@html_document = xml_document
|
||||
assert_select(*args, &block)
|
||||
end
|
||||
end
|
||||
|
||||
class ActionController::TestCase
|
||||
|
|
@ -90,11 +81,6 @@ class ActionController::TestCase
|
|||
xhr :post, :create, get_model_class.downcase => {:name => name}
|
||||
end
|
||||
|
||||
def assert_xml_select(*args, &block)
|
||||
@html_document = xml_document
|
||||
assert_select(*args, &block)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def get_model_class
|
||||
|
|
@ -145,7 +131,7 @@ class ActionDispatch::IntegrationTest
|
|||
|
||||
def assert_responses_with_error(error_msg)
|
||||
assert_response 409
|
||||
assert_xml_select 'errors' do
|
||||
assert_select 'errors' do
|
||||
assert_select 'error', 1, error_msg
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue