Skip to content

Commit 1599319

Browse files
committed
Add Rails 7.2
1 parent 04f7f47 commit 1599319

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+1163
-43
lines changed

.github/workflows/ruby.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,22 @@ jobs:
2424
env:
2525
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
2626

27-
rails_4_2:
27+
rails_7_2:
2828
runs-on: ubuntu-latest
2929

3030
steps:
3131
- uses: actions/checkout@v4
3232
- name: Set up Ruby
3333
uses: ruby/setup-ruby@v1
3434
with:
35-
ruby-version: 2.5
35+
ruby-version: 3.1.3
3636
bundler-cache: true
3737
- name: Run tests
3838
run: bundle exec rake
3939
- run: gem uninstall -v '>= 2' -ax bundler || true
4040
- run: gem install bundler -v '< 2'
4141
- name: Run interaction tests
42-
run: ./specs_e2e/rails_4_2/test.sh
42+
run: ./specs_e2e/rails_7_2/test.sh
4343
env:
4444
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
4545

specs_e2e/rails_7_2/.gitattributes

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# See https://git-scm.com/docs/gitattributes for more about git attribute files.
2+
3+
# Mark the database schema as having been generated.
4+
db/schema.rb linguist-generated
5+
6+
# Mark any vendored files as having been vendored.
7+
vendor/* linguist-vendored
8+
config/credentials/*.yml.enc diff=rails_credentials
9+
config/credentials.yml.enc diff=rails_credentials

specs_e2e/rails_7_2/.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.bundle
2+
test/node_modules
3+
test/cypress.config.js
4+
test/playwright.config.js
5+
test/package.json
6+
test/yarn.lock
7+
test/cypress/
8+
test/playwright/
9+
test/playwright-report/
10+
config/initializers/cypress_on_rails.rb
11+
vendor/bundle
12+
db/*.sqlite3
13+
db/schema.rb
14+
tmp/*
15+
log/*
16+
specs_e2e/server.pid

specs_e2e/rails_7_2/.rubocop.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Omakase Ruby styling for Rails
2+
inherit_gem: { rubocop-rails-omakase: rubocop.yml }
3+
4+
# Overwrite or add rules to create your own house style
5+
#
6+
# # Use `[a, [b, c]]` not `[ a, [ b, c ] ]`
7+
# Layout/SpaceInsideArrayLiteralBrackets:
8+
# Enabled: false

specs_e2e/rails_7_2/Gemfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
source "https://rubygems.org"
2+
3+
gem "rails", "~> 7.2.2"
4+
gem "sqlite3", ">= 1.4"
5+
gem "puma", ">= 5.0"
6+
gem "bootsnap", require: false
7+
8+
group :development, :test do
9+
gem 'cypress-on-rails', path: '../../'
10+
gem 'database_cleaner'
11+
end
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Add your own tasks in files placed in lib/tasks ending in .rake,
22
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
33

4-
require File.expand_path('../config/application', __FILE__)
4+
require_relative "config/application"
55

66
Rails.application.load_tasks
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* This is a manifest file that'll be compiled into application.css, which will include all the files
3+
* listed below.
4+
*
5+
* Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
6+
* vendor/assets/stylesheets directory can be referenced here using a relative path.
7+
*
8+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
9+
* compiled file so the styles you add here take precedence over styles defined in any other CSS
10+
* files in this directory. Styles in this file should be added after the last require_* statement.
11+
* It is generally better to create a new file per style scope.
12+
*
13+
*= require_tree .
14+
*= require_self
15+
*/
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class ApplicationController < ActionController::Base
2+
# Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
3+
allow_browser versions: :modern
4+
end
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
class PostsController < ApplicationController
2+
before_action :set_post, only: [:show, :edit, :update, :destroy]
3+
4+
# GET /posts
5+
def index
6+
@posts = Post.all
7+
end
8+
9+
# GET /posts/1
10+
def show
11+
end
12+
13+
# GET /posts/new
14+
def new
15+
@post = Post.new
16+
end
17+
18+
# GET /posts/1/edit
19+
def edit
20+
end
21+
22+
# POST /posts
23+
def create
24+
@post = Post.new(post_params)
25+
26+
if @post.save
27+
redirect_to @post, notice: 'Post was successfully created.'
28+
else
29+
render :new
30+
end
31+
end
32+
33+
# PATCH/PUT /posts/1
34+
def update
35+
if @post.update(post_params)
36+
redirect_to @post, notice: 'Post was successfully updated.'
37+
else
38+
render :edit
39+
end
40+
end
41+
42+
# DELETE /posts/1
43+
def destroy
44+
@post.destroy
45+
redirect_to posts_url, notice: 'Post was successfully destroyed.'
46+
end
47+
48+
private
49+
# Use callbacks to share common setup or constraints between actions.
50+
def set_post
51+
@post = Post.find(params[:id])
52+
end
53+
54+
# Only allow a trusted parameter "white list" through.
55+
def post_params
56+
params.require(:post).permit(:title, :body, :published)
57+
end
58+
end
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
module PostsHelper
2+
end

0 commit comments

Comments
 (0)