auto_rspec 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: 3e192c716f1e3d3e213787cd2c43310e19d2e4a5a87809beb7cd7bb91ec5a27c
4
+ data.tar.gz: 75d70ba2d4021a1695ac8ea51efb8bac84561aace4e4e5b6be74eb7b6ca80db8
5
+ SHA512:
6
+ metadata.gz: 9c213a539206c43d3d03ca9473979e4472f3e6d8367adfef4161ae7bc9b29c57b4c12dcdba12346b5eea7b38fe2894663c8d5cf029b05c71d5e012224566fa17
7
+ data.tar.gz: 82a1e2f2cc2d1e57a538209b31bf6b6177f17981f4a0063e2440df3d50ea75fee5092261bea5cf16fe1b2d3f3a10a856a4523e2f2c40259cbcdd02e7091271f3
data/.idea/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Editor-based HTTP Client requests
5
+ /httpRequests/
6
+ # Datasource local storage ignored files
7
+ /dataSources/
8
+ /dataSources.local.xml
@@ -0,0 +1,133 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared />
5
+ </component>
6
+ <component name="NewModuleRootManager">
7
+ <content url="file://$MODULE_DIR$">
8
+ <sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
9
+ <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
10
+ <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
11
+ </content>
12
+ <orderEntry type="inheritedJdk" />
13
+ <orderEntry type="sourceFolder" forTests="false" />
14
+ <orderEntry type="library" scope="PROVIDED" name="actioncable (v7.0.5, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="actionmailbox (v7.0.5, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="actionmailer (v7.0.5, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="actionpack (v7.0.5, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="actiontext (v7.0.5, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="actionview (v7.0.5, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="activejob (v7.0.5, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="activemodel (v7.0.5, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
22
+ <orderEntry type="library" scope="PROVIDED" name="activerecord (v7.0.5, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
23
+ <orderEntry type="library" scope="PROVIDED" name="activestorage (v7.0.5, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
24
+ <orderEntry type="library" scope="PROVIDED" name="activesupport (v7.0.5, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
25
+ <orderEntry type="library" scope="PROVIDED" name="aruba (v2.1.0, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
26
+ <orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
27
+ <orderEntry type="library" scope="PROVIDED" name="builder (v3.2.4, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
28
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v2.4.10, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
29
+ <orderEntry type="library" scope="PROVIDED" name="childprocess (v4.1.0, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
30
+ <orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.2.2, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
31
+ <orderEntry type="library" scope="PROVIDED" name="contracts (v0.17, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
32
+ <orderEntry type="library" scope="PROVIDED" name="crass (v1.0.6, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
33
+ <orderEntry type="library" scope="PROVIDED" name="cucumber (v8.0.0, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
34
+ <orderEntry type="library" scope="PROVIDED" name="cucumber-ci-environment (v9.2.0, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
35
+ <orderEntry type="library" scope="PROVIDED" name="cucumber-core (v11.0.0, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
36
+ <orderEntry type="library" scope="PROVIDED" name="cucumber-cucumber-expressions (v15.2.0, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
37
+ <orderEntry type="library" scope="PROVIDED" name="cucumber-gherkin (v23.0.1, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
38
+ <orderEntry type="library" scope="PROVIDED" name="cucumber-html-formatter (v19.2.0, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
39
+ <orderEntry type="library" scope="PROVIDED" name="cucumber-messages (v18.0.0, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
40
+ <orderEntry type="library" scope="PROVIDED" name="cucumber-tag-expressions (v4.1.0, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
41
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.5.0, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
42
+ <orderEntry type="library" scope="PROVIDED" name="erubi (v1.12.0, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
43
+ <orderEntry type="library" scope="PROVIDED" name="ffi (v1.15.5, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
44
+ <orderEntry type="library" scope="PROVIDED" name="globalid (v1.1.0, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
45
+ <orderEntry type="library" scope="PROVIDED" name="i18n (v1.13.0, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
46
+ <orderEntry type="library" scope="PROVIDED" name="json (v2.6.3, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
47
+ <orderEntry type="library" scope="PROVIDED" name="loofah (v2.21.3, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
48
+ <orderEntry type="library" scope="PROVIDED" name="mail (v2.8.1, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
49
+ <orderEntry type="library" scope="PROVIDED" name="marcel (v1.0.2, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
50
+ <orderEntry type="library" scope="PROVIDED" name="method_source (v1.0.0, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
51
+ <orderEntry type="library" scope="PROVIDED" name="mime-types (v3.4.1, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
52
+ <orderEntry type="library" scope="PROVIDED" name="mime-types-data (v3.2023.0218.1, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
53
+ <orderEntry type="library" scope="PROVIDED" name="mini_mime (v1.1.2, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
54
+ <orderEntry type="library" scope="PROVIDED" name="minitest (v5.18.0, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
55
+ <orderEntry type="library" scope="PROVIDED" name="multi_test (v1.1.0, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
56
+ <orderEntry type="library" scope="PROVIDED" name="net-imap (v0.3.4, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
57
+ <orderEntry type="library" scope="PROVIDED" name="net-pop (v0.1.2, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
58
+ <orderEntry type="library" scope="PROVIDED" name="net-smtp (v0.3.3, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
59
+ <orderEntry type="library" scope="PROVIDED" name="nio4r (v2.5.9, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
60
+ <orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.15.2, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
61
+ <orderEntry type="library" scope="PROVIDED" name="parallel (v1.23.0, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
62
+ <orderEntry type="library" scope="PROVIDED" name="parser (v3.2.2.1, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
63
+ <orderEntry type="library" scope="PROVIDED" name="racc (v1.6.2, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
64
+ <orderEntry type="library" scope="PROVIDED" name="rack (v2.2.7, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
65
+ <orderEntry type="library" scope="PROVIDED" name="rack-test (v2.1.0, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
66
+ <orderEntry type="library" scope="PROVIDED" name="rails (v7.0.5, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
67
+ <orderEntry type="library" scope="PROVIDED" name="rails-dom-testing (v2.0.3, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
68
+ <orderEntry type="library" scope="PROVIDED" name="rails-html-sanitizer (v1.6.0, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
69
+ <orderEntry type="library" scope="PROVIDED" name="railties (v7.0.5, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
70
+ <orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
71
+ <orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
72
+ <orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.8.0, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
73
+ <orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.5, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
74
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v3.12.0, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
75
+ <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.12.2, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
76
+ <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.12.3, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
77
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.12.5, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
78
+ <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.12.0, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
79
+ <orderEntry type="library" scope="PROVIDED" name="rubocop (v1.51.0, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
80
+ <orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.28.1, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
81
+ <orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.13.0, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
82
+ <orderEntry type="library" scope="PROVIDED" name="shoulda-matchers (v5.3.0, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
83
+ <orderEntry type="library" scope="PROVIDED" name="sys-uname (v1.2.3, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
84
+ <orderEntry type="library" scope="PROVIDED" name="thor (v1.2.2, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
85
+ <orderEntry type="library" scope="PROVIDED" name="timeout (v0.3.2, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
86
+ <orderEntry type="library" scope="PROVIDED" name="tzinfo (v2.0.6, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
87
+ <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.4.2, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
88
+ <orderEntry type="library" scope="PROVIDED" name="websocket-driver (v0.7.5, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
89
+ <orderEntry type="library" scope="PROVIDED" name="websocket-extensions (v0.1.5, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
90
+ <orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.6.8, RVM: ruby-3.2.2 [global]) [gem]" level="application" />
91
+ </component>
92
+ <component name="RakeTasksCache">
93
+ <option name="myRootTask">
94
+ <RakeTaskImpl id="rake">
95
+ <subtasks>
96
+ <RakeTaskImpl description="Build auto_rspec-0.1.0.gem into the pkg directory" fullCommand="build" id="build" />
97
+ <RakeTaskImpl id="build">
98
+ <subtasks>
99
+ <RakeTaskImpl description="Generate SHA512 checksum if auto_rspec-0.1.0.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
100
+ </subtasks>
101
+ </RakeTaskImpl>
102
+ <RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
103
+ <RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
104
+ <RakeTaskImpl description="Build and install auto_rspec-0.1.0.gem into system gems" fullCommand="install" id="install" />
105
+ <RakeTaskImpl id="install">
106
+ <subtasks>
107
+ <RakeTaskImpl description="Build and install auto_rspec-0.1.0.gem into system gems without network access" fullCommand="install:local" id="local" />
108
+ </subtasks>
109
+ </RakeTaskImpl>
110
+ <RakeTaskImpl description="Create tag v0.1.0 and build and push auto_rspec-0.1.0.gem to TODO: Set to your gem server 'https://example.com'" fullCommand="release[remote]" id="release[remote]" />
111
+ <RakeTaskImpl description="Run RuboCop" fullCommand="rubocop" id="rubocop" />
112
+ <RakeTaskImpl id="rubocop">
113
+ <subtasks>
114
+ <RakeTaskImpl description="Autocorrect RuboCop offenses (only when it's safe)" fullCommand="rubocop:autocorrect" id="autocorrect" />
115
+ <RakeTaskImpl description="Autocorrect RuboCop offenses (safe and unsafe)" fullCommand="rubocop:autocorrect_all" id="autocorrect_all" />
116
+ <RakeTaskImpl description="" fullCommand="rubocop:auto_correct" id="auto_correct" />
117
+ </subtasks>
118
+ </RakeTaskImpl>
119
+ <RakeTaskImpl description="Run RSpec code examples" fullCommand="spec" id="spec" />
120
+ <RakeTaskImpl description="" fullCommand="default" id="default" />
121
+ <RakeTaskImpl description="" fullCommand="release" id="release" />
122
+ <RakeTaskImpl id="release">
123
+ <subtasks>
124
+ <RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
125
+ <RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
126
+ <RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
127
+ </subtasks>
128
+ </RakeTaskImpl>
129
+ </subtasks>
130
+ </RakeTaskImpl>
131
+ </option>
132
+ </component>
133
+ </module>
data/.idea/misc.xml ADDED
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-3.2.2 [global]" project-jdk-type="RUBY_SDK" />
4
+ </project>
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/auto_rspec.iml" filepath="$PROJECT_DIR$/.idea/auto_rspec.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2023-05-23
4
+
5
+ - Initial release
@@ -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 b15042002@gmail.com. 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/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in auto_rspec.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
11
+
12
+ gem "rubocop", "~> 1.21"
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Ivan_Bastylo
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,39 @@
1
+ # AutoRspec
2
+
3
+ TODO: Delete this and the text below, and describe your gem
4
+
5
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/auto_rspec`. To experiment with that code, run `bin/console` for an interactive prompt.
6
+
7
+ ## Installation
8
+
9
+ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
+
11
+ Install the gem and add to the application's Gemfile by executing:
12
+
13
+ $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
14
+
15
+ If bundler is not being used to manage dependencies, install the gem by executing:
16
+
17
+ $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Development
24
+
25
+ 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.
26
+
27
+ 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).
28
+
29
+ ## Contributing
30
+
31
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/auto_rspec. 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/[USERNAME]/auto_rspec/blob/main/CODE_OF_CONDUCT.md).
32
+
33
+ ## License
34
+
35
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
36
+
37
+ ## Code of Conduct
38
+
39
+ Everyone interacting in the AutoRspec project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/auto_rspec/blob/main/CODE_OF_CONDUCT.md).
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,18 @@
1
+ require "thor"
2
+ require 'auto_rspec'
3
+
4
+ require "auto_rspec/generators/auto_rspec/auto_rspec_generator"
5
+
6
+ module AutoRspec
7
+ class CLI < Thor
8
+ desc "generate", "Generates a rspec file for a given file"
9
+ def generate(dir_path)
10
+ AutoRspecGenerator.start([dir_path])
11
+ end
12
+
13
+ # # synonym for generate
14
+ # def g(dir_path)
15
+ # generate(dir_path)
16
+ # end
17
+ end
18
+ end
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Generates a spec file with all possible shoulda-matchers tests for the model
3
+
4
+ Example:
5
+ bin/rails generate auto_rspec test_model
6
+
7
+ This will create:
8
+ spec/test_model_spec.rb with all possible shoulda-matchers tests for the model
@@ -0,0 +1,68 @@
1
+ require 'thor/group'
2
+ require "auto_rspec/generators/auto_rspec/parsers/application_record_parser"
3
+
4
+ # todo temporary
5
+ #
6
+ # Dir['auto_rspec/generators/auto_rspec/parsers/*.rb'].each { |file| require file }
7
+ require 'active_model'
8
+ require 'active_record'
9
+ require 'action_controller'
10
+
11
+ class AutoRspecGenerator < Thor::Group
12
+ # source_root File.expand_path('../templates', __FILE__)
13
+
14
+ include Thor::Actions
15
+ include ActiveRecordParser
16
+
17
+ argument :file_path, :type => :string
18
+
19
+ def create_spec_file
20
+ # error message if not appropriate path provided
21
+ return puts "#{file_path} doesn't exist!" unless File.exist?(file_path)
22
+
23
+ # todo replace
24
+ file_name = File.basename(file_path)
25
+
26
+ directories = File.dirname(file_path).split('/').drop(1)
27
+ spec_path = 'spec/' + directories.join('/') + "/#{File.basename(file_path, '.*')}_spec.rb"
28
+
29
+ # todo replace
30
+ class_name = converted_string = file_path.dup.split('/').map(&:capitalize).join('::')
31
+
32
+ # parse classes
33
+ @class_name = class_name.split('.').first
34
+ until @class_name.empty? || Object.const_defined?(@class_name)
35
+ @class_name = @class_name.split('::').drop(1).join('::')
36
+ end
37
+ the_class = Module.const_get(@class_name) unless @class_name.empty?
38
+
39
+ if the_class.nil?
40
+ puts "Spec generation for provided file doesn't supported. Please use it only for ApplicationRecord/ActiveModel classes"
41
+ elsif the_class < ActiveRecord::Base
42
+ create_spec_directory(directories)
43
+ @active_record_matchers = parse_active_record(the_class)
44
+ template "application_record.erb", spec_path
45
+ elsif the_class < ActiveModel
46
+ create_spec_directory(directories)
47
+ @active_model_matchers = parse_active_model(the_class)
48
+ template "active_model.erb", spec_path
49
+ elsif the_class < ApplicationController
50
+ create_spec_directory(directories)
51
+ @application_controller_matchers = parse_application_controller(the_class)
52
+ template "application_controller.erb", spec_path
53
+ else
54
+ puts "Spec generation for provided file doesn't supported. Please use it only for ApplicationRecord/ActiveModel classes"
55
+ end
56
+ end
57
+
58
+ private
59
+
60
+ # Creates spec directory if it doesn't exist
61
+ def create_spec_directory(directories)
62
+ spec_dir_path = 'spec/'
63
+ directories.each do |directory|
64
+ spec_dir_path += "#{directory}/"
65
+ Dir.mkdir(spec_dir_path) unless File.exist?(spec_dir_path)
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,61 @@
1
+ module ActiveRecordParser
2
+ def parse_active_record(the_class)
3
+ active_record_matchers = {}
4
+ active_record_matchers[:relations] = parse_relations(the_class.reflect_on_all_associations)
5
+ active_record_matchers[:nested_attributes] = the_class.nested_attributes_options
6
+ active_record_matchers[:enums] = the_class.defined_enums
7
+ active_record_matchers[:db_columns] = the_class.columns.map(&:name).drop(3)
8
+ active_record_matchers[:db_indexes] = parse_db_indexes(the_class)
9
+ active_record_matchers[:implicit_order_columns] = [the_class.implicit_order_column].flatten
10
+ active_record_matchers[:readonly_attributes] = the_class.readonly_attributes
11
+
12
+ active_record_matchers
13
+ end
14
+
15
+ private
16
+
17
+ def parse_relations(associations)
18
+ relations = {
19
+ belongs_to: [],
20
+ has_many: [],
21
+ has_one: [],
22
+ has_and_belongs_to_many: []
23
+ }
24
+ associations.each do |association|
25
+ case association.macro
26
+ when :belongs_to
27
+ relations[:belongs_to] << association.name
28
+ when :has_many
29
+ relations[:has_many] << association.name
30
+ when :has_one
31
+ relations[:has_one] << association.name
32
+ when :has_and_belongs_to_many
33
+ relations[:has_and_belongs_to_many] << association.name
34
+ end
35
+ end
36
+
37
+ return nil if relations.values.all?(&:empty?)
38
+ relations
39
+ end
40
+
41
+ def parse_serialized_attributes(the_class)
42
+ serialized_attributes = []
43
+
44
+ the_class.attribute_names.each do |attribute_name|
45
+ column = the_class.column_for_attribute(attribute_name)
46
+ serialized_attributes << attribute_name if column&.type == :text && column&.cast_type&.is_a?(ActiveRecord::Type::Serialized)
47
+ end
48
+
49
+ serialized_attributes
50
+ end
51
+
52
+ def parse_db_indexes(the_class)
53
+ db_indexes = {}
54
+ the_class.connection.indexes(the_class.table_name).map { { _1.unique => _1.columns.first } }.each do |index|
55
+ key = index.keys.first
56
+ next db_indexes[key] << index[key] if db_indexes[key]
57
+ db_indexes[key] = [index[key]]
58
+ end
59
+ db_indexes
60
+ end
61
+ end
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails_helper'
4
+
5
+ RSpec.describe <%= @class_name %>, type: :model do
6
+ <% if @active_record_matchers[:relations].present? %> describe 'relations' do
7
+ <% @active_record_matchers[:relations][:belongs_to].each do |belongs_to_relations| -%>
8
+ it { is_expected.to belong_to(:<%= belongs_to_relations %>) }
9
+ <% end -%>
10
+ <%- @active_record_matchers[:relations][:has_one].each do |has_one_relations| -%>
11
+ it { is_expected.to have_one(:<%= has_one_relations %>) }
12
+ <% end -%>
13
+ <%- @active_record_matchers[:relations][:has_many].each do |has_many_relations| -%>
14
+ it { is_expected.to have_many(:<%= has_many_relations %>) }
15
+ <% end -%>
16
+ <%- @active_record_matchers[:relations][:has_and_belongs_to_many].each do |has_and_belongs_to_many_relations| -%>
17
+ it { is_expected.to have_and_belong_to_many(:<%= has_and_belongs_to_many_relations %>) }
18
+ <% end -%>
19
+ end
20
+ <% end -%>
21
+ <% if @active_record_matchers[:nested_attributes].present? %>
22
+ <%- @active_record_matchers[:nested_attributes].each do |nested_attribute, nested_attribute_details| -%>
23
+ it do
24
+ is_expected.to accept_nested_attributes_for(:<%= nested_attribute %>)
25
+ <%- if nested_attribute_details[:allow_destroy] -%>
26
+ '.backed_by_column_of_type(:string)' if enum_details.values.any? { _1.is_a?(String) }
27
+ <%- end -%>
28
+ <%- if nested_attribute_details[:update_only] -%>
29
+ '.update_only(true)'
30
+ <%- end -%>
31
+ <%- if nested_attribute_details[:limit] -%>
32
+ '.allow_destroy(true)'
33
+ <%- end -%>
34
+ end
35
+ <%- end -%>
36
+ <% end -%>
37
+ <% if @active_record_matchers[:enums].present? %>
38
+ <%- @active_record_matchers[:enums].each do |enum, enum_details| -%>
39
+ it do
40
+ is_expected.to define_enum_for(:<%= enum %>)
41
+ .with_values(<%= enum_details %>)
42
+ <%- if enum_details.values.any? { _1.is_a?(String) } -%>
43
+ .backed_by_column_of_type(:string)
44
+ <%- end -%>
45
+ end
46
+ <%- end -%>
47
+ <% end -%>
48
+ <% if @active_record_matchers[:db_columns].present? %>
49
+ <%- @active_record_matchers[:db_columns].each do |db_column| -%>
50
+ it { is_expected.to have_db_column(:<%= db_column %>) }
51
+ <%- end -%>
52
+ <% end -%>
53
+ <% if @active_record_matchers[:db_indexes].present? %>
54
+ <%- @active_record_matchers[:db_indexes].each do |key, db_indexes| -%>
55
+ <%- unless key -%>
56
+ <%- db_indexes.each do |db_index| -%>
57
+ it { is_expected.to have_db_index(:<%= db_index %>) }
58
+ <%- end -%>
59
+ <%- else -%>
60
+ <%- db_indexes.each do |db_index| -%>
61
+ it { is_expected.to have_db_index(:<%= db_index %>).unique }
62
+ <%- end -%>
63
+ <%- end -%>
64
+ <%- end -%>
65
+ <% end -%>
66
+ <% if @active_record_matchers[:implicit_order_columns].present? %>
67
+ <%- @active_record_matchers[:implicit_order_columns].each do |implicit_order_column| -%>
68
+ it { is_expected.to have_implicit_order_column(:<%= implicit_order_column %>) }
69
+ <%- end -%>
70
+ <% end -%>
71
+ <% if @active_record_matchers[:readonly_attributes].present? %>
72
+ <%- @active_record_matchers[:readonly_attributes].each do |readonly_attribute| -%>
73
+ it { is_expected.to have_readonly_attribute(:<%= readonly_attribute %>) }
74
+ <%- end -%>
75
+ <% end -%>
76
+ end
File without changes
data/lib/auto_rspec.rb ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "auto_rspec/version"
4
+ module AutoRspec
5
+ class Error < StandardError; end
6
+ end
metadata ADDED
@@ -0,0 +1,138 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: auto_rspec
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ivan_Bastylo
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-05-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: shoulda-matchers
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '5.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '5.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: thor
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: cucumber
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: aruba
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: This gem generates rspec tests for your models using shoulda-matchers.
84
+ email:
85
+ - b15042002@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".idea/.gitignore"
91
+ - ".idea/auto_rspec.iml"
92
+ - ".idea/misc.xml"
93
+ - ".idea/modules.xml"
94
+ - ".idea/vcs.xml"
95
+ - ".rspec"
96
+ - ".rubocop.yml"
97
+ - CHANGELOG.md
98
+ - CODE_OF_CONDUCT.md
99
+ - Gemfile
100
+ - LICENSE.txt
101
+ - README.md
102
+ - Rakefile
103
+ - lib/auto_rspec.rb
104
+ - lib/auto_rspec/cli.rb
105
+ - lib/auto_rspec/generators/auto_rspec/USAGE
106
+ - lib/auto_rspec/generators/auto_rspec/auto_rspec_generator.rb
107
+ - lib/auto_rspec/generators/auto_rspec/parsers/active_model_parser.rb
108
+ - lib/auto_rspec/generators/auto_rspec/parsers/application_controller_parser.rb
109
+ - lib/auto_rspec/generators/auto_rspec/parsers/application_record_parser.rb
110
+ - lib/auto_rspec/generators/auto_rspec/templates/active_model.erb
111
+ - lib/auto_rspec/generators/auto_rspec/templates/application_controller.erb
112
+ - lib/auto_rspec/generators/auto_rspec/templates/application_record.erb
113
+ - lib/auto_rspec/version.rb
114
+ homepage:
115
+ licenses:
116
+ - MIT
117
+ metadata:
118
+ allowed_push_host: https://rubygems.org
119
+ post_install_message:
120
+ rdoc_options: []
121
+ require_paths:
122
+ - lib
123
+ required_ruby_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: 2.6.0
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ requirements: []
134
+ rubygems_version: 3.4.10
135
+ signing_key:
136
+ specification_version: 4
137
+ summary: Shoulda-matchers generator for rspec tests.
138
+ test_files: []