Skip to content

Commit 0508941

Browse files
committed
Merge branch 'main' into language-model-16
* main: remove maily update authentication helpers for tests update Readme add maily, letter_opener and bullet
2 parents ffe799e + 81e8156 commit 0508941

File tree

10 files changed

+97
-14
lines changed

10 files changed

+97
-14
lines changed

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ end
5858

5959
group :development do
6060
gem "hotwire-spark"
61+
gem "bullet"
62+
gem "letter_opener"
6163
# Use console on exceptions pages [https://github.com/rails/web-console]
6264
gem "web-console"
6365
end

Gemfile.lock

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ GEM
8888
brakeman (7.0.0)
8989
racc
9090
builder (3.3.0)
91+
bullet (8.0.0)
92+
activesupport (>= 3.0.0)
93+
uniform_notifier (~> 1.11)
9194
capybara (3.40.0)
9295
addressable
9396
matrix
@@ -97,6 +100,8 @@ GEM
97100
rack-test (>= 0.6.3)
98101
regexp_parser (>= 1.5, < 3.0)
99102
xpath (~> 3.2)
103+
childprocess (5.1.0)
104+
logger (~> 1.5)
100105
concurrent-ruby (1.3.5)
101106
connection_pool (2.5.0)
102107
crass (1.0.6)
@@ -162,6 +167,12 @@ GEM
162167
thor (~> 1.3)
163168
zeitwerk (>= 2.6.18, < 3.0)
164169
language_server-protocol (3.17.0.4)
170+
launchy (3.1.0)
171+
addressable (~> 2.8)
172+
childprocess (~> 5.0)
173+
logger (~> 1.6)
174+
letter_opener (1.10.0)
175+
launchy (>= 2.2, < 4)
165176
listen (3.9.0)
166177
rb-fsevent (~> 0.10, >= 0.10.3)
167178
rb-inotify (~> 0.9, >= 0.9.10)
@@ -388,6 +399,7 @@ GEM
388399
unicode-display_width (3.1.4)
389400
unicode-emoji (~> 4.0, >= 4.0.4)
390401
unicode-emoji (4.0.4)
402+
uniform_notifier (1.16.0)
391403
uri (1.0.2)
392404
useragent (0.16.11)
393405
web-console (4.2.1)
@@ -421,6 +433,7 @@ DEPENDENCIES
421433
bcrypt (~> 3.1.7)
422434
bootsnap
423435
brakeman
436+
bullet
424437
capybara
425438
debug
426439
factory_bot_rails
@@ -429,6 +442,7 @@ DEPENDENCIES
429442
importmap-rails
430443
jbuilder
431444
kamal
445+
letter_opener
432446
pg (~> 1.1)
433447
propshaft
434448
puma (>= 5.0)

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ SkillRX is one of many projects initiated and run by Ruby for Good. You can find
1111
# Welcome Contributors!
1212
Thank you for checking out our work. We are in the process of setting up the repository, roadmap, values, and contribution guidelines for the project. We will be adding issues and putting out a call for contributions soon.
1313

14+
# Setup
15+
16+
Clone this repo and run `bin/setup`. Run `bin/dev` or `bin/server` (if you like Overmind) to start working with app.
17+
1418
# Testing
1519

1620
This project uses:
1721
* `rspec` for testing
1822
* `shoulda-matchers` for expectations
1923
* `factory_bot` for making records
2024

21-
To run tests execute
22-
```
23-
bin/rspec
24-
```
25+
To run tests simply use `bin/rspec`. You can also you `bin/quality` to check for code style issues.

bin/quality

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env ruby
2+
3+
require 'pathname'
4+
require 'fileutils'
5+
include FileUtils
6+
7+
# path to your application root.
8+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
9+
10+
def system!(*args)
11+
system(*args) || abort("\n== Command #{args} failed ==")
12+
end
13+
14+
# rubocop
15+
chdir APP_ROOT do
16+
system! 'bin/rubocop --config .rubocop.yml'
17+
end
18+
19+
# brakeman
20+
chdir APP_ROOT do
21+
system! 'bin/brakeman --no-pager --no-progress'
22+
end
23+
24+
# js
25+
chdir APP_ROOT do
26+
system! 'bin/importmap audit'
27+
end

config/environments/development.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
require "active_support/core_ext/integer/time"
22

33
Rails.application.configure do
4+
if defined?(Bullet)
5+
config.after_initialize do
6+
Bullet.enable = true
7+
Bullet.alert = true
8+
Bullet.bullet_logger = true
9+
Bullet.console = true
10+
Bullet.rails_logger = true
11+
Bullet.add_footer = true
12+
end
13+
end
14+
415
# Settings specified here will take precedence over those in config/application.rb.
516

617
# Make code changes take effect immediately without server restart.
@@ -31,6 +42,9 @@
3142
# Store uploaded files on the local file system (see config/storage.yml for options).
3243
config.active_storage.service = :local
3344

45+
config.action_mailer.delivery_method = :letter_opener
46+
config.action_mailer.perform_deliveries = true
47+
3448
# Don't care if the mailer can't send.
3549
config.action_mailer.raise_delivery_errors = false
3650

config/environments/test.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
# and recreated between test runs. Don't rely on the data there!
55

66
Rails.application.configure do
7+
if defined?(Bullet)
8+
config.after_initialize do
9+
Bullet.enable = true
10+
Bullet.bullet_logger = true
11+
Bullet.raise = true # raise an error if n+1 query occurs
12+
end
13+
end
14+
715
# Settings specified here will take precedence over those in config/application.rb.
816

917
# While tests run files are not watched, reloading is not necessary.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
if defined?(LetterOpener)
2+
LetterOpener.configure do |config|
3+
# To overrider the location for message storage.
4+
# Default value is `tmp/letter_opener`
5+
config.location = Rails.root.join("tmp", "my_mails")
6+
7+
# To render only the message body, without any metadata or extra containers or styling.
8+
# Default value is `:default` that renders styled message with showing useful metadata.
9+
config.message_template = :light
10+
11+
# To change default file URI scheme you can provide `file_uri_scheme` config.
12+
# It might be useful when you use WSL (Windows Subsystem for Linux) and default
13+
# scheme doesn't work for you.
14+
# Default value is blank
15+
config.file_uri_scheme = "file://///wsl$/Ubuntu-18.04"
16+
end
17+
end

spec/requests/regions_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'rails_helper'
1+
require "rails_helper"
22

33
# This spec was generated by rspec-rails when you ran the scaffold generator.
44
# It demonstrates how one might use RSpec to test the controller code that

spec/support/authentication_helper.rb

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module AuthenticationHelpers
2+
def sign_in(user)
3+
post session_url, params: { email: user.email, password: user.password }
4+
end
5+
end
6+
7+
RSpec.configure do |config|
8+
config.include AuthenticationHelpers, type: :request
9+
end

0 commit comments

Comments
 (0)