Skip to content

Commit 1b47a5e

Browse files
authored
Merge pull request #2160 from benoittgt/rebase_4-0-dev
Rebase master to 4-0-dev and fix build
2 parents b118fc6 + fe90da4 commit 1b47a5e

16 files changed

+175
-44
lines changed

.travis.yml

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,20 @@ before_script:
3232

3333
script: "script/run_build 2>&1"
3434

35+
# In order to install old Rubies, we need to use old Ubuntu distibution.
36+
dist: trusty
37+
3538
matrix:
3639
include:
3740
# Rails 6 builds
3841
- rvm: jruby-head
3942
env:
40-
- RAILS_VERSION=6-0-stable
43+
- RAILS_VERSION='~>6.0'
4144
- JRUBY_OPT=--dev
4245
- rvm: 2.6.3
43-
env: RAILS_VERSION=6-0-stable
44-
- rvm: 2.5.3
45-
env: RAILS_VERSION=6-0-stable
46+
env: RAILS_VERSION='~>6.0'
47+
- rvm: 2.5.5
48+
env: RAILS_VERSION='~>6.0'
4649

4750
# Rails 5.2 builds >= 2.2.2
4851
- rvm: jruby-head
@@ -51,43 +54,43 @@ matrix:
5154
- JRUBY_OPT=--dev
5255
- rvm: 2.6.3
5356
env: RAILS_VERSION='~> 5.2.0'
54-
- rvm: 2.5.3
57+
- rvm: 2.5.5
5558
env: RAILS_VERSION='~> 5.2.0'
56-
- rvm: 2.4.4
59+
- rvm: 2.4.6
5760
env: RAILS_VERSION='~> 5.2.0'
58-
- rvm: 2.3.7
61+
- rvm: 2.3.8
5962
env: RAILS_VERSION='~> 5.2.0'
6063

6164
# Rails 5.1 Builds >= 2.2.2
6265
- rvm: 2.6.3
6366
env: RAILS_VERSION='~> 5.1.0'
64-
- rvm: 2.5.3
67+
- rvm: 2.5.5
6568
env: RAILS_VERSION='~> 5.1.0'
66-
- rvm: 2.4.4
69+
- rvm: 2.4.6
6770
env: RAILS_VERSION='~> 5.1.0'
68-
- rvm: 2.3.7
71+
- rvm: 2.3.8
6972
env: RAILS_VERSION='~> 5.1.0'
7073

7174
# Rails 5.0 Builds >= 2.2.2
7275
- rvm: 2.6.3
7376
env: RAILS_VERSION='~> 5.0.0'
74-
- rvm: 2.5.3
77+
- rvm: 2.5.5
7578
env: RAILS_VERSION='~> 5.0.0'
76-
- rvm: 2.4.4
79+
- rvm: 2.4.6
7780
env: RAILS_VERSION='~> 5.0.0'
78-
- rvm: 2.3.7
81+
- rvm: 2.3.8
7982
env: RAILS_VERSION='~> 5.0.0'
8083

8184
# Rails 4.2 Builds >= 1.9.3
82-
- rvm: 2.5.3
85+
- rvm: 2.5.5
8386
env: RAILS_VERSION='~> 4.2.0'
84-
- rvm: 2.4.4
87+
- rvm: 2.4.6
8588
env: RAILS_VERSION='~> 4.2.0'
86-
- rvm: 2.4.4
89+
- rvm: 2.4.6
8790
env: RAILS_VERSION=4-2-stable
88-
- rvm: 2.3.7
91+
- rvm: 2.3.8
8992
env: RAILS_VERSION='~> 4.2.0'
90-
- rvm: 2.3.7
93+
- rvm: 2.3.8
9194
env: RAILS_VERSION=4-2-stable
9295

