hanami-rspec 2.1.0.rc1 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dbf21d5b7746adf7037bf9028868a3e0e101696f2d2a6b943683ca7e0243b37e
4
- data.tar.gz: 8239bea8a08ac6e60aa45681a5979bbe5a72da970c3ac06a125b7cfb1360918a
3
+ metadata.gz: d3f3869599052cc0752377dec54fffb80cd623976da4875c1b9ec1c9a4a02bbc
4
+ data.tar.gz: 7a603744efdc55db1777ab5efeb442446d31502fe74318c0e52a48b78df93fc4
5
5
  SHA512:
6
- metadata.gz: 4a4fe2ff34cdb0599c2352db2d2ff068ee414b199758d1bf2133b4442bf06917e5918cb41b8d3c83fdaa6baa8b9ab9b851235295dbc574bc64fbd0592e3ee7a3
7
- data.tar.gz: 955846cdaefbec231159dcdf96d2424a2449afda08bc650b33d68c7d6f5410b16026f1047781bdff3c36646e66e02467cbcaa457e480f4b009d31a254f45cd10
6
+ metadata.gz: 93af247f8a5835bf2537f4acc9ae5567ac3474b83860b3715af779f79187b509e4278f37af8eaebac505f3a40a9ec6856dc00bed347e09bd3ed347ae00dd9b97
7
+ data.tar.gz: d6f33d3d885b1bfd20e6e6b97fceef4b41641b28aea234471ff51050d7ff131b00230a8714c065955afcf80e0e09cbafbe618056bbccfd419a24881687b9ef7e
@@ -1,20 +1,20 @@
1
1
  name: ci
2
2
 
3
- 'on':
3
+ "on":
4
4
  push:
5
5
  paths:
6
- - '.github/workflows/ci.yml'
7
- - 'lib/**'
8
- - '*.gemspec'
9
- - 'spec/**'
10
- - 'Rakefile'
11
- - 'Gemfile'
12
- - '.rubocop.yml'
6
+ - ".github/workflows/ci.yml"
7
+ - "lib/**"
8
+ - "*.gemspec"
9
+ - "spec/**"
10
+ - "Rakefile"
11
+ - "Gemfile"
12
+ - ".rubocop.yml"
13
13
  pull_request:
14
14
  branches:
15
15
  - main
16
16
  schedule:
17
- - cron: '30 4 * * *'
17
+ - cron: "30 4 * * *"
18
18
  create:
19
19
 
20
20
  jobs:
@@ -24,20 +24,21 @@ jobs:
24
24
  fail-fast: false
25
25
  matrix:
26
26
  ruby:
27
- - '3.2'
28
- - '3.1'
29
- - '3.0'
27
+ - "3.3"
28
+ - "3.2"
29
+ - "3.1"
30
+ - "3.0"
30
31
  steps:
31
32
  - uses: ravsamhq/notify-slack-action@v1
32
33
  if: always()
33
34
  with:
34
35
  status: ${{ job.status }}
35
- notify_when: 'failure'
36
+ notify_when: "failure"
36
37
  env:
37
38
  SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
38
39
  - uses: actions/checkout@v1
39
40
  - name: Install package dependencies
40
- run: '[ -e $APT_DEPS ] || sudo apt-get install -y --no-install-recommends $APT_DEPS'
41
+ run: "[ -e $APT_DEPS ] || sudo apt-get install -y --no-install-recommends $APT_DEPS"
41
42
  - name: Set up Ruby
42
43
  uses: ruby/setup-ruby@v1
43
44
  with:
data/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  RSpec support for Hanami
4
4
 
5
+ ## v2.1.0 - 2024-02-27
6
+
7
+ ## v2.1.0.rc3 - 2024-02-16
8
+
9
+ ## v2.1.0.rc2 - 2023-11-08
10
+
11
+ ### Added
12
+
13
+ - [Tim Riley] Skip generating tests for `hanami generate` when `--skip-tests` CLI option is given.
14
+ - [Tim Riley] Install Capybara and generate `spec/support/capybara.rb` in `hanami install` hook.
15
+
16
+ ### Changed
17
+
18
+ - [Tim Riley] Add explanatory code comments to `spec/support/rspec.rb` generated in `hanami install` hook.
19
+
5
20
  ## v2.1.0.rc1 - 2023-11-01
6
21
 
7
22
  ### Added
data/Gemfile CHANGED
@@ -4,12 +4,13 @@ source "https://rubygems.org"
4
4
  gemspec
5
5
 
6
6
  unless ENV["CI"]
7
- gem "byebug", require: false, platforms: :mri
8
- gem "yard", require: false
7
+ gem "byebug", platforms: :mri
8
+ gem "yard"
9
9
  end
10
10
 
