Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c9fdb21
Move dev dependencies to Gemfile
n-rodriguez Jan 27, 2026
298eceb
Add some binstubs (bin/rake is faster than bundle exec rake)
n-rodriguez Jan 27, 2026
4eb4457
Use apparaisal gem to manage Rails versions, switch from Travis to Gi…
n-rodriguez Jan 27, 2026
929214e
Fix tests dealing with options hash
n-rodriguez Jan 28, 2026
cbce38e
Add missing dependencies due to stdlib gemification
n-rodriguez Jan 28, 2026
d120b95
Disable RSpec monkey patching, don't reopen Ruby namespaces in specs
n-rodriguez Jan 28, 2026
8df5d1c
Remove useless dependency to bundler
n-rodriguez Jan 28, 2026
11fcef1
Add Rubocop, fix basic Rubocop offenses
n-rodriguez Jan 28, 2026
e33e49c
Remove useless files
n-rodriguez Jan 28, 2026
534886b
Fix Rubocop offenses in specs
n-rodriguez Jan 29, 2026
6c360c2
Fix last Rubocop offenses
n-rodriguez Jan 30, 2026
82015de
Improve RSpec config
n-rodriguez Jan 30, 2026
a83fc90
Cleanup gemspec
n-rodriguez Jan 30, 2026
043a3c4
Fix last Rubocop offenses (Part II)
n-rodriguez Jan 30, 2026
bc51e29
Run Rubocop in CI, drop support of Rails 6.0 and older, drop support …
n-rodriguez Jan 30, 2026
3256597
Use zeitwerk to load gem
n-rodriguez Jan 30, 2026
124d4c0
We depend on json lib which is now a gem, so declare it explicitly
n-rodriguez Jan 30, 2026
f73c110
Coding style
n-rodriguez Jan 30, 2026
4e7c96a
Relax dev dependencies
n-rodriguez Jan 30, 2026
6584ae2
Add simplecov gem
n-rodriguez Jan 30, 2026
71a5d76
Add warning gem to manage Ruby warnings
n-rodriguez Jan 30, 2026
f58539d
Use cgi/escape (cgi is removed in Ruby 4.0)
n-rodriguez Jan 30, 2026
b71f5d6
Remove useless condition check
n-rodriguez Jan 30, 2026
044d90c
Get rid of OStruct
n-rodriguez Jan 30, 2026
4e0206a
Minor change
n-rodriguez Jan 30, 2026
94bcfb5
Cleanup Rakefile
n-rodriguez Jan 30, 2026
f5407ec
Add .rubocop_todo.yml
n-rodriguez Jan 30, 2026
822296b
Add comments
n-rodriguez Jan 30, 2026
39128aa
Use upstream version of memfs
n-rodriguez Jan 30, 2026
f26d900
Update README
n-rodriguez Jan 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
name: CI

on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
schedule:
- cron: '0 4 1 * *'

jobs:
rubocop:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'

- name: Bundler
run: bundle install

- name: Rubocop
run: bin/rubocop

rspec:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
ruby:
- '4.0'
- '3.4'
- '3.3'
- '3.2'
- '3.1'
- '3.0'
rails:
- rails_8.1
- rails_8.0
- rails_7.2
- rails_7.1
- rails_7.0
- rails_6.1

exclude:
- ruby: '3.0'
rails: 'rails_7.2'
- ruby: '3.0'
rails: 'rails_8.0'
- ruby: '3.0'
rails: 'rails_8.1'

- ruby: '3.1'
rails: 'rails_8.0'
- ruby: '3.1'
rails: 'rails_8.1'

env:
# $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.rails }}.gemfile
# Check for frozen strings
RUBYOPT: "--enable=frozen-string-literal --debug=frozen-string-literal"

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: RSpec
run: bin/rspec
3 changes: 1 addition & 2 deletions .rspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
--color
--format=documentation
--require spec_helper
--warnings
49 changes: 49 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
plugins:
- rubocop-capybara
- rubocop-performance
- rubocop-rake
- rubocop-rspec

inherit_from:
- .rubocop_todo.yml

AllCops:
NewCops: enable
SuggestExtensions: true
TargetRubyVersion: 3.0
Exclude:
- bin/*
- gemfiles/*

Gemspec/RequireMFA:
Enabled: false

Style/Documentation:
Enabled: false

Naming/FileName:
Exclude:
- lib/simple-navigation.rb

###########
# METRICS #
###########

Metrics/ClassLength:
Exclude:
- spec/**/*

Metrics/MethodLength:
Exclude:
- spec/**/*

#########
# RSPEC #
#########

RSpec/NestedGroups:
Max: 6

RSpec/MultipleMemoizedHelpers:
Max: 8
39 changes: 39 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---

Layout/LineLength:
Enabled: false

Naming/VariableNumber:
Enabled: false

Style/BlockDelimiters:
Enabled: false

#########
# RSPEC #
#########

RSpec/SubjectStub:
Enabled: false

RSpec/NamedSubject:
Enabled: false

RSpec/VerifiedDoubles:
Enabled: false

RSpec/ContextWording:
Enabled: false

RSpec/MessageSpies:
Enabled: false