9396
fast_finish: true

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Enhancements
4545
making it easier to match on `ActiveJob` delivered emails. (Joel Lubrano, #2047)
4646
* Add generator for system specs on Rails 5.1 and above. (Andrzej Sliwa, #1933)
4747
* Add generator for generator specs. (@ConSou, #2085)
48+
* Add option to generate routes when generating controller specs. (David Revelo, #2134)
4849

4950
### 3.8.2 / 2019-01-13
5051
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v3.8.1...v3.8.2)

Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ end
3232

3333
if MAJOR >= 6
3434
gem 'sqlite3', '~> 1.4', platforms: [:ruby]
35+
gem 'selenium-webdriver', '~> 3.5', :require => false
3536
else
3637
gem 'sqlite3', '~> 1.3.6', platforms: [:ruby]
3738
end
@@ -56,7 +57,7 @@ end
5657

5758
gem "rubyzip", '~> 1.2'
5859

59-
gem 'rubocop'
60+
gem 'rubocop', "~> 0.74"
6061

6162
custom_gemfile = File.expand_path("../Gemfile-custom", __FILE__)
6263
eval_gemfile custom_gemfile if File.exist?(custom_gemfile)

Gemfile-rails-dependencies

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,10 @@ else
3333
if version >= '5-1-stable' && RUBY_VERSION >= "2.3"
3434
gem "puma"
3535
end
36-
gem 'activerecord-jdbcsqlite3-adapter', platforms: [:jruby]
36+
37+
if ENV['RAILS_VERSION'].gsub(/[^\d\.]/,'').to_f >= 6.0
38+
gem "activerecord-jdbcsqlite3-adapter", "~> 60.0.rc1", platforms: [:jruby]
39+
else
40+
gem 'activerecord-jdbcsqlite3-adapter', platforms: [:jruby]
41+
end
3742
end

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Use **[`rspec-rails` 1.x][]** for Rails 2.x.
1212

1313
[Build Status]: https://secure.travis-ci.org/rspec/rspec-rails.svg?branch=master
1414
[travis-ci]: https://travis-ci.org/rspec/rspec-rails
15-
[Code Climate]: https://img.shields.io/codeclimate/github/rspec/rspec-rails.svg
15+
[Code Climate]: https://codeclimate.com/github/rspec/rspec-rails.svg
1616
[code-climate]: https://codeclimate.com/github/rspec/rspec-rails
1717
[Gem Version]: https://badge.fury.io/rb/rspec-rails.svg
1818
[gem-version]: https://badge.fury.io/rb/rspec-rails

appveyor.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file was generated on 2019-04-01T20:23:57+02:00 from the rspec-dev repo.
1+
# This file was generated on 2019-07-24T15:33:53+02:00 from the rspec-dev repo.
22
# DO NOT modify it by hand as your changes will get lost the next time it is generated.
33

44
version: "{build}"
@@ -39,3 +39,4 @@ environment:
3939
- ruby_version: 23-x64
4040
- ruby_version: 24-x64
4141
- ruby_version: 25-x64
42+
- ruby_version: 26-x64

example_app_generator/generate_app.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@
4242
if RUBY_VERSION < "2.4"
4343
gsub_file "Gemfile", /.*capybara.*/, "gem 'capybara', '~> 3.15.0'"
4444
end
45-
gsub_file "Gemfile", /.*chromedriver-helper.*/, "gem 'webdrivers'"
45+
if Rails::VERSION::STRING >= "5.2.0" && RUBY_VERSION < '2.3.0'
46+
gsub_file "Gemfile", /.*chromedriver-helper.*/, "gem 'webdrivers', '< 4.0.0'"
47+
else
48+
gsub_file "Gemfile", /.*chromedriver-helper.*/, "gem 'webdrivers'"
49+
end
4650
end
4751

4852
if Rails::VERSION::STRING >= '5.2.0' && Rails::VERSION::STRING < '6'

features/Transactions.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ simply tell RSpec to tell Rails not to manage transactions:
2323
config.use_transactional_fixtures = false
2424
end
2525

26-
### Data created in `before(:each)` are rolled back
26+
### Data created in `before(:example)` are rolled back
2727

28-
Any data you create in a `before(:each)` hook will be rolled back at the end of
28+
Any data you create in a `before(:example)` hook will be rolled back at the end of
2929
the example. This is a good thing because it means that each example is
3030
isolated from state that would otherwise be left around by the examples that
3131
already ran. For example:
3232

3333
describe Widget do
34-
before(:each) do
34+
before(:example) do
3535
@widget = Widget.create
3636
end
3737

@@ -48,34 +48,34 @@ The `@widget` is recreated in each of the two examples above, so each example
4848
has a different object, _and_ the underlying data is rolled back so the data
4949
backing the `@widget` in each example is new.
5050

51-
### Data created in `before(:all)` are _not_ rolled back
51+
### Data created in `before(:context)` are _not_ rolled back
5252

53-
`before(:all)` hooks are invoked before the transaction is opened. You can use
53+
`before(:context)` hooks are invoked before the transaction is opened. You can use
5454
this to speed things up by creating data once before any example in a group is
5555
run, however, this introduces a number of complications and you should only do
5656
this if you have a firm grasp of the implications. Here are a couple of
5757
guidelines:
5858

59-
1. Be sure to clean up any data in an `after(:all)` hook:
59+
1. Be sure to clean up any data in an `after(:context)` hook:
6060

61-
before(:all) do
61+
before(:context) do
6262
@widget = Widget.create!
6363
end
6464

65-
after(:all) do
65+
after(:context) do
6666
@widget.destroy
6767
end
6868

6969
If you don't do that, you'll leave data lying around that will eventually
7070
interfere with other examples.
7171

72-
2. Reload the object in a `before(:each)` hook.
72+
2. Reload the object in a `before(:example)` hook.
7373

74-
before(:all) do
74+
before(:context) do
7575
@widget = Widget.create!
7676
end
7777

78-
before(:each) do
78+
before(:example) do
7979
@widget.reload
8080
end
8181

rfcs/versioning-strategy.md

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# RFC: RSpec Rails new versioning strategy
2+
3+
Hi Folks,
4+
5+
This RFC captures a proposal for RSpec Rails' new versioning strategy. Specifically, this represents two things:
6+
* A change in representation of what we use SemVer for, in RSpec Rails
7+
* A departure from RSpec Rails having the same versioning as RSpec's other gems (-core, -mocks, -expectations, and, internally, -support).
8+
9+
## Need
10+
11+
Currently, the RSpec Rails [build matrix](https://travis-ci.org/rspec/rspec-rails)
12+
has 63 entries. This permutes rubies since 1.8.7 and Rails versions since 3.0.
13+
As of right now the full build takes over an hour to run, and this makes cycling
14+
for PRs and quick iterative development very difficult.
15+
16+
RSpec Rails's code itself also is damaged by this. Everything from the Gemfile
17+
setup[1](https://github.com/rspec/rspec-rails/blob/1d2935861c89246236b46f77de753cda5ea67d61/Gemfile)
18+
[2](https://github.com/rspec/rspec-rails/blob/1d2935861c89246236b46f77de753cda5ea67d61/Gemfile-rails-dependencies)
19+
[3](https://github.com/rspec/rspec-rails/blob/1d2935861c89246236b46f77de753cda5ea67d61/Gemfile-rspec-dependencies),
20+
to the [library code](https://github.com/rspec/rspec-rails/blob/1d2935861c89246236b46f77de753cda5ea67d61/lib/rspec/rails/configuration.rb#L128-L143),
21+
to the [test setup](https://github.com/rspec/rspec-rails/blob/1d2935861c89246236b46f77de753cda5ea67d61/Rakefile#L29-L53),
22+
to the [tests themselves](https://github.com/rspec/rspec-rails/blob/1d2935861c89246236b46f77de753cda5ea67d61/spec/rspec/rails/example/job_example_group_spec.rb)
23+
contain conditional execution based on which Rails version is currently loaded.
24+
This makes ongoing maintenance difficult, as it requires that RSpec Rails'
25+
maintainers be conscious of every Rails version that might be loaded.
26+
Acknowledging that, patches still sometimes break people's suites, due to the
27+
number of permutations of gems that can be loaded.
28+
29+
Our need is therefore best characterised by cost of maintenance. Having to
30+
maintain several versions of Rails and Ruby costs us a lot. It makes our
31+
development slower, and forces us to write against Rails versions that most
32+
people no longer use. I want RSpec Rails development to be fast, and
33+
lightweight, much like it was when I joined the RSpec project.
34+
35+
## Approach
36+
37+
The approach to fix this is an adjustment of versioning strategy. RSpec Rails
38+
will still continue to maintain a SemVer strategy, that is:
39+
40+
* Breaking changes in Majors
41+
* New features in Minors
42+
* Bug Fixes in Patchlevels
43+
44+
For the purposes of this versioning strategy, we consider removing a Rails or
45+
Ruby version to be a breaking change. We consider adding a Ruby or Rails version
46+
to be a Minor, along with normal feature releases.
47+
48+
The intent, however, is to change the cycle of these releases to align with
49+
Rails. Specifically, a Rails release cycle typically looks like:
50+
51+
* Release a Major X.0, (X-2).0 is no longer supported, all but the most recent
52+
(X--1) series are unsupported, introduces deprecation warnings for many
53+
features
54+
* Release a Minor X.1, deprecation warnings from X.0 are now errors
55+
* Release a Minor X.2, new features are added, some further deprecation warnings
56+
from X.1 may now be broken.
57+
58+
As such, RSpec Rails's new versioning strategy will be:
59+
60+
* Release a major with any Rails Major, removing support for any newly
61+
unsupported versions of Rails, and adding support for the new major.
62+
* Release a minor with any Rails Minor, adding support for the new features
63+
* Additionally, release minors for any new RSpec features
64+
* Release patchlevels frequently, as bugfixes occur.
65+
66+
As to the transition to this strategy: it is my intent to move to this strategy
67+
along with releasing support for Rails 5.2 for RSpec Rails, so relatively soon,
68+
dropping support for anything below Rails 4.2, and any Rubies below 2.2. This
69+
means that RSpec Rails 4.0.0 will be released within a handful of months from
70+
this RFC being accepted.
71+
72+
I do expect this to mean that the major version of RSpec Rails will increment
73+
relatively quickly with comparison to the rest of RSpec. I do not think that is
74+
necessarily a bad thing, it does not mean that the library is unstable as such,
75+
but rather that we are tracking our dependencies accurately.
76+
77+
Traditionally, RSpec Rails has been versioned at the same version number as
78+
RSpec. This will represent a departure from that. In order to maintain
79+
compatibility, RSpec Rails will continue to support the RSpec 3 series, and will
80+
probably add support for RSpec 4 without breaking changes. To do this, I intend
81+
to move off RSpec Rails using any private APIs from RSpec.
82+
83+
## Benefits
84+
85+
Execution of this strategy will greatly increase our ability to maintain RSpec,
86+
and release against modern Rails versions. While RSpec has been very stable and
87+
essentially continuously expanded Rails version support for the last few years,
88+
this has now become unsustainable and we want to take this tradeoff to best
89+
serve the needs of the community.
90+
91+
## Competition
92+
93+
### Do nothing
94+
95+
If we do this, it will become deeply unsustainable for us to maintain RSpec
96+
Rails in the future. We have too many Rails versions today, and we expect the
97+
rate of Rails releases to increase as time goes on. As such, it is our intent to
98+
start dropping Rails versions inline with Rails, in order to continue to improve
99+
the RSpec Rails gem.
100+
101+
### Keep inline versioning with RSpec
102+
103+
RSpec has a materially different versioning need to Rails. Specifically, RSpec
104+
as of today is a mostly entirely stable library. It's development needs are
105+
largely as feature proposals occur, or as bugs are found. RSpec has no external
106+
forces pushing versioning pressure on it (other than say, ruby and bundler,
107+
which are themselves, relatively stable). This is not true of RSpec Rails, which
108+
is popular, and there is a general expectation that RSpec will work with Rails
109+
applications, as of right now, we typically lag behind a Rails release by weeks
110+
when a Rails version gets released.
111+
112+
## Conclusions
113+
114+
It is my intent to ship this change relatively soon, inline with Rails 5.2
115+
support in the next few months. I really do think this represents the best
116+
future tradeoff for RSpec. If you strongly believe that dropping support for
117+
Rails versions lower than 4.2 will affect your needs, please do let us know so
118+
that we can consider the full weight of your use case.

script/clone_all_rspec_repos

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# This file was generated on 2019-04-01T20:23:57+02:00 from the rspec-dev repo.
2+
# This file was generated on 2019-07-24T15:33:53+02:00 from the rspec-dev repo.
33
# DO NOT modify it by hand as your changes will get lost the next time it is generated.
44

55
set -e

script/downgrade_bundler_on_old_rails

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ if ruby -e "exit(ENV['RAILS_VERSION'].scan(/\d+\.\d+.\d+/)[0].to_f < 5)"; then
1111

1212
gem uninstall -aIx bundler || echo "Warning error occured removing bundler via gem"
1313

14-
# this only works on Ruby 2.3 which is luckily the version we need to fix
15-
if is_ruby_23; then
16-
rvm @global do gem uninstall -aIx bundler
17-
fi
14+
# Delete all bundler version because we do not support Bundler 2+ below Rails 4
15+
rvm @global do gem uninstall -aIx bundler || true
1816

1917
gem install bundler -v '1.17.3'
2018
fi

script/functions.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file was generated on 2019-04-01T20:23:57+02:00 from the rspec-dev repo.
1+
# This file was generated on 2019-07-24T15:33:53+02:00 from the rspec-dev repo.
22
# DO NOT modify it by hand as your changes will get lost the next time it is generated.
33

44
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

script/predicate_functions.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file was generated on 2019-04-01T20:23:57+02:00 from the rspec-dev repo.
1+
# This file was generated on 2019-07-24T15:33:53+02:00 from the rspec-dev repo.
22
# DO NOT modify it by hand as your changes will get lost the next time it is generated.
33

44
function is_mri {

script/run_build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# This file was generated on 2019-04-01T20:23:57+02:00 from the rspec-dev repo.
2+
# This file was generated on 2019-07-24T15:33:53+02:00 from the rspec-dev repo.
33
# DO NOT modify it by hand as your changes will get lost the next time it is generated.
44

55
set -e

script/travis_functions.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file was generated on 2019-04-01T20:23:57+02:00 from the rspec-dev repo.
1+
# This file was generated on 2019-07-24T15:33:53+02:00 from the rspec-dev repo.
22
# DO NOT modify it by hand as your changes will get lost the next time it is generated.
33

44
# Taken from:

script/update_rubygems_and_install_bundler

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# This file was generated on 2019-04-01T20:23:57+02:00 from the rspec-dev repo.
2+
# This file was generated on 2019-07-24T15:33:53+02:00 from the rspec-dev repo.
33
# DO NOT modify it by hand as your changes will get lost the next time it is generated.
44

55
set -e

0 commit comments

Comments
 (0)