Skip to content

Commit 73a489d

Browse files
authored
Merge pull request #43 from oskarpearson/replace-travis-with-github-actions
Replace travis with github actions, add ActiveAdmin 3 support
2 parents 090d4e5 + 4afdb04 commit 73a489d

File tree

6 files changed

+73
-29
lines changed

6 files changed

+73
-29
lines changed

.github/workflows/ci.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- master
7+
jobs:
8+
test:
9+
name: Tests with Ruby ${{ matrix.ruby }} Rails ${{ matrix.rails }} Active Admin ${{ matrix.activeadmin }}
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
ruby:
14+
- '3.0.0'
15+
- '3.1.0'
16+
- '3.2.0'
17+
- '3.3.0'
18+
rails:
19+
- '6.1.0'
20+
- '7.0.0'
21+
- '7.1.0'
22+
activeadmin:
23+
- '2.14.0'
24+
- '3.0.0'
25+
- '3.1.0'
26+
- '3.2.0'
27+
exclude:
28+
- rails: '7.1.0'
29+
activeadmin: '2.14.0'
30+
- rails: '7.1.0'
31+
activeadmin: '3.0.0'
32+
env:
33+
RAILS: ${{ matrix.rails }}
34+
AA: ${{ matrix.activeadmin }}
35+
steps:
36+
- uses: actions/checkout@v4
37+
- uses: ruby/setup-ruby@v1
38+
with:
39+
ruby-version: ${{ matrix.ruby }}
40+
- name: Run tests
41+
run: |
42+
gem install bundler -v '< 2'
43+
bundle install
44+
bundle exec rspec spec

.travis.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

Gemfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@ source 'https://rubygems.org'
33
gemspec
44

55
group :test do
6-
gem 'rails', "~> #{ENV['RAILS'] || '6.0.0'}"
7-
gem 'activeadmin', "~> #{ENV['AA'] || '2.6.0'}"
6+
default_rails_version = '7.1.0'
7+
default_activeadmin_version = '3.2.0'
88

9-
gem 'sprockets-rails', '3.0.4'
9+
gem 'rails', "~> #{ENV['RAILS'] || default_rails_version}"
10+
gem 'activeadmin', "~> #{ENV['AA'] || default_activeadmin_version}"
11+
12+
gem 'sprockets-rails'
1013
gem 'rspec-rails'
11-
gem 'coveralls', require: false # Test coverage website. Go to https://coveralls.io
14+
gem 'coveralls_reborn', require: false
1215
gem 'sass-rails'
1316
gem 'sqlite3', '~> 1.4.0'
1417
gem 'launchy'
@@ -17,4 +20,5 @@ group :test do
1720
gem 'webdrivers'
1821
gem 'byebug'
1922
gem 'draper'
23+
gem 'webrick', require: false
2024
end

active_admin_scoped_collection_actions.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ Gem::Specification.new do |spec|
1717
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
1818
spec.require_paths = ["lib"]
1919

20-
spec.add_dependency "activeadmin", ">= 1.1", "< 3.a"
20+
spec.add_dependency "activeadmin", ">= 1.1", "< 4.0"
2121
end

spec/support/capybara.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
config.match = :prefer_exact
55
end
66

7+
Webdrivers::Chromedriver.update
8+
79
Capybara.register_driver :selenium_chrome do |app|
810
options = Selenium::WebDriver::Chrome::Options.new(
911
args: %w[headless disable-gpu no-sandbox]

spec/support/rails_template.rb

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,24 @@
44
generate :model, 'post title:string:uniq body:text author:references'
55

66
#Add validation
7-
inject_into_file "app/models/author.rb", " validates_presence_of :name\n validates_uniqueness_of :last_name\n", after: "Base\n"
8-
inject_into_file "app/models/post.rb", " validates_presence_of :author\n", after: ":author\n"
7+
inject_into_file "app/models/author.rb", " validates_presence_of :name\n validates_uniqueness_of :last_name\n", after: "ApplicationRecord\n"
8+
inject_into_file "app/models/post.rb", " validates_presence_of :author\n", after: ":author\n"
9+
10+
# Add ransackable_attributes
11+
inject_into_file "app/models/author.rb",
12+
" def self.ransackable_attributes(auth_object = nil)\n" \
13+
" [\"name\", \"last_name\", \"birthday\"]\n" \
14+
" end\n",
15+
after: "ApplicationRecord\n"
16+
17+
inject_into_file "app/models/post.rb",
18+
" def self.ransackable_attributes(auth_object = nil)\n" \
19+
" [\"title\", \"body\", \"author_id\"]\n" \
20+
" end\n" \
21+
" def self.ransackable_associations(auth_object = nil)\n" \
22+
" [\"author\"]\n" \
23+
" end\n",
24+
after: "ApplicationRecord\n"
925

1026
# Configure default_url_options in test environment
1127
inject_into_file "config/environments/test.rb", " config.action_mailer.default_url_options = { :host => 'example.com' }\n", after: "config.cache_classes = true\n"

0 commit comments

Comments
 (0)