hanami-rspec 2.1.0.rc1 → 2.1.0.rc2

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: 213e19981cb640eec5aca246cafc481ad481731099a0c58b391fcb41a17300c7
4
+ data.tar.gz: a67b4291aa541a722e5460bf403aa9f203d770476c3b3a0b823c7cb056f676e0
5
5
  SHA512:
6
- metadata.gz: 4a4fe2ff34cdb0599c2352db2d2ff068ee414b199758d1bf2133b4442bf06917e5918cb41b8d3c83fdaa6baa8b9ab9b851235295dbc574bc64fbd0592e3ee7a3
7
- data.tar.gz: 955846cdaefbec231159dcdf96d2424a2449afda08bc650b33d68c7d6f5410b16026f1047781bdff3c36646e66e02467cbcaa457e480f4b009d31a254f45cd10
6
+ metadata.gz: 4c4d92b324e878aa771f045e592b1e35e6bb80f375dba7b9ac80bab120d29cb1ac06e036006dfe3ab504510b437f6ab99af94aed2d8b949ea0289f4e5bbbf604
7
+ data.tar.gz: 984fe9016a17887063c2e4e1545cf9b5344fb3faa7ce42cc22516912cdd1753c6f33cb99d72c33f264855df804266f81925c73b5e09b13b3bac64a850fdd1f00
data/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  RSpec support for Hanami
4
4
 
5
+ ## v2.1.0.rc2 - 2023-11-08
6
+
7
+ ### Added
8
+
9
+ - [Tim Riley] Skip generating tests for `hanami generate` when `--skip-tests` CLI option is given.
10
+ - [Tim Riley] Install Capybara and generate `spec/support/capybara.rb` in `hanami install` hook.
11
+
12
+ ### Changed
13
+
14
+ - [Tim Riley] Add explanatory code comments to `spec/support/rspec.rb` generated in `hanami install` hook.
15
+
5
16
  ## v2.1.0.rc1 - 2023-11-01
6
17
 
7
18
  ### Added
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.rc"
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.rc2"
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.rc2
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: 2023-11-08 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.rc
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.rc
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
@@ -148,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
150
  - !ruby/object:Gem::Version
149
151
  version: 1.3.1
150
152
  requirements: []
151
- rubygems_version: 3.4.13
153
+ rubygems_version: 3.4.21
152
154
  signing_key:
153
155
  specification_version: 4
154
156
  summary: Hanami RSpec