This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 2 | |
jobs: | |
build: | |
parallelism: 3 | |
docker: | |
- image: circleci/ruby:2.4.2-node | |
environment: | |
PGHOST: 127.0.0.1 | |
PGUSER: user | |
RAILS_ENV: test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- run: | |
command: | | |
bundle exec rspec --profile 10 \ | |
--format RspecJunitFormatter \ | |
--out /tmp/test-results/rspec.xml \ | |
--format progress \ | |
$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RSpec.configure do |config| | |
config.before(:each, type: :system) do | |
driven_by :rack_test | |
end | |
config.before(:each, type: :system, js: true) do | |
if ENV["SELENIUM_DRIVER_URL"].present? | |
driven_by :selenium, using: :chrome, | |
options: { | |
browser: :remote, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# syntax=docker/dockerfile:1 | |
FROM ruby:3.1.2 | |
RUN apt-get update -qq && apt-get install -y sqlite3 | |
WORKDIR /myapp | |
COPY Gemfile /myapp/Gemfile | |
COPY Gemfile.lock /myapp/Gemfile.lock | |
RUN bundle install | |
# Add a script to be executed every time the container starts. | |
COPY entrypoint.sh /usr/bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TestClass | |
extend Quiz::TestCase | |
def with_a_user | |
@user = User.new | |
end | |
def with_an_admin | |
@user = User.new(admin: true) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Consumer | |
def takes_args(a, b, c) | |
p "#{a} #{b} #{c}" | |
end | |
def takes_keys(a:, b:, c:) | |
p "#{a} #{b} #{c}" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Consumer | |
def takes_args(a, b, c) | |
p "#{a} #{b} #{c}" | |
end | |
def takes_keys(a:, b:, c:) | |
p "#{a} #{b} #{c}" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Module | |
def sigilize(method_name) | |
define_method("#{method_name}?") do |*args, **kwargs| | |
!!method_name(*args, **kwargs) | |
end | |
define_method("#{method_name}!") do |*args, **kwargs| | |
result = method_name(*args, **kwargs) | |
raise StandardError unless result | |
result |