mirror of
https://github.com/TracksApp/tracks.git
synced 2025-09-22 05:50:47 +02:00
Merge pull request #2467 from TracksApp/test_on_all_supported
Run tests on all supported platforms
This commit is contained in:
commit
d99361bb3f
20 changed files with 262 additions and 22 deletions
33
.github/workflows/continuous-integration.yml
vendored
33
.github/workflows/continuous-integration.yml
vendored
|
@ -1,11 +1,38 @@
|
||||||
---
|
---
|
||||||
name: Continuous Integration
|
name: Automated tests
|
||||||
|
|
||||||
on: pull_request
|
on: pull_request
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test25mysql:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- run: bash -x script/cibuild
|
- run: bash -x script/cibuild 2.5 mysql
|
||||||
|
|
||||||
|
test26mysql:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- run: bash -x script/cibuild 2.6 mysql
|
||||||
|
|
||||||
|
test27mysql:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- run: bash -x script/cibuild 2.7 mysql
|
||||||
|
|
||||||
|
test26postgres:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- run: bash -x script/cibuild 2.6 postgres
|
||||||
|
|
||||||
|
test26sqlite:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- run: bash -x script/cibuild 2.6 sqlite
|
||||||
|
|
||||||
|
# - run: bash -x script/cibuild 2.5 postgres
|
||||||
|
# - run: bash -x script/cibuild 2.7 postgres
|
||||||
|
|
30
Dockerfile-2.5
Normal file
30
Dockerfile-2.5
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
FROM ruby:2.5
|
||||||
|
|
||||||
|
# throw errors if Gemfile has been modified since Gemfile.lock
|
||||||
|
RUN bundle config --global frozen 1
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN touch /etc/app-env
|
||||||
|
|
||||||
|
COPY Gemfile* /app/
|
||||||
|
RUN gem install bundler
|
||||||
|
RUN bundle install --jobs 4
|
||||||
|
|
||||||
|
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
||||||
|
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
|
||||||
|
RUN apt-get update && apt-get install -y yarn
|
||||||
|
|
||||||
|
RUN mkdir /app/log
|
||||||
|
|
||||||
|
COPY . /app/
|
||||||
|
COPY config/database.docker.yml /app/config/database.yml
|
||||||
|
COPY config/site.docker.yml /app/config/site.yml
|
||||||
|
|
||||||
|
RUN RAILS_ENV=production bundle exec rake assets:precompile
|
||||||
|
|
||||||
|
ENTRYPOINT ["/app/docker-entrypoint.sh"]
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
CMD ["rails", "server", "-b", "0.0.0.0"]
|
30
Dockerfile-2.7
Normal file
30
Dockerfile-2.7
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
FROM ruby:2.7
|
||||||
|
|
||||||
|
# throw errors if Gemfile has been modified since Gemfile.lock
|
||||||
|
RUN bundle config --global frozen 1
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN touch /etc/app-env
|
||||||
|
|
||||||
|
COPY Gemfile* /app/
|
||||||
|
RUN gem install bundler
|
||||||
|
RUN bundle install --jobs 4
|
||||||
|
|
||||||
|
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
||||||
|
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
|
||||||
|
RUN apt-get update && apt-get install -y yarn
|
||||||
|
|
||||||
|
RUN mkdir /app/log
|
||||||
|
|
||||||
|
COPY . /app/
|
||||||
|
COPY config/database.docker.yml /app/config/database.yml
|
||||||
|
COPY config/site.docker.yml /app/config/site.yml
|
||||||
|
|
||||||
|
RUN RAILS_ENV=production bundle exec rake assets:precompile
|
||||||
|
|
||||||
|
ENTRYPOINT ["/app/docker-entrypoint.sh"]
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
CMD ["rails", "server", "-b", "0.0.0.0"]
|
2
Gemfile
2
Gemfile
|
@ -24,6 +24,7 @@ gem 'jquery-ui-rails' , '~>6.0.1'
|
||||||
# Alternatively use --without <group> arguments to bundler to not install that group
|
# Alternatively use --without <group> arguments to bundler to not install that group
|
||||||
gem "sqlite3", group: :sqlite
|
gem "sqlite3", group: :sqlite
|
||||||
gem "mysql2", "~> 0.5.3", group: :mysql
|
gem "mysql2", "~> 0.5.3", group: :mysql
|
||||||
|
gem "pg", "~> 1.2.3", group: :postgresql
|
||||||
|
|
||||||
gem "RedCloth"
|
gem "RedCloth"
|
||||||
gem "sanitize", "~> 5.2"
|
gem "sanitize", "~> 5.2"
|
||||||
|
@ -70,7 +71,6 @@ group :test do
|
||||||
gem 'rails-controller-testing'
|
gem 'rails-controller-testing'
|
||||||
gem 'rails-dom-testing', '~> 2.0.0'
|
gem 'rails-dom-testing', '~> 2.0.0'
|
||||||
|
|
||||||
|
|
||||||
gem "factory_bot_rails"
|
gem "factory_bot_rails"
|
||||||
gem "rspec-expectations"
|
gem "rspec-expectations"
|
||||||
gem "database_cleaner"
|
gem "database_cleaner"
|
||||||
|
|
|
@ -165,6 +165,7 @@ GEM
|
||||||
parallel (1.19.2)
|
parallel (1.19.2)
|
||||||
parser (2.7.1.4)
|
parser (2.7.1.4)
|
||||||
ast (~> 2.4.1)
|
ast (~> 2.4.1)
|
||||||
|
pg (1.2.3)
|
||||||
puma (4.3.5)
|
puma (4.3.5)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
rack (2.2.3)
|
rack (2.2.3)
|
||||||
|
@ -326,6 +327,7 @@ DEPENDENCIES
|
||||||
mocha
|
mocha
|
||||||
mysql2 (~> 0.5.3)
|
mysql2 (~> 0.5.3)
|
||||||
paperclip
|
paperclip
|
||||||
|
pg (~> 1.2.3)
|
||||||
puma (~> 4.3)
|
puma (~> 4.3)
|
||||||
rack-mini-profiler
|
rack-mini-profiler
|
||||||
rails (~> 6.0.3)
|
rails (~> 6.0.3)
|
||||||
|
|
|
@ -766,7 +766,7 @@ class TodosController < ApplicationController
|
||||||
|
|
||||||
def get_not_completed_for_predecessor(relation, todo_id=nil)
|
def get_not_completed_for_predecessor(relation, todo_id=nil)
|
||||||
items = relation.todos.not_completed.
|
items = relation.todos.not_completed.
|
||||||
where('(LOWER(todos.description) LIKE ?)', "%#{params[:term].downcase}%")
|
where('(LOWER(todos.description) ' + Common.like_operator + '?)', "%#{params[:term].downcase}%")
|
||||||
items = items.where("AND NOT(todos.id=?)", todo_id) unless todo_id.nil?
|
items = items.where("AND NOT(todos.id=?)", todo_id) unless todo_id.nil?
|
||||||
|
|
||||||
items.
|
items.
|
||||||
|
|
|
@ -7,7 +7,7 @@ class Context < ApplicationRecord
|
||||||
scope :active, -> { where state: :active }
|
scope :active, -> { where state: :active }
|
||||||
scope :hidden, -> { where state: :hidden }
|
scope :hidden, -> { where state: :hidden }
|
||||||
scope :closed, -> { where state: :closed }
|
scope :closed, -> { where state: :closed }
|
||||||
scope :with_name, lambda { |name| where("name LIKE ?", name) }
|
scope :with_name, lambda { |name| where("name " + Common.like_operator + " ?", name) }
|
||||||
|
|
||||||
acts_as_list :scope => :user, :top_of_list => 0
|
acts_as_list :scope => :user, :top_of_list => 0
|
||||||
|
|
||||||
|
|
|
@ -2,5 +2,5 @@ class Note < ApplicationRecord
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
belongs_to :project
|
belongs_to :project
|
||||||
|
|
||||||
scope :with_body, lambda { |terms| where("body LIKE ?", terms) }
|
scope :with_body, lambda { |terms| where("body " + Common.like_operator + " ?", terms) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,8 +11,8 @@ class Project < ApplicationRecord
|
||||||
scope :completed, -> { where state: 'completed' }
|
scope :completed, -> { where state: 'completed' }
|
||||||
scope :uncompleted, -> { where("NOT(state = ?)", 'completed') }
|
scope :uncompleted, -> { where("NOT(state = ?)", 'completed') }
|
||||||
|
|
||||||
scope :with_name_or_description, lambda { |body| where("name LIKE ? OR description LIKE ?", body, body) }
|
scope :with_name_or_description, lambda { |body| where("name " + Common.like_operator + " ? OR description " + Common.like_operator + " ?", body, body) }
|
||||||
scope :with_namepart, lambda { |body| where("name LIKE ?", body + '%') }
|
scope :with_namepart, lambda { |body| where("name " + Common.like_operator + " ?", body + '%') }
|
||||||
|
|
||||||
before_create :set_last_reviewed_now
|
before_create :set_last_reviewed_now
|
||||||
|
|
||||||
|
|
|
@ -27,14 +27,14 @@ module Search
|
||||||
|
|
||||||
def incomplete_todos(terms)
|
def incomplete_todos(terms)
|
||||||
@user.todos.
|
@user.todos.
|
||||||
where("(todos.description LIKE ? OR todos.notes LIKE ?) AND todos.completed_at IS NULL", terms, terms).
|
where("(todos.description " + Common.like_operator + " ? OR todos.notes " + Common.like_operator + " ?) AND todos.completed_at IS NULL", terms, terms).
|
||||||
includes(Todo::DEFAULT_INCLUDES).
|
includes(Todo::DEFAULT_INCLUDES).
|
||||||
reorder(Arel.sql("todos.due IS NULL, todos.due ASC, todos.created_at ASC"))
|
reorder(Arel.sql("todos.due IS NULL, todos.due ASC, todos.created_at ASC"))
|
||||||
end
|
end
|
||||||
|
|
||||||
def complete_todos(terms)
|
def complete_todos(terms)
|
||||||
@user.todos.
|
@user.todos.
|
||||||
where("(todos.description LIKE ? OR todos.notes LIKE ?) AND NOT (todos.completed_at IS NULL)", terms, terms).
|
where("(todos.description " + Common.like_operator + " ? OR todos.notes " + Common.like_operator + " ?) AND NOT (todos.completed_at IS NULL)", terms, terms).
|
||||||
includes(Todo::DEFAULT_INCLUDES).
|
includes(Todo::DEFAULT_INCLUDES).
|
||||||
reorder("todos.completed_at DESC")
|
reorder("todos.completed_at DESC")
|
||||||
end
|
end
|
||||||
|
@ -46,7 +46,7 @@ module Search
|
||||||
"LEFT JOIN taggings ON tags.id = taggings.tag_id "+
|
"LEFT JOIN taggings ON tags.id = taggings.tag_id "+
|
||||||
"LEFT JOIN todos ON taggings.taggable_id = todos.id "+
|
"LEFT JOIN todos ON taggings.taggable_id = todos.id "+
|
||||||
"WHERE todos.user_id=? "+
|
"WHERE todos.user_id=? "+
|
||||||
"AND tags.name LIKE ? ", @user.id, terms])
|
"AND tags.name " + Common.like_operator + " ? ", @user.id, terms])
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,4 +6,14 @@ module Common
|
||||||
@user_theme = SITE_CONFIG['default_theme'] || 'light_blue'
|
@user_theme = SITE_CONFIG['default_theme'] || 'light_blue'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.like_operator
|
||||||
|
# This is something of a hack to use the correct operator for Pg
|
||||||
|
if ActiveRecord::Base.connection.adapter_name.downcase.to_sym == :postgresql
|
||||||
|
like = 'ILIKE'
|
||||||
|
else
|
||||||
|
like = 'LIKE'
|
||||||
|
end
|
||||||
|
return like
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
docker_compose="docker-compose --file docker-compose.yml"
|
docker_compose="docker-compose --file test-envs/docker-compose-$1-$2.yml"
|
||||||
|
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
$docker_compose down
|
$docker_compose down
|
||||||
|
@ -25,6 +25,12 @@ script/poll-for-db
|
||||||
# Leaving this in since it will be needed for Rails 5
|
# Leaving this in since it will be needed for Rails 5
|
||||||
$docker_compose run web bin/rails db:environment:set RAILS_ENV=test || true
|
$docker_compose run web bin/rails db:environment:set RAILS_ENV=test || true
|
||||||
|
|
||||||
$docker_compose run web bin/rake db:reset
|
if [ "$2" == "mysql" ];
|
||||||
|
then
|
||||||
|
$docker_compose run web bin/rake db:reset
|
||||||
|
else
|
||||||
|
$docker_compose run web bin/rake db:migrate
|
||||||
|
$docker_compose run web bin/rake db:seed
|
||||||
|
fi
|
||||||
$docker_compose run web bin/rake test
|
$docker_compose run web bin/rake test
|
||||||
|
|
||||||
|
|
29
test-envs/docker-compose-2.5-mysql.yml
Normal file
29
test-envs/docker-compose-2.5-mysql.yml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: mysql:5.7
|
||||||
|
environment:
|
||||||
|
MYSQL_ALLOW_EMPTY_PASSWORD: 1
|
||||||
|
MYSQL_DATABASE: ${TRACKS_DB:-tracks}
|
||||||
|
volumes:
|
||||||
|
- db-data:/var/lib/mysql
|
||||||
|
web:
|
||||||
|
build:
|
||||||
|
context: ..
|
||||||
|
dockerfile: Dockerfile-2.5
|
||||||
|
environment:
|
||||||
|
# These are set in script/ci-build, so we need to pass-thru them.
|
||||||
|
RAILS_ENV: $RAILS_ENV
|
||||||
|
DATABASE_NAME: $DATABASE_NAME
|
||||||
|
DATABASE_USERNAME: root
|
||||||
|
DATABASE_PASSWORD_EMPTY: 1
|
||||||
|
volumes:
|
||||||
|
- ${VOLUME:-..}:/app:Z
|
||||||
|
- ${VOLUME:-..}/config/database.docker.yml:/app/config/database.yml:Z
|
||||||
|
- ${VOLUME:-..}/config/site.docker.yml:/app/config/site.yml:Z
|
||||||
|
ports:
|
||||||
|
- 3000:3000
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
volumes:
|
||||||
|
db-data:
|
29
test-envs/docker-compose-2.6-mysql.yml
Normal file
29
test-envs/docker-compose-2.6-mysql.yml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: mysql:5.7
|
||||||
|
environment:
|
||||||
|
MYSQL_ALLOW_EMPTY_PASSWORD: 1
|
||||||
|
MYSQL_DATABASE: ${TRACKS_DB:-tracks}
|
||||||
|
volumes:
|
||||||
|
- db-data:/var/lib/mysql
|
||||||
|
web:
|
||||||
|
build:
|
||||||
|
context: ..
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
environment:
|
||||||
|
# These are set in script/ci-build, so we need to pass-thru them.
|
||||||
|
RAILS_ENV: $RAILS_ENV
|
||||||
|
DATABASE_NAME: $DATABASE_NAME
|
||||||
|
DATABASE_USERNAME: root
|
||||||
|
DATABASE_PASSWORD_EMPTY: 1
|
||||||
|
volumes:
|
||||||
|
- ${VOLUME:-..}:/app:Z
|
||||||
|
- ${VOLUME:-..}/config/database.docker.yml:/app/config/database.yml:Z
|
||||||
|
- ${VOLUME:-..}/config/site.docker.yml:/app/config/site.yml:Z
|
||||||
|
ports:
|
||||||
|
- 3000:3000
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
volumes:
|
||||||
|
db-data:
|
32
test-envs/docker-compose-2.6-postgres.yml
Normal file
32
test-envs/docker-compose-2.6-postgres.yml
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: postgres:13
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: ${DATABASE_NAME:-tracks}
|
||||||
|
POSTGRES_PASSWORD: password
|
||||||
|
volumes:
|
||||||
|
- db-data:/var/lib/postgresql/data
|
||||||
|
web:
|
||||||
|
build:
|
||||||
|
context: ..
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
environment:
|
||||||
|
# These are set in script/ci-build, so we need to pass-thru them.
|
||||||
|
RAILS_ENV: $RAILS_ENV
|
||||||
|
DATABASE_NAME: $DATABASE_NAME
|
||||||
|
DATABASE_USERNAME: postgres
|
||||||
|
DATABASE_PASSWORD: password
|
||||||
|
DATABASE_TYPE: postgresql
|
||||||
|
DATABASE_ENCODING: unicode
|
||||||
|
DATABASE_PORT: 5432
|
||||||
|
volumes:
|
||||||
|
- ${VOLUME:-..}:/app:Z
|
||||||
|
- ${VOLUME:-..}/config/database.docker.yml:/app/config/database.yml:Z
|
||||||
|
- ${VOLUME:-..}/config/site.docker.yml:/app/config/site.yml:Z
|
||||||
|
ports:
|
||||||
|
- 3000:3000
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
volumes:
|
||||||
|
db-data:
|
17
test-envs/docker-compose-2.6-sqlite.yml
Normal file
17
test-envs/docker-compose-2.6-sqlite.yml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
web:
|
||||||
|
build:
|
||||||
|
context: ..
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
environment:
|
||||||
|
# These are set in script/ci-build, so we need to pass-thru them.
|
||||||
|
RAILS_ENV: $RAILS_ENV
|
||||||
|
DATABASE_NAME: "/app/db.sqlite"
|
||||||
|
DATABASE_TYPE: sqlite3
|
||||||
|
volumes:
|
||||||
|
- ${VOLUME:-..}:/app:Z
|
||||||
|
- ${VOLUME:-..}/config/database.docker.yml:/app/config/database.yml:Z
|
||||||
|
- ${VOLUME:-..}/config/site.docker.yml:/app/config/site.yml:Z
|
||||||
|
ports:
|
||||||
|
- 3000:3000
|
29
test-envs/docker-compose-2.7-mysql.yml
Normal file
29
test-envs/docker-compose-2.7-mysql.yml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: mysql:5.7
|
||||||
|
environment:
|
||||||
|
MYSQL_ALLOW_EMPTY_PASSWORD: 1
|
||||||
|
MYSQL_DATABASE: ${TRACKS_DB:-tracks}
|
||||||
|
volumes:
|
||||||
|
- db-data:/var/lib/mysql
|
||||||
|
web:
|
||||||
|
build:
|
||||||
|
context: ..
|
||||||
|
dockerfile: Dockerfile-2.7
|
||||||
|
environment:
|
||||||
|
# These are set in script/ci-build, so we need to pass-thru them.
|
||||||
|
RAILS_ENV: $RAILS_ENV
|
||||||
|
DATABASE_NAME: $DATABASE_NAME
|
||||||
|
DATABASE_USERNAME: root
|
||||||
|
DATABASE_PASSWORD_EMPTY: 1
|
||||||
|
volumes:
|
||||||
|
- ${VOLUME:-..}:/app:Z
|
||||||
|
- ${VOLUME:-..}/config/database.docker.yml:/app/config/database.yml:Z
|
||||||
|
- ${VOLUME:-..}/config/site.docker.yml:/app/config/site.yml:Z
|
||||||
|
ports:
|
||||||
|
- 3000:3000
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
volumes:
|
||||||
|
db-data:
|
|
@ -1,7 +1,7 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class SearchControllerTest < ActionController::TestCase
|
class SearchControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -10,12 +10,12 @@ class SearchControllerTest < ActionController::TestCase
|
||||||
get :index
|
get :index
|
||||||
assert_response 200
|
assert_response 200
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_search_for_todo_with_tag
|
def test_search_for_todo_with_tag
|
||||||
login_as :admin_user
|
login_as :admin_user
|
||||||
post :results, params: { :search => "gates" }
|
post :results, params: { :search => "gates" }
|
||||||
assert_response 200
|
assert_response 200
|
||||||
assert_equal 3, assigns['count'], "should have found 3 todos"
|
assert_equal 3, assigns['count'], "should have found 3 todos"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -480,7 +480,6 @@ class TodosControllerTest < ActionController::TestCase
|
||||||
login_as(:admin_user)
|
login_as(:admin_user)
|
||||||
get :index, params: { :format => "rss" }
|
get :index, params: { :format => "rss" }
|
||||||
assert_equal 'application/rss+xml', @response.media_type
|
assert_equal 'application/rss+xml', @response.media_type
|
||||||
# puts @response.body
|
|
||||||
|
|
||||||
assert_select 'rss[version="2.0"]' do
|
assert_select 'rss[version="2.0"]' do
|
||||||
assert_select 'channel' do
|
assert_select 'channel' do
|
||||||
|
@ -996,7 +995,7 @@ class TodosControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
def test_format_note
|
def test_format_note
|
||||||
login_as(:admin_user)
|
login_as(:admin_user)
|
||||||
todo = users(:admin_user).todos.first
|
todo = users(:admin_user).todos.where("state='active'").first
|
||||||
todo.notes = "Normal *bold* http://foo.bar/baz"
|
todo.notes = "Normal *bold* http://foo.bar/baz"
|
||||||
todo.save!
|
todo.save!
|
||||||
get :index
|
get :index
|
||||||
|
|
|
@ -364,16 +364,16 @@ class UserTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# test group counts for projects and contexts
|
# test group counts for projects and contexts
|
||||||
project_counts = u.todos.count_by_group(:project_id)
|
project_counts = u.todos.count_by_group(:project_id)
|
||||||
assert_equal [6,3,4,4], project_counts.values
|
assert_equal [6,3,4,4].sort, project_counts.values.sort
|
||||||
|
|
||||||
context_counts = u.todos.count_by_group(:context_id)
|
context_counts = u.todos.count_by_group(:context_id)
|
||||||
assert_equal [7,3,1,3,1,2], context_counts.values
|
assert_equal [7,3,1,3,1,2].sort, context_counts.values.sort
|
||||||
|
|
||||||
# add a todo to the first context and check that the count is increased
|
# add a todo to the first context and check that the count is increased
|
||||||
u.todos.create!(:description => "yet another todo", :context => u.contexts.first)
|
u.todos.create!(:description => "yet another todo", :context => u.contexts.first)
|
||||||
|
|
||||||
context_counts = u.todos.reload.count_by_group(:context_id)
|
context_counts = u.todos.reload.count_by_group(:context_id)
|
||||||
assert_equal [8,3,1,3,1,2], context_counts.values
|
assert_equal [8,3,1,3,1,2].sort, context_counts.values.sort
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_deleting_user_deletes_all_related_data
|
def test_deleting_user_deletes_all_related_data
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue