Skip to content

Commit c75e524

Browse files
authored
Merge pull request #98 from rspec/prep-for-version-2-0-0
Modernise rspec-its, prepare version 2.0.0 dropping outdated RSpec / Ruby
2 parents 6dec295 + 8e3ceb1 commit c75e524

File tree

19 files changed

+513
-662
lines changed

19 files changed

+513
-662
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ on:
99
branches:
1010
- '*'
1111
env:
12-
BRANCH: '3-12-maintenance'
1312
RSPEC_CI: true
1413
jobs:
1514
test:
@@ -18,77 +17,30 @@ jobs:
1817
strategy:
1918
matrix:
2019
ruby:
20+
- '3.3'
2121
- '3.2'
2222
- '3.1'
2323
- '3.0'
24-
- 2.7
25-
- 2.6
26-
- 2.5
27-
- 2.4
28-
- 2.3
29-
- 2.2
30-
- 2.1.9
3124
env:
3225
-
3326
BRANCH: "main"
3427
include:
35-
- ruby: jruby-9.2.13.0
28+
- ruby: '3.3'
29+
name_extra: "against RSpec 3.13"
3630
env:
37-
JRUBY_OPTS: "--dev"
38-
# Compatibility builds
31+
BRANCH: "3-13-maintenance"
3932
- ruby: '3.2'
40-
name_extra: "against RSpec 3.12"
33+
name_extra: "against RSpec 3.13"
4134
env:
42-
BRANCH: "3-12-maintenance"
35+
BRANCH: "3-13-maintenance"
4336
- ruby: '3.1'
44-
name_extra: "against RSpec 3.11"
37+
name_extra: "against RSpec 3.13"
4538
env:
46-
BRANCH: "3-11-maintenance"
47-
- ruby: '3.1'
48-
name_extra: "against RSpec 3.10"
49-
env:
50-
BRANCH: "3-10-maintenance"
51-
- ruby: '3.0'
52-
name_extra: "against RSpec 3.9"
53-
env:
54-
BRANCH: "3-9-maintenance"
55-
- ruby: '3.0'
56-
name_extra: "against RSpec 3.8"
57-
env:
58-
BRANCH: "3-8-maintenance"
59-
- ruby: '3.0'
60-
name_extra: "against RSpec 3.7"
61-
env:
62-
BRANCH: "3-7-maintenance"
63-
- ruby: '3.0'
64-
name_extra: "against RSpec 3.6"
65-
env:
66-
BRANCH: "3-6-maintenance"
67-
- ruby: '3.0'
68-
name_extra: "against RSpec 3.5"
69-
env:
70-
BRANCH: "3-5-maintenance"
71-
- ruby: '3.0'
72-
name_extra: "against RSpec 3.4"
73-
env:
74-
BRANCH: "3-4-maintenance"
75-
- ruby: '3.0'
76-
name_extra: "against RSpec 3.3"
77-
env:
78-
BRANCH: "3-3-maintenance"
79-
- ruby: '3.0'
80-
name_extra: "against RSpec 3.2"
81-
env:
82-
BRANCH: "3-2-maintenance"
83-
- ruby: '3.0'
84-
name_extra: "against RSpec 3.1"
85-
env:
86-
BRANCH: "3-1-maintenance"
39+
BRANCH: "3-13-maintenance"
8740
- ruby: '3.0'
88-
name_extra: "against RSpec 3.0"
41+
name_extra: "against RSpec 3.13"
8942
env:
90-
BRANCH: "3-0-maintenance"
91-
43+
BRANCH: "3-13-maintenance"
9244
fail-fast: false
9345
continue-on-error: ${{ matrix.allow_failure || endsWith(matrix.ruby, 'head') }}
9446
env: ${{ matrix.env }}
@@ -101,31 +53,3 @@ jobs:
10153
- run: script/update_rubygems_and_install_bundler
10254
- run: bundle install --binstubs --standalone
10355
- run: script/test_all
104-
105-
legacy:
106-
name: Legacy Ruby Builds (${{ matrix.container.version }})
107-
runs-on: ubuntu-20.04
108-
container:
109-
image: ${{ matrix.container.tag }}
110-
options: ${{ matrix.container.options || '--add-host github-complains-if-this-is-empty.com:127.0.0.1' }}
111-
strategy:
112-
fail-fast: false
113-
matrix:
114-
container:
115-
- version: "2.0"
116-
tag: ghcr.io/rspec/docker-ci:2.0.0
117-
- version: "1.9.3"
118-
tag: ghcr.io/rspec/docker-ci:1.9.3
119-
- version: "JRuby 1.7"
120-
tag: ghcr.io/rspec/docker-ci:jruby-1.7
121-
- version: "JRuby 9.1.17.0"
122-
tag: ghcr.io/rspec/docker-ci:jruby-9.1.17.0
123-
options: "--add-host rubygems.org:151.101.129.227 --add-host api.rubygems.org:151.101.129.227"
124-
env:
125-
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
126-
LEGACY_CI: true
127-
JRUBY_OPTS: ${{ matrix.container.jruby_opts || '--dev' }}
128-
steps:
129-
- uses: actions/checkout@v3
130-
- run: script/legacy_setup.sh
131-
- run: script/test_all

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ spec/reports
1717
test/tmp
1818
test/version_tmp
1919
tmp
20+
bin/*

Changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
### 2.0.0.pre
2+
3+
Version 2.0.0 is a maintenance release, it drops support for Ruby below 3, and
4+
changes the supported RSpec version to "main" and current release series.
5+
(At the time of writing this is 3.13.x, but it means the current supported
6+
release only).
7+
18
### 1.3.1 / 2024-10-23
29
[full changelog](http://github.com/rspec/rspec-its/compare/v1.3.0...v1.3.1)
310

Gemfile

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,26 @@
1+
# frozen_string_literal: true
2+
13
source 'https://rubygems.org'
24

3-
# Specify your gem's dependencies in rspec-its.gemspec
45
gemspec
56

67
%w[rspec rspec-core rspec-expectations rspec-mocks rspec-support].each do |lib|
7-
branch = ENV.fetch('BRANCH','main')
8+
branch = ENV.fetch('BRANCH', 'main')
89
library_path = File.expand_path("../../#{lib}", __FILE__)
910

1011
if File.exist?(library_path) && !ENV['USE_GIT_REPOS']
11-
gem lib, :path => library_path
12+
gem lib, path: library_path
1213
elsif lib == 'rspec'
13-
gem 'rspec', :git => "https://github.com/rspec/rspec-metagem.git", :branch => branch
14+
gem 'rspec', git: "https://github.com/rspec/rspec-metagem.git", branch: branch
1415
else
15-
gem lib, :git => "https://github.com/rspec/#{lib}.git", :branch => branch
16+
gem lib, git: "https://github.com/rspec/#{lib}.git", branch: branch
1617
end
1718
end
1819

19-
if RUBY_VERSION < '2.2.0' && !!(RbConfig::CONFIG['host_os'] =~ /cygwin|mswin|mingw|bccwin|wince|emx/)
20-
gem 'ffi', '< 1.10'
21-
elsif RUBY_VERSION < '2.4.0' && !!(RbConfig::CONFIG['host_os'] =~ /cygwin|mswin|mingw|bccwin|wince|emx/)
22-
gem 'ffi', '< 1.15'
23-
elsif RUBY_VERSION < '2.0'
24-
gem 'ffi', '< 1.9.19' # ffi dropped Ruby 1.8 support in 1.9.19
25-
elsif RUBY_VERSION < '2.3.0'
26-
gem 'ffi', '~> 1.12.0'
27-
else
28-
gem 'ffi', '~> 1.15.0'
29-
end
30-
31-
# test coverage
32-
# gem 'simplecov', :require => false
33-
34-
gem 'contracts', '< 0.16' if RUBY_VERSION < '1.9.0'
35-
36-
gem 'coveralls', :require => false, :platform => :mri_20
37-
38-
eval File.read('Gemfile-custom') if File.exist?('Gemfile-custom')
20+
gem 'aruba', '~> 2.2.0'
21+
gem 'bundler', '> 2.0.0'
22+
gem 'coveralls', require: false
23+
gem 'cucumber', '>= 1.3.8'
24+
gem 'ffi', '~> 1.17.0'
25+
gem 'matrix', '~> 0.4.2'
26+
gem 'rake', '~> 13.2.0'

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
(The MIT License)
22

3+
Copyright (c) 2024 The RSpec Development Team
34
Copyright (c) 2013 Peter Alfvin
45
Copyright (c) 2012 David Chelimsky, Myron Marston
56
Copyright (c) 2006 David Chelimsky, The RSpec Development Team
6-
Copyright (c) 2005 Steven Baker
77

88
MIT License
99

README.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# RSpec::Its [![Build Status](https://travis-ci.org/rspec/rspec-its.svg)](https://travis-ci.org/rspec/rspec-its)
1+
# RSpec::Its [![Build Status](https://github.com/rspec/rspec-its/actions/workflows/ci.yml/badge.svg)](https://github.com/rspec/rspec-its/actions/workflows/ci.yml/badge.svg)
22

33
RSpec::Its provides the `its` method as a short-hand to specify the expected value of an attribute.
44

@@ -26,33 +26,31 @@ require 'rspec/its'
2626

2727
## Usage
2828

29-
Use the `its` method to generate a nested example group with
30-
a single example that specifies the expected value of an attribute of the
31-
subject using `should`, `should_not` or `is_expected`.
32-
The `its` method can also specify the block expectations of an attribute of the
33-
subject using `will` or `will_not`.
29+
Use the `its` method to generate a nested example group with a single example that specifies the expected value
30+
of an attribute of the subject using `is_expected`. The `its` method can also specify the block expectations of
31+
an attribute of the subject using `will` or `will_not`.
3432

3533
`its` accepts a symbol or a string, and a block representing the example.
3634

3735
```ruby
38-
its(:size) { should eq(1) }
39-
its("length") { should eq(1) }
36+
its(:size) { is_expected.to eq(1) }
37+
its("length") { is_expected.to eq(1) }
4038
```
4139

4240
You can use a string with dots to specify a nested attribute (i.e. an
4341
attribute of the attribute of the subject).
4442

4543
```ruby
46-
its("phone_numbers.size") { should_not eq(0) }
44+
its("phone_numbers.size") { is_expected.to_not eq(0) }
4745
```
4846

49-
The following expect-style method is also available:
47+
The following should-style method is also available:
5048

5149
```ruby
52-
its(:size) { is_expected.to eq(1) }
50+
its(:size) { should eq(1) }
5351
```
5452

55-
as is this alias for pluralized use:
53+
as is an alias of `is_expected` for pluralized use:
5654

5755
```ruby
5856
its(:keys) { are_expected.to eq([:key1, :key2]) }
@@ -88,13 +86,13 @@ For other objects, multiple keys within the array will be passed as separate arg
8886

8987
```ruby
9088
subject { Matrix[ [:a, :b], [:c, :d] ] }
91-
its([1,1]) { should eq(:d) }
89+
its([1,1]) { is_expected.to eq(:d) }
9290
```
9391

9492
Metadata arguments are supported.
9593

9694
```ruby
97-
its(:size, focus: true) { should eq(1) }
95+
its(:size, focus: true) { is_expected.to eq(1) }
9896
```
9997

10098
## Contributing

Rakefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require "bundler"
24
Bundler.setup
35
Bundler::GemHelper.install_tasks
@@ -13,4 +15,4 @@ RSpec::Core::RakeTask.new(:spec) do |t|
1315
t.ruby_opts = %w[-w]
1416
end
1517

16-
task :default => [:spec, :cucumber]
18+
task default: %i[spec cucumber]

0 commit comments

Comments
 (0)