11
- gem "dry-files", require: false, git: "https://github.com/dry-rb/dry-files.git", branch: "main"
12
- gem "dry-logger", require: false, git: "https://github.com/dry-rb/dry-logger.git", branch: "main"
13
- gem "hanami-utils", require: false, git: "https://github.com/hanami/utils.git", branch: "main"
14
- gem "hanami-cli", require: false, git: "https://github.com/hanami/cli.git", branch: "main"
15
- gem "hanami", require: false, git: "https://github.com/hanami/hanami.git", branch: "main"
11
+ gem "dry-files", github: "dry-rb/dry-files", branch: "main"
12
+ gem "dry-logger", github: "dry-rb/dry-logger", branch: "main"
13
+
14
+ gem "hanami-utils", github: "hanami/utils", branch: "main"
15
+ gem "hanami-cli", github: "hanami/cli", branch: "main"
16
+ gem "hanami", github: "hanami/hanami", branch: "main"
data/hanami-rspec.gemspec CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
30
  spec.require_paths = ["lib"]
31
31
 
32
- spec.add_dependency "hanami-cli", "~> 2.0"
32
+ spec.add_dependency "hanami-cli", "~> 2.1"
33
33
  spec.add_dependency "rspec", "~> 3.12"
34
34
  spec.add_dependency "rake", "~> 13.0"
35
35
  spec.add_dependency "zeitwerk", "~> 2.6"
@@ -14,9 +14,11 @@ module Hanami
14
14
  # @api private
15
15
  def call(*, **)
16
16
  append_gemfile
17
+ append_gitignore
17
18
  copy_dotrspec
18
19
  copy_spec_helper
19
20
  copy_support_rspec
21
+ copy_support_features
20
22
  copy_support_requests
21
23
 
22
24
  generate_request_spec
@@ -27,9 +29,14 @@ module Hanami
27
29
  def append_gemfile
28
30
  fs.append(
29
31
  fs.expand_path("Gemfile"),
30
- fs.read(
31
- fs.expand_path(fs.join("generators", "gemfile"), __dir__)
32
- ),
32
+ fs.read(fs.expand_path(fs.join("generators", "gemfile"), __dir__))
33
+ )
34
+ end
35
+
36
+ def append_gitignore
37
+ fs.append(
38
+ fs.expand_path(".gitignore"),
39
+ fs.read(fs.expand_path(fs.join("generators", "gitignore"), __dir__))
33
40
  )
34
41
  end
35
42
 
@@ -54,6 +61,13 @@ module Hanami
54
61
  )
55
62
  end
56
63
 
64
+ def copy_support_features
65
+ fs.cp(
66
+ fs.expand_path(fs.join("generators", "support_features.rb"), __dir__),
67
+ fs.expand_path(fs.join("spec", "support", "features.rb"))
68
+ )
69
+ end
70
+
57
71
  def copy_support_requests
