Please enable JavaScript.
Coggle requires JavaScript to display documents.
:shinto_shrine: #tools test / debug / command line / configure (Debug…
:shinto_shrine: #tools
test / debug / command line / configure
test
BASE
falling test example
How test errors
Assets methods
test runner options
env
= Your tests are run under RAILS_ENV=test
rails test
= run all tests in application
rails test --help
ADVANCED
CAPYBARA = system tests
Database testing
Test preparation
=
rails db:test:prepare
Fixtures = test data set
=
Detail fixtures docs
test/fixtures
(generate automatically from command line)
Generate big data set
fill
db/seeds.rb
then run
jets db:seed
Integration testing
Functional testing
command line
base
new
= rails new -h
server
= rails s -h
rails server === rails s
rails s -e production
rails s -p 8889
rails s -b IP (defaul is localhost)
rails -d (deamon)
generate
rails g controller controllerName
rails g controller controllerName index send delete
rails g model Comment commenter:string body:text article:references
scaffold
is a full set of model, database migration for that model, controller to manipulate it, views to view and manipulate the data, and a test suite for each of the above
rails g scaffold HighScore game:string score:integer
rails g migration MigName
console
rails c -e staging
rails console === rails c
dbconsole
=== rails db
rails db:migrate
runner
rails runner = rails r
rails r "Model.long_running_method"
OR
rails r file.rb
rails r -e staging "Model.long_running_method"
destroy
rails destroy === rails d
contains all generates options
bundle install
=== npm i
rails
rails --help
rails about
= return data about stack and language
rails db
rails notes
= search comments beginning with FIXME, OPTIMIZE or TODO in code.
rails routes
= list of definated routes
rails test
atc ....
advanced
rails new . --git --database=postgresql
Debug
helpers
:check:
debug
= can use everywehere. Print object to console
to-yaml
inspect
= print as string. Can use for collections
logger
:check:
./log/
log levels
= :debug, :info, :warn, :error, :fatal, and :unknown
How to log
= logger.info "Processing the request..."
Tagged logging
= logger.tagged("MY GROUP")
Performance
= logger.debug {"name:
#{@name
}"}
BEYBUG-GEM
-
TODO
Set up
The shell
......
WEBCONSOLE GEM
Print to the browser. Beybug-gem alternative
docs
Base using
Settings
Memory leaks
Valgind
=
official docs
How to install
Plugins
expect + queries alalyzer
Better errors
Chrome extension
:check:
configure
Rails env settins