Skip to content

Commit e1e3130

Browse files
authored
Merge pull request #4 from deanmarano/rspec
Rspec
2 parents 07b3707 + 204d745 commit e1e3130

File tree

8 files changed

+59
-14
lines changed

8 files changed

+59
-14
lines changed

Diff for: .github/workflows/ci.yml

+10-1
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,21 @@ jobs:
8585
ruby-version: .ruby-version
8686
bundler-cache: true
8787

88+
- name: Set up Node
89+
uses: actions/setup-node@v4
90+
with:
91+
node-version: 18
92+
cache: 'npm'
93+
cache-dependency-path: frontend/package-lock.json
94+
- run: cd frontend && npm ci
95+
8896
- name: Run tests
8997
env:
9098
RAILS_ENV: test
9199
DATABASE_URL: postgres://postgres:postgres@localhost:5432
100+
CI: 'true'
92101
# REDIS_URL: redis://localhost:6379/0
93-
run: bin/rails db:test:prepare test test:system
102+
run: bin/rails db:test:prepare && bin/rspec
94103

95104
- name: Keep screenshots from failed system tests
96105
uses: actions/upload-artifact@v4

Diff for: .rubocop.yml

+4
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@ inherit_gem: { rubocop-rails-omakase: rubocop.yml }
66
# # Use `[a, [b, c]]` not `[ a, [ b, c ] ]`
77
# Layout/SpaceInsideArrayLiteralBrackets:
88
# Enabled: false
9+
AllCops:
10+
Exclude:
11+
- 'frontend/**/*'
12+
- 'vendor/**/*'

Diff for: Gemfile

+2-3
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,13 @@ group :development, :test do
4848
gem "rspec-rails", "~> 7.1"
4949
gem "factory_bot_rails"
5050
gem "faker"
51+
52+
gem "pry-rails"
5153
end
5254

5355
group :development do
5456
# Use console on exceptions pages [https://github.com/rails/web-console]
5557
gem "web-console"
56-
57-
# Highlight the fine-grained location where an error occurred [https://github.com/ruby/error_highlight]
58-
gem "error_highlight", ">= 0.4.0", platforms: [ :ruby ]
5958
end
6059

6160
group :test do

Diff for: Gemfile.lock

+8-2
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ GEM
107107
regexp_parser (>= 1.5, < 3.0)
108108
xpath (~> 3.2)
109109
climate_control (0.2.0)
110+
coderay (1.1.3)
110111
concurrent-ruby (1.3.4)
111112
connection_pool (2.4.1)
112113
crass (1.0.6)
@@ -124,7 +125,6 @@ GEM
124125
drb (2.2.1)
125126
ember-cli-rails-assets (0.7.1)
126127
nokogiri
127-
error_highlight (0.7.0)
128128
erubi (1.13.1)
129129
factory_bot (6.5.0)
130130
activesupport (>= 5.0.0)
@@ -162,6 +162,7 @@ GEM
162162
net-smtp
163163
marcel (1.0.4)
164164
matrix (0.4.2)
165+
method_source (1.1.0)
165166
mini_mime (1.1.5)
166167
minitest (5.25.4)
167168
msgpack (1.7.5)
@@ -187,6 +188,11 @@ GEM
187188
ast (~> 2.4.1)
188189
racc
189190
pg (1.5.9)
191+
pry (0.15.2)
192+
coderay (~> 1.1)
193+
method_source (~> 1.0)
194+
pry-rails (0.3.11)
195+
pry (>= 0.13.0)
190196
psych (5.2.2)
191197
date
192198
stringio
@@ -342,12 +348,12 @@ DEPENDENCIES
342348
debug
343349
devise (~> 4.9)
344350
ember-cli-rails!
345-
error_highlight (>= 0.4.0)
346351
factory_bot_rails
347352
faker
348353
importmap-rails
349354
jbuilder
350355
pg (~> 1.1)
356+
pry-rails
351357
puma (>= 5.0)
352358
rails (~> 7.2.2, >= 7.2.2.1)
353359
rspec-rails (~> 7.1)

Diff for: bin/rspec

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'rspec' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12+
13+
bundle_binstub = File.expand_path("bundle", __dir__)
14+
15+
if File.file?(bundle_binstub)
16+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
17+
load(bundle_binstub)
18+
else
19+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
20+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
21+
end
22+
end
23+
24+
require "rubygems"
25+
require "bundler/setup"
26+
27+
load Gem.bin_path("rspec-core", "rspec")

Diff for: config/initializers/devise.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
# Configure the e-mail address which will be shown in Devise::Mailer,
2525
# note that it will be overwritten if you use your own mailer class
2626
# with default "from" parameter.
27-
config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
27+
config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
2828

2929
# Configure the class responsible to send e-mails.
3030
# config.mailer = 'Devise::Mailer'
@@ -36,7 +36,7 @@
3636
# Load and configure the ORM. Supports :active_record (default) and
3737
# :mongoid (bson_ext recommended) by default. Other ORMs may be
3838
# available as additional gems.
39-
require 'devise/orm/active_record'
39+
require "devise/orm/active_record"
4040

4141
# ==> Configuration for any authentication mechanism
4242
# Configure which keys are used when authenticating a user. The default is
@@ -58,12 +58,12 @@
5858
# Configure which authentication keys should be case-insensitive.
5959
# These keys will be downcased upon creating or modifying a user and when used
6060
# to authenticate or find a user. Default is :email.
61-
config.case_insensitive_keys = [:email]
61+
config.case_insensitive_keys = [ :email ]
6262

6363
# Configure which authentication keys should have whitespace stripped.
6464
# These keys will have whitespace before and after removed upon creating or
6565
# modifying a user and when used to authenticate or find a user. Default is :email.
66-
config.strip_whitespace_keys = [:email]
66+
config.strip_whitespace_keys = [ :email ]
6767

6868
# Tell if authentication through request.params is enabled. True by default.
6969
# It can be set to an array that will enable params authentication only for the
@@ -97,7 +97,7 @@
9797
# Notice that if you are skipping storage for all authentication paths, you
9898
# may want to disable generating routes to Devise's sessions controller by
9999
# passing skip: :sessions to `devise_for` in your config/routes.rb
100-
config.skip_session_storage = [:http_auth]
100+
config.skip_session_storage = [ :http_auth ]
101101

102102
# By default, Devise cleans up the CSRF token on authentication to
103103
# avoid CSRF token fixation attacks. This means that, when using AJAX

Diff for: spec/support/chrome_helper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
RSpec.configure do |config|
22
config.before(:each, type: :system) do
33
if ENV["CI"] == "true"
4-
driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400]
4+
driven_by :selenium, using: :headless_chrome, screen_size: [ 1400, 1400 ]
55
else
66
driven_by :selenium_chrome
77
end

Diff for: spec/features/new_users_spec.rb renamed to spec/system/new_users_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'rails_helper'
22

3-
RSpec.describe 'New Users', type: :feature do
4-
scenario 'user signs up successfully' do
3+
RSpec.describe 'New Users', type: :system do
4+
scenario 'the homepage loads' do
55
# Visit the index page
66
visit root_path
77
expect(page).to have_content('Recipe Book') # Replace with the actual welcome message

0 commit comments

Comments
 (0)