58
72
  fs.cp(
59
73
  fs.expand_path(fs.join("generators", "support_requests.rb"), __dir__),
@@ -91,6 +105,9 @@ module Hanami
91
105
  # @api private
92
106
  def call(options, **)
93
107
  # FIXME: dry-cli kwargs aren't correctly forwarded in Ruby 3
108
+
109
+ return if options[:skip_tests]
110
+
94
111
  slice = inflector.underscore(Shellwords.shellescape(options[:slice])) if options[:slice]
95
112
  name = inflector.underscore(Shellwords.shellescape(options[:name]))
96
113
  *controller, action = name.split(ACTION_SEPARATOR)
@@ -107,6 +124,9 @@ module Hanami
107
124
  # @api private
108
125
  def call(options, **)
109
126
  # FIXME: dry-cli kwargs aren't correctly forwarded in Ruby 3
127
+
128
+ return if options[:skip_tests]
129
+
110
130
  slice = inflector.underscore(Shellwords.shellescape(options[:slice])) if options[:slice]
111
131
  name = inflector.underscore(Shellwords.shellescape(options[:name]))
112
132
 
@@ -1,4 +1,5 @@
1
1
 
2
2
  group :test do
3
+ gem "capybara"
3
4
  gem "rack-test"
4
5
  end
@@ -0,0 +1 @@
1
+ spec/examples.txt
@@ -7,4 +7,5 @@ ENV["HANAMI_ENV"] ||= "test"
7
7
  require "hanami/prepare"
8
8
 
9
9
  require_relative "support/rspec"
10
+ require_relative "support/features"
10
11
  require_relative "support/requests"
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "capybara/rspec"
4
+
5
+ Capybara.app = Hanami.app
@@ -2,11 +2,12 @@
2
2
 
3
3
  require "rack/test"
4
4
 
5
- RSpec.shared_context "Hanami app" do
5
+ RSpec.shared_context "Rack::Test" do
6
+ # Define the app for Rack::Test requests
6
7
  let(:app) { Hanami.app }
7
8
  end
8
9
 
9
10
  RSpec.configure do |config|
10
11
  config.include Rack::Test::Methods, type: :request
11
- config.include_context "Hanami app", type: :request
12
+ config.include_context "Rack::Test", type: :request
12
13
  end
@@ -1,27 +1,61 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  RSpec.configure do |config|
4
+ # Use the recommended non-monkey patched syntax.
5
+ config.disable_monkey_patching!
6
+
7
+ # Use and configure rspec-expectations.
4
8
  config.expect_with :rspec do |expectations|
9
+ # This option will default to `true` in RSpec 4.
5
10
  expectations.include_chain_clauses_in_custom_matcher_descriptions = true
6
11
  end
7
12
 
13
+ # Use and configure rspec-mocks.
8
14
  config.mock_with :rspec do |mocks|
15
+ # Prevents you from mocking or stubbing a method that does not exist on a
16
+ # real object.
9
17
  mocks.verify_partial_doubles = true
10
18
  end
11
19
 
20
+ # This option will default to `:apply_to_host_groups` in RSpec 4.
12
21
  config.shared_context_metadata_behavior = :apply_to_host_groups
13
22
 
23
+ # Limit a spec run to individual examples or groups you care about by tagging
24
+ # them with `:focus` metadata. When nothing is tagged with `:focus`, all
25
+ # examples get run.
26
+ #
27
+ # RSpec also provides aliases for `it`, `describe`, and `context` that include
28
+ # `:focus` metadata: `fit`, `fdescribe` and `fcontext`, respectively.
14
29
  config.filter_run_when_matching :focus
15
30
 
16
- config.disable_monkey_patching!
17
- config.warnings = true
31
+ # Allow RSpec to persist some state between runs in order to support the
32
+ # `--only-failures` and `--next-failure` CLI options. We recommend you
33
+ # configure your source control system to ignore this file.
34
+ config.example_status_persistence_file_path = "spec/examples.txt"
18
35
 
36
+ # Uncomment this to enable warnings. This is recommended, but in some cases
37
+ # may be too noisy due to issues in dependencies.
38
+ # config.warnings = true
39
+
40
+ # Show more verbose output when running an individual spec file.
19
41
  if config.files_to_run.one?
20
42
  config.default_formatter = "doc"
21
43
  end
22
44
 
45
+ # Print the 10 slowest examples and example groups at the end of the spec run,
46
+ # to help surface which specs are running particularly slow.
23
47
  config.profile_examples = 10
24
48
 
49
+ # Run specs in random order to surface order dependencies. If you find an
50
+ # order dependency and want to debug it, you can fix the order by providing
51
+ # the seed, which is printed after each run:
52
+ #
53
+ # --seed 1234
25
54
  config.order = :random
55
+
56
+ # Seed global randomization in this process using the `--seed` CLI option.
57
+ # This allows you to use `--seed` to deterministically reproduce test failures
58
+ # related to randomization by passing the same `--seed` value as the one that
59
+ # triggered the failure.
26
60
  Kernel.srand config.seed
27
61
  end
@@ -6,6 +6,6 @@ module Hanami
6
6
  #
7
7
  # @since 2.0.0
8
8
  # @api public
9
- VERSION = "2.1.0.rc1"
9
+ VERSION = "2.1.0"
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanami-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.rc1
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-01 00:00:00.000000000 Z
11
+ date: 2024-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hanami-cli
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
19
+ version: '2.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.0'
26
+ version: '2.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +108,7 @@ files:
108
108
  - lib/hanami/rspec/generators/action/action_spec.erb
109
109
  - lib/hanami/rspec/generators/dotrspec
110
110
  - lib/hanami/rspec/generators/gemfile
111
+ - lib/hanami/rspec/generators/gitignore
111
112
  - lib/hanami/rspec/generators/helper.rb
112
113
  - lib/hanami/rspec/generators/part.rb
113
114
  - lib/hanami/rspec/generators/part/part_base_spec.erb
@@ -120,6 +121,7 @@ files:
120
121
  - lib/hanami/rspec/generators/slice/keep.erb
121
122
  - lib/hanami/rspec/generators/slice/repository_spec.erb
122
123
  - lib/hanami/rspec/generators/slice/view_spec.erb
124
+ - lib/hanami/rspec/generators/support_features.rb
123
125
  - lib/hanami/rspec/generators/support_requests.rb
124
126
  - lib/hanami/rspec/generators/support_rspec.rb
125
127
  - lib/hanami/rspec/rake_tasks.rb
@@ -144,11 +146,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
144
146
  version: 3.0.0
145
147
  required_rubygems_version: !ruby/object:Gem::Requirement
146
148
  requirements:
147
- - - ">"
149
+ - - ">="
148
150
  - !ruby/object:Gem::Version
149
- version: 1.3.1
151
+ version: '0'
150
152
  requirements: []
151
- rubygems_version: 3.4.13
153
+ rubygems_version: 3.5.6
152
154
  signing_key:
153
155
  specification_version: 4
154
156
  summary: Hanami RSpec