hanami-cucumber 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 27da288997ffcaa1ff1cce4b78a1fdcbd6daed91fdf7a03fcde7360e68420df1
4
+ data.tar.gz: 66143a0038a44ddb9d442c23b33d94cfa50f62e1f5e2552bc916efe5f485001c
5
+ SHA512:
6
+ metadata.gz: 7a2a58c48de01b0fe1ff52503f65a3064881a5d7ced004657e3b7e6a71321a86d0535055d9fad0de4b3c20f37a91fbaddb45d513724ae33b8ccd9047ab73b39e
7
+ data.tar.gz: 735600c1557c42e3fb674cc6a8db845995bd33835e7e86f35920606ec60cc1f7fbf01f3dcafb38103acd43c99e42bf234b184aaaf3e5ee2c7f32de10b28acce8
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,7 @@
1
+ # Please keep AllCops, Bundler, Style, Metrics groups and then order cops
2
+ # alphabetically
3
+ inherit_from:
4
+ - https://raw.githubusercontent.com/hanami/devtools/main/.rubocop.yml
5
+ Layout/LineLength:
6
+ Exclude:
7
+ - Gemfile
data/CHANGELOG.md ADDED
@@ -0,0 +1,4 @@
1
+ Hanami::Cucumber
2
+ ===
3
+
4
+ Cucumber support for Hanami
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at contact@aotoki.me. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 ZhenXian Qiu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,54 @@
1
+ Hanami::Cucumber
2
+ ===
3
+
4
+ Cucumber and testing support for [Hanami applications](https://github.com/hanami/hanami).
5
+
6
+ > [!WARNING]
7
+ > This gem still under development and not stable for now.
8
+
9
+ ## Status
10
+
11
+ [![CI](https://github.com/elct9620/hanami-cucumber/actions/workflows/main.yml/badge.svg)](https://github.com/elct9620/hanami-cucumber/actions/workflows/main.yml)
12
+
13
+ ## Rubies
14
+
15
+ **Hanami::Cucumber** supports Ruby (MRI) 3.0+
16
+
17
+ ## Installation
18
+
19
+ Add this line to your application's Gemfile:
20
+
21
+ ```ruby
22
+ group :cli, :development, :test do
23
+ gem "hanami-cucumber"
24
+ end
25
+ ```
26
+
27
+ And then execute:
28
+
29
+ ```
30
+ $ bundle install
31
+ $ bundle exec hanami setup
32
+ ```
33
+
34
+ ## Development
35
+
36
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
37
+
38
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
39
+
40
+ ## Contributing
41
+
42
+ Bug reports and pull requests are welcome on GitHub at https://github.com/elct9620/hanami-cucumber. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/elct9620/hanami-cucumber/blob/main/CODE_OF_CONDUCT.md).
43
+
44
+ ## License
45
+
46
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
47
+
48
+ ## Code of Conduct
49
+
50
+ Everyone interacting in the `Hanami::Cucumber` project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/elct9620/hanami-cucumber/blob/main/CODE_OF_CONDUCT.md).
51
+
52
+ ## Copyright
53
+
54
+ Copyright © 2023 ZhengXian Qiu – Released under MIT License
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hanami
4
+ module Cucumber
5
+ # @since 0.1.0
6
+ # @api private
7
+ module Bootstrap
8
+ module_function
9
+
10
+ # @since 0.1.0
11
+ # @api private
12
+ def boot
13
+ return unless from_cucumber?
14
+
15
+ ENV["HANAMI_ENV"] ||= "test"
16
+ require "hanami/prepare"
17
+ require_relative "support/world"
18
+ require_relative "support/capybara"
19
+ end
20
+
21
+ def from_cucumber?
22
+ caller.detect { |f| f.include? "/env.rb:" }
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hanami
4
+ module Cucumber
5
+ # @since 0.1.0
6
+ # @api private
7
+ module Commands
8
+ class Install < Hanami::CLI::Command
9
+ # @since 0.1.0
10
+ # @api private
11
+ def call(*, **)
12
+ append_gemfile
13
+ copy_env
14
+ copy_configuration
15
+ end
16
+
17
+ private
18
+
19
+ def append_gemfile
20
+ fs.append(
21
+ fs.expand_path("Gemfile"),
22
+ fs.read(fs.expand_path(fs.join("generators", "gemfile"), __dir__))
23
+ )
24
+ end
25
+
26
+ def copy_env
27
+ fs.cp(
28
+ fs.expand_path(fs.join("generators", "env.rb"), __dir__),
29
+ fs.expand_path(fs.join("features", "support", "env.rb"))
30
+ )
31
+ end
32
+
33
+ def copy_configuration
34
+ fs.cp(
35
+ fs.expand_path(fs.join("generators", "cucumber.yml"), __dir__),
36
+ fs.expand_path(fs.join("config", "cucumber.yml"))
37
+ )
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,9 @@
1
+ <%
2
+ rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
3
+ rerun = rerun.strip.gsub /\s/, ' '
4
+ rerun_opts = rerun.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
5
+ std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags 'not @wip'"
6
+ %>
7
+ default: <%= std_opts %> features
8
+ wip: --tags @wip:3 --wip features
9
+ rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags 'not @wip'
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "hanami/cucumber"
@@ -0,0 +1,6 @@
1
+ group :test do
2
+ gem "rack-test"
3
+
4
+ gem "capybara"
5
+ gem "selenium-webdriver"
6
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ Hanami::CLI::RakeTasks.register_tasks do
4
+ require "cucumber/rake/task"
5
+ namespace :cucumber do
6
+ Cucumber::Rake::Task.new(:ok, "Run features that should pass") do |t|
7
+ t.fork = true # You may get faster startup if you set this to false
8
+ t.profile = "default"
9
+ end
10
+
11
+ Cucumber::Rake::Task.new(:wip, "Run features that are being worked on") do |t|
12
+ t.fork = true # You may get faster startup if you set this to false
13
+ t.profile = "wip"
14
+ end
15
+
16
+ Cucumber::Rake::Task.new(:rerun, "Record failing features and run only them if any exist") do |t|
17
+ t.fork = true # You may get faster startup if you set this to false
18
+ t.profile = "rerun"
19
+ end
20
+
21
+ desc "Run all features"
22
+ task all: %i[ok wip]
23
+ end
24
+
25
+ desc "Alias for cucumber:ok"
26
+ task cucumber: "cucumber:ok"
27
+
28
+ task default: :cucumber
29
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "capybara"
4
+ require "capybara/cucumber"
5
+ require "capybara/session"
6
+
7
+ Capybara.app = Hanami.app
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rack/test"
4
+
5
+ module Hanami
6
+ module Cucumber
7
+ class World
8
+ include Rack::Test::Methods
9
+
10
+ def app
11
+ Hanami.app
12
+ end
13
+ end
14
+ end
15
+ end
16
+
17
+ World do
18
+ Hanami::Cucumber::World.new
19
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hanami
4
+ module Cucumber
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "hanami/cli"
4
+ require "zeitwerk"
5
+
6
+ # @see Hanami::Cucumber
7
+ # @since 0.1.0
8
+ module Hanami
9
+ # Cucumber and testing support for Hanami applications
10
+ #
11
+ # @since 0.1.0
12
+ # @api private
13
+ module Cucumber
14
+ # @since 0.1.0
15
+ # @api private
16
+ def self.gem_loader
17
+ @gem_loader ||= Zeitwerk::Loader.new.tap do |loader|
18
+ root = File.expand_path("..", __dir__)
19
+ loader.tag = "hanami-cucumber"
20
+ loader.inflector = Zeitwerk::GemInflector.new("#{root}/hanami-cucumber.rb")
21
+ loader.push_dir(root)
22
+ loader.ignore(
23
+ "#{root}/hanami-cucumber.rb",
24
+ "#{root}/hanami/cucumber/{rake_tasks,version}.rb",
25
+ "#{root}/hanami/cucumber/support"
26
+ )
27
+ loader.inflector.inflect("cucumber" => "Cucumber")
28
+ end
29
+ end
30
+
31
+ gem_loader.setup
32
+ require_relative "cucumber/version"
33
+ require_relative "cucumber/rake_tasks"
34
+
35
+ if Hanami::CLI.within_hanami_app?
36
+ Hanami::CLI.after "install", Commands::Install
37
+ end
38
+
39
+ Bootstrap.boot
40
+ end
41
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "hanami/cucumber"
@@ -0,0 +1,6 @@
1
+ module Hanami
2
+ module Cucumber
3
+ VERSION: String
4
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,137 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hanami-cucumber
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Aotokitsuruya
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-12-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: cucumber
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '9.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '9.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: hanami-cli
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '13.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '13.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: zeitwerk
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.6'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.6'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.59'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.59'
83
+ description: Hanami Cucumber generators and Rake tasks
84
+ email:
85
+ - contact@aotoki.me
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".rspec"
91
+ - ".rubocop.yml"
92
+ - CHANGELOG.md
93
+ - CODE_OF_CONDUCT.md
94
+ - LICENSE.txt
95
+ - README.md
96
+ - Rakefile
97
+ - lib/hanami-cucumber.rb
98
+ - lib/hanami/cucumber.rb
99
+ - lib/hanami/cucumber/bootstrap.rb
100
+ - lib/hanami/cucumber/commands.rb
101
+ - lib/hanami/cucumber/generators/cucumber.yml
102
+ - lib/hanami/cucumber/generators/env.rb
103
+ - lib/hanami/cucumber/generators/gemfile
104
+ - lib/hanami/cucumber/rake_tasks.rb
105
+ - lib/hanami/cucumber/support/capybara.rb
106
+ - lib/hanami/cucumber/support/world.rb
107
+ - lib/hanami/cucumber/version.rb
108
+ - sig/hanami/cucumber.rbs
109
+ homepage: https://github.com/elct9620/hanami-cucumber
110
+ licenses:
111
+ - MIT
112
+ metadata:
113
+ allowed_push_host: https://rubygems.org
114
+ homepage_uri: https://github.com/elct9620/hanami-cucumber
115
+ source_code_uri: https://github.com/elct9620/hanami-cucumber
116
+ changelog_uri: https://github.com/elct9620/hanami-cucumber/blob/main/CHANGELOG.md
117
+ rubygems_mfa_required: 'true'
118
+ post_install_message:
119
+ rdoc_options: []
120
+ require_paths:
121
+ - lib
122
+ required_ruby_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: 3.0.0
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ requirements: []
133
+ rubygems_version: 3.4.10
134
+ signing_key:
135
+ specification_version: 4
136
+ summary: Hanami Cucumber
137
+ test_files: []