Skip to content

Commit 7280aea

Browse files
committed
Add rails 6.1
1 parent dcea719 commit 7280aea

Some content is hidden

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

63 files changed

+1324
-5
lines changed

.github/workflows/ruby.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,20 @@ on:
77
branches: [ master ]
88

99
jobs:
10-
rails_3_2:
10+
rails_6_1_7:
1111
runs-on: ubuntu-latest
1212

1313
steps:
1414
- uses: actions/checkout@v2
1515
- name: Set up Ruby
1616
uses: ruby/setup-ruby@v1
1717
with:
18-
ruby-version: 2.3
18+
ruby-version: 2.7
1919
bundler-cache: true
2020
- name: Run tests
2121
run: bundle exec rake
22-
- run: gem uninstall -v '>= 2' -ax bundler || true
23-
- run: gem install bundler -v '< 2'
2422
- name: Run interaction tests
25-
run: ./specs_e2e/rails_3_2/test.sh
23+
run: ./specs_e2e/rails_6_1_7/test.sh
2624
env:
2725
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
2826

specs_e2e/rails_6_1_7/.gitattributes

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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 the yarn lockfile as having been generated.
7+
yarn.lock linguist-generated
8+
9+
# Mark any vendored files as having been vendored.
10+
vendor/* linguist-vendored

specs_e2e/rails_6_1_7/.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_6_1_7/Gemfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
source 'https://rubygems.org'
2+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3+
4+
ruby '2.7.6'
5+
6+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
7+
gem 'rails', '~> 6.1.7', '>= 6.1.7.10'
8+
# Use sqlite3 as the database for Active Record
9+
gem 'sqlite3', '~> 1.4'
10+
# Use Puma as the app server
11+
gem 'puma', '~> 5.0'
12+
13+
# Reduces boot times through caching; required in config/boot.rb
14+
gem 'bootsnap', '>= 1.4.4', require: false
15+
gem 'date', '~> 3.3.3'
16+
gem 'timeout', '~> 0.3.2'
17+
18+
group :development, :test do
19+
gem 'cypress-on-rails', path: '../../'
20+
gem 'database_cleaner'
21+
end

specs_e2e/rails_6_1_7/Rakefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Add your own tasks in files placed in lib/tasks ending in .rake,
2+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3+
4+
require_relative "config/application"
5+
6+
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 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/SCSS
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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class ApplicationController < ActionController::Base
2+
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
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class ApplicationJob < ActiveJob::Base
2+
# Automatically retry jobs that encountered a deadlock
3+
# retry_on ActiveRecord::Deadlocked
4+
5+
# Most jobs are safe to ignore if the underlying records are no longer available
6+
# discard_on ActiveJob::DeserializationError
7+
end

0 commit comments

Comments
 (0)