RSpec/IndexedLet:
Enabled: false

############
# CAPYBARA #
############

Capybara/NegationMatcher:
Enabled: false
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

55 changes: 55 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# frozen_string_literal: true

# To update files in gemfiles/ directory:
# rm gemfiles/*
# bin/appraisal generate

# To run tests:
# bin/appraisal rails_8.1 bundle install
# bin/appraisal rails_8.1 rake
# bin/appraisal rails_8.1 rspec

appraise 'rails_6.1' do
gem 'railties', '~> 6.1.0'
gem 'rspec-rails'
gem 'concurrent-ruby', '1.3.4'

# Fix:
# warning: drb was loaded from the standard library, but is not part of the default gems starting from Ruby 3.4.0.
# You can add drb to your Gemfile or gemspec to silence this warning.
install_if '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' do
gem 'base64'
gem 'bigdecimal'
gem 'drb'
gem 'mutex_m'
end

install_if '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("4.0.0") }' do
gem 'benchmark'
end
end

appraise 'rails_7.0' do
gem 'railties', '~> 7.0.0'
gem 'rspec-rails'
end

appraise 'rails_7.1' do
gem 'railties', '~> 7.1.0'
gem 'rspec-rails'
end

appraise 'rails_7.2' do
gem 'railties', '~> 7.2.0'
gem 'rspec-rails'
end

appraise 'rails_8.0' do
gem 'railties', '~> 8.0.0'
gem 'rspec-rails'
end

appraise 'rails_8.1' do
gem 'railties', '~> 8.1.0'
gem 'rspec-rails'
end
21 changes: 21 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
# frozen_string_literal: true

source 'https://rubygems.org'

gemspec

# Dev libs
gem 'appraisal', git: 'https://github.com/thoughtbot/appraisal.git'
gem 'capybara'
gem 'memfs', git: 'https://github.com/simonc/memfs.git'
gem 'rake'
gem 'rdoc'
gem 'rspec'
gem 'simplecov'
gem 'tzinfo'
gem 'warning'

# Dev tools / linter
gem 'guard-rspec', require: false
gem 'rubocop', require: false
gem 'rubocop-capybara', require: false
gem 'rubocop-performance', require: false
gem 'rubocop-rake', require: false
gem 'rubocop-rspec', require: false
6 changes: 4 additions & 2 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# frozen_string_literal: true

guard :rspec, all_after_pass: true, failed_mode: :none do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^spec/fake_app/.+\.rb$}) { 'spec/integration' }

watch('spec/spec_helper.rb') { 'spec' }
watch('spec/spec_helper.rb') { 'spec' }
end
31 changes: 10 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,19 @@ Fork, fix, then send a Pull Request.

To run the test suite locally against all supported frameworks:

% bundle install
% rake spec:all
```sh
bundle install
bin/appraisal bundle install
bin/appraisal rspec
bin/appraisal rspec ./spec/requests/users_spec.rb
```

To target the test suite against one framework:

% rake spec:rails-4-2-stable

You can find a list of supported spec tasks by running rake -T. You may also find it useful to run a specific test for a specific framework. To do so, you'll have to first make sure you have bundled everything for that configuration, then you can run the specific test:

% BUNDLE_GEMFILE='gemfiles/rails-4-2-stable.gemfile' bundle install -j 4
% BUNDLE_GEMFILE='gemfiles/rails-4-2-stable.gemfile' bundle exec rspec ./spec/requests/users_spec.rb

### Rake and Bundler

If you use a shell plugin (like oh-my-zsh:bundler) that auto-prefixes commands with `bundle exec` using the `rake` command will fail.

Get the original command with `type -a rake`:

% type -a rake
rake is an alias for bundled_rake
rake is /Users/username/.rubies/ruby-2.2.3/bin/rake
rake is /usr/bin/rake

In this situation `/Users/username/.rubies/ruby-2.2.3/bin/rake` is the command you should use.
```sh
bin/appraisal rails_8.1 rspec
bin/appraisal rails_8.1 rspec ./spec/requests/users_spec.rb
```

## License

Expand Down
29 changes: 2 additions & 27 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,37 +1,12 @@
require 'bundler'
Bundler::GemHelper.install_tasks
# frozen_string_literal: true

require 'rspec/core'
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'

require 'rdoc/task'

RSpec::Core::RakeTask.new(:spec)

task default: 'spec'

namespace :spec do
mappers = %w[
rails-3-2-stable
rails-4-1-stable
rails-4-2-stable
rails-5-2-stable
rails-6-0-stable
rails-6-1-stable
]

mappers.each do |gemfile|
desc "Run Tests against #{gemfile}"
task gemfile do
sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle -j 4 --quiet"
sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle exec rake -t spec"
end
end

desc 'Run Tests against all ORMs'
task all: mappers
end

RDoc::Task.new do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'SimpleNavigation'
Expand Down
16 changes: 16 additions & 0 deletions bin/_guard-core
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application '_guard-core' is installed as part of a gem, and
# this file is here to facilitate running it.
#

ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)

require "rubygems"
require "bundler/setup"

load Gem.bin_path("guard", "_guard-core")
Loading