Skip to content

EugenePetrik/ruby_rspec_siteprism_webinar

Repository files navigation

This project has been prepared for the webinar.

We use the following tools, such as Ruby, Capybara, SitePrism, and RSpec.

CircleCI

Install Postgres for Ubuntu

Setup Postgres for Ubuntu

Create user for Postgresql:

sudo -u postgres createuser --superuser user_name

Install Postgres for Mac

Setup Postgres for Mac

Install rvm Ubuntu

Ubuntu rvm

Install rvm Mac

Mac rvm

Install Ruby 2.6.5

rvm install 2.6.5
rvm --default use 2.6.5
rvm list
ruby -v

Install bundler

gem install bundler

Install gems

bundle install

Create database (will create an empty database for the current environment)

rails db:create

Run migrations (runs migrations for the current environment and create db/schema.rb file)

rails db:migrate

Seeds database with fake data

rails db:test:populate

Test user

Login - [email protected]
Password - 123456

Run Rubocop

rubocop

Run Rubocop with auto refactoring

rubocop -a

Setup RSpec

rails generate rspec:install

Run all spec files

rspec

Run all spec files in a single directory

rspec spec/features

Run a single spec file

rspec spec/features/home_page_spec.rb

Run a single example from a spec file (by line number)

rspec spec/features/home_page_spec.rb:22

Run all spec files with the 'smoke' tag

rspec spec/features --tag smoke

Run specs in Chrome browser

CHROME_HEADLESS=0 rspec spec/features --tag smoke

Run specs with RSpec Test Results in HTML

rspec spec/features --format progress --format html --out reports/rspec_results.html

Docker

Install docker and docker-compose

sudo apt-get install docker docker-compose

Run the project

docker-compose up

Re-run project with modified configs

docker-compose up --force-recreate --build server_app

Run specs

bin/docker rspec

Run a single spec file

bin/docker rspec spec/features/authentication/login_spec.rb

Useful links

Site Prism gem

Capybara Cheatsheet #1

Capybara Cheatsheet #2

Rubocop Tests Naming

Faker Generators

Fuubar RSpec Formatter

Filter specs with a tag option

RSpec Test Results in HTML

Factory Bot Cheatsheet

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published