r2m 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +56 -0
- data/.travis.yml +10 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +7 -0
- data/LICENSE +21 -0
- data/LICENSE.txt +21 -0
- data/README.md +44 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/r2m +51 -0
- data/exe/rspec2minitest +101 -0
- data/lib/r2m.rb +6 -0
- data/lib/r2m/version.rb +3 -0
- data/r2m.gemspec +29 -0
- metadata +63 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f35e24b4f65f55302b6e139de08ce71b6aa49cbb634c25a6ffff46047cf36654
|
4
|
+
data.tar.gz: e422f1fec1bea0807fd31098c0046d351d4c32bda7aebf4ddb41366974bc2430
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 31294b116c025660f5e4f30c5ecd0ba7f46896cd70c99a06ff52e003f4a456c49a6c87f16860ef27b326820ad1ae467a75f9cc2bd676dbd2639d8deaeba61a8e
|
7
|
+
data.tar.gz: 3d0fe23c9ed17001fccf2cc62101b36fdfb2e5d7c2f42c0366a7378530394a587098c57db94e6e20034c93d935141b7ce2ed4e5f41b277f59c7121dd5e7487e1
|
data/.gitignore
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
.env
|
15
|
+
|
16
|
+
# Ignore Byebug command history file.
|
17
|
+
# .byebug_history
|
18
|
+
|
19
|
+
## Specific to RubyMotion:
|
20
|
+
.dat*
|
21
|
+
.repl_history
|
22
|
+
build/
|
23
|
+
*.bridgesupport
|
24
|
+
build-iPhoneOS/
|
25
|
+
build-iPhoneSimulator/
|
26
|
+
|
27
|
+
## Specific to RubyMotion (use of CocoaPods):
|
28
|
+
#
|
29
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
30
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
31
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
32
|
+
#
|
33
|
+
# vendor/Pods/
|
34
|
+
|
35
|
+
## Documentation cache and generated files:
|
36
|
+
/.yardoc/
|
37
|
+
/_yardoc/
|
38
|
+
/doc/
|
39
|
+
/rdoc/
|
40
|
+
|
41
|
+
## Environment normalization:
|
42
|
+
/.bundle/
|
43
|
+
/vendor/bundle
|
44
|
+
/lib/bundler/man/
|
45
|
+
|
46
|
+
# for a library or gem, you might want to ignore these files since the code is
|
47
|
+
# intended to run in multiple environments; otherwise, check them in:
|
48
|
+
Gemfile.lock
|
49
|
+
.ruby-version
|
50
|
+
.ruby-gemset
|
51
|
+
|
52
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
53
|
+
.rvmrc
|
54
|
+
|
55
|
+
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
56
|
+
.rubocop-https?--*
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at 62-pkeen@users.noreply.rtfm.corsis.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2020 JetThoughts
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Paul Keen
|
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,44 @@
|
|
1
|
+
# R2m
|
2
|
+
|
3
|
+
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/r2m`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'r2m'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle install
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install r2m
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/r2m. 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]/r2m/blob/master/CODE_OF_CONDUCT.md).
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
41
|
+
|
42
|
+
## Code of Conduct
|
43
|
+
|
44
|
+
Everyone interacting in the R2m project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/r2m/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "r2m"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/exe/r2m
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
require 'thor'
|
6
|
+
|
7
|
+
class R2MCommand < Thor
|
8
|
+
include Thor::Actions
|
9
|
+
|
10
|
+
default_command :convert
|
11
|
+
argument :path, default: 'spec'
|
12
|
+
|
13
|
+
def self.exit_on_failure?
|
14
|
+
true
|
15
|
+
end
|
16
|
+
|
17
|
+
desc 'convert', 'Convert Rspec to MiniTest'
|
18
|
+
def convert
|
19
|
+
files.each { |file| process file }
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def process(file)
|
25
|
+
|
26
|
+
# it 'converts it"s to test method with # support' do # => def test_converts_it_s_to_test_method_with_support
|
27
|
+
convert_it_to_methods(file)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Finds +it+ cases and converts to test methods declarations
|
31
|
+
#
|
32
|
+
# it 'converts it"s to test method with # support' do
|
33
|
+
# # => def test_converts_it_s_to_test_method_with_support
|
34
|
+
def convert_it_to_methods(file)
|
35
|
+
gsub_file(file, /(?<=\bit ').*?(?=' do\b)/) do |match|
|
36
|
+
match.gsub(/[^\w]+/, '_').downcase
|
37
|
+
end
|
38
|
+
|
39
|
+
gsub_file(file, /it '(.*)' do/, 'def test_\1')
|
40
|
+
end
|
41
|
+
|
42
|
+
def files
|
43
|
+
if Dir.exist?(path)
|
44
|
+
Dir.glob(File.join(path, '**', '*_test.rb'))
|
45
|
+
else
|
46
|
+
Dir.glob(path)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
R2MCommand.start
|
data/exe/rspec2minitest
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
#!/bin/bash --login
|
2
|
+
|
3
|
+
tests_path=${1:-test}
|
4
|
+
|
5
|
+
cp -a $tests_path test/
|
6
|
+
|
7
|
+
tests_path=test/$(basename $tests_path)
|
8
|
+
|
9
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/system_helper/application_system_test_case/g' {} \;
|
10
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/rails_helper/test_helper/g' {} \;
|
11
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/spec_helper/test_helper/g' {} \;
|
12
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/context/describe/g' {} \;
|
13
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/stub(/stubs(/g' {} \;
|
14
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/double/stub/g' {} \;
|
15
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/should_receive/expects/g' {} \;
|
16
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/and_return/returns/g' {} \;
|
17
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/.to be ==/.must_equal/g' {} \;
|
18
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/.to be_empty/.must_be_empty/g' {} \;
|
19
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/.to_not be_empty/.wont_be_empty/g' {} \;
|
20
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/.to be_truthy/.must_be :present?/g' {} \;
|
21
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/.to be_falsey/.must_be :blank?/g' {} \;
|
22
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/.not_to be_nil/.wont_be_nil/g' {} \;
|
23
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/.to_not be_nil/.wont_be_nil/g' {} \;
|
24
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/\.not_to be_an_\(.*\)/.wont_be :\1\?/g' {} \;
|
25
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/\.to be_a(/.must_be_kind_of(/g' {} \;
|
26
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/\.to be_an(/.must_be_kind_of(/g' {} \;
|
27
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/\.to be_an_\(.*\)/.must_be :\1\?/g' {} \;
|
28
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/\.to_not be_\(.*\)/.wont_be :\1\?/g' {} \;
|
29
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/\.not_to be_\(.*\)/.wont_be :\1\?/g' {} \;
|
30
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/\.to be_\(.*\)/.must_be :\1\?/g' {} \;
|
31
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/.to be_nil/.must_be_nil/g' {} \;
|
32
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/\.to eq/.must_equal/g' {} \;
|
33
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/\.not_to eq/.wont_equal/g' {} \;
|
34
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/\.to_not eq/.wont_equal/g' {} \;
|
35
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/\.not_to include/.wont_include/g' {} \;
|
36
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/\.to_not include/.wont_include/g' {} \;
|
37
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/\.to include/.must_include/g' {} \;
|
38
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/\.to be_kind_of/.must_be_kind_of/g' {} \;
|
39
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/expect(response).to have_http_status/assert_response/g' {} \;
|
40
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/.to redirect_to/.must_redirect_to/g' {} \;
|
41
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/.to match/.must_match/g' {} \;
|
42
|
+
|
43
|
+
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/expect(page)\.to have_content/assert_text/g' {} \;
|
44
|
+
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/expect(page)\.to have_no_content/assert_no_text/g' {} \;
|
45
|
+
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/expect(page)\.to_not have_content/assert_no_text/g' {} \;
|
46
|
+
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/expect(page)\.to have_selector/assert_selector/g' {} \;
|
47
|
+
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/expect(page)\.not_to have_selector/assert_no_selector/g' {} \;
|
48
|
+
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/expect(page)\.to_not have_selector/assert_no_selector/g' {} \;
|
49
|
+
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/\.to have_content/.must_have_content/g' {} \;
|
50
|
+
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/\.not_to have_content/.wont_have_content/g' {} \;
|
51
|
+
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/\.to have_no_content/.wont_have_content/g' {} \;
|
52
|
+
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/\.to have_field/.must_have_field/g' {} \;
|
53
|
+
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/expect(page)\.to have_checked_field/assert_checked_field/g' {} \;
|
54
|
+
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/expect(page)\.not_to have_checked_field/assert_no_checked_field/g' {} \;
|
55
|
+
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/expect(page)\.to_not have_checked_field/assert_no_checked_field/g' {} \;
|
56
|
+
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/\.to have_link/.must_have_link/g' {} \;
|
57
|
+
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/\.to have_no_link/.wont_have_link/g' {} \;
|
58
|
+
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/\.to have_button/.must_have_button/g' {} \;
|
59
|
+
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/\.to have_no_button/.wont_have_button/g' {} \;
|
60
|
+
|
61
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/.to match/.must_match/g' {} \;
|
62
|
+
|
63
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' "s/expect[ {]/skip('FIXME: NEED TO MIGRATE MANUALLY FROM RSPEC')
|
64
|
+
expect /g" {} \;
|
65
|
+
|
66
|
+
|
67
|
+
find $tests_path -path '*/helpers/*' -name '*_spec.rb' -exec sed -i '' 's/helper\.//g' {} \;
|
68
|
+
|
69
|
+
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/RSpec\.describe '"'"'\(.*\)'"'"' do.*/Class.new(ApplicationSystemTestCase) do #\1/g' {} \;
|
70
|
+
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/, screenshot: true//g' {} \;
|
71
|
+
|
72
|
+
find $tests_path -path '*/controllers/*' -name '*_spec.rb' -exec sed -i '' 's/RSpec\.describe \(.*Controller\).*/class \1Test < ActionController::TestCase/g' {} \;
|
73
|
+
find $tests_path -path '*/mailers/*' -name '*_spec.rb' -exec sed -i '' 's/RSpec\.describe \(.*Mailer\).*/class \1Test < ActionMailer::TestCase/g' {} \;
|
74
|
+
find $tests_path -path '*/helpers/*' -name '*_spec.rb' -exec sed -i '' 's/RSpec\.describe \(.*Helper\).*/class \1Test < ActionView::TestCase/g' {} \;
|
75
|
+
|
76
|
+
find $tests_path -path '*/requests/*' -name '*_spec.rb' -exec sed -i '' 's/RSpec\.describe '"'"'\(.*\)'"'"' do.*/class \1Test < ActionDispatch::IntegrationTest/g' {} \;
|
77
|
+
|
78
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/RSpec\.describe '"'"'\(.*\)'"'"' do/class \1Test < ActiveSupport::TestCase/g' {} \;
|
79
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/RSpec\.describe \(.*\) do/class \1Test < ActiveSupport::TestCase/g' {} \;
|
80
|
+
|
81
|
+
|
82
|
+
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/around do/warn "FIX: AROUND"; around do/g' {} \;
|
83
|
+
|
84
|
+
|
85
|
+
rubocop --safe-auto-correct --disable-uncorrectable $tests_path
|
86
|
+
|
87
|
+
echo "TODO: assert_enqueued_jobs"
|
88
|
+
echo "TODO: assert_change"
|
89
|
+
echo "TODO: assert_raise"
|
90
|
+
echo "TODO: shared_examples"
|
91
|
+
|
92
|
+
rename "s/_spec/_test/" "test/${tests_path}/**/*.rb"
|
93
|
+
|
94
|
+
|
95
|
+
# TODO spec/models describe (\w+)(\, type\: \:model)? do class $1Test < ActiveSupport::TestCase
|
96
|
+
# TODO: system tests replace class from filename
|
97
|
+
# "TODO: replace all \bspecify\b by it"
|
98
|
+
# "TODO: replace all \bit\s?\((.*?)\) do by it '' do"
|
99
|
+
# "TODO: replace all \bit\s?\((.*?)\) { .*? } by it '' do; $2; end"
|
100
|
+
# "TODO: replace all (?<=\bit '[\w\s]+)\s+(?=.*?\w' do$) with _"
|
101
|
+
# "TODO: replace all it '(.*)' do with def test_\L$1"
|
data/lib/r2m.rb
ADDED
data/lib/r2m/version.rb
ADDED
data/r2m.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require_relative 'lib/r2m/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "r2m"
|
5
|
+
spec.version = R2M::VERSION
|
6
|
+
spec.authors = ["Paul Keen"]
|
7
|
+
spec.email = ["info@jetthoughts.com"]
|
8
|
+
|
9
|
+
spec.summary = "Converts RSpec files to minitest"
|
10
|
+
spec.description = "A command-line tool for converting RSpec files to minitest."
|
11
|
+
spec.homepage = "https://github.com/jetthoughts/r2m"
|
12
|
+
spec.license = "MIT"
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
14
|
+
|
15
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = "https://github.com/jetthoughts/r2m"
|
19
|
+
spec.metadata["changelog_uri"] = "https://github.com/jetthoughts/r2m/README.md"
|
20
|
+
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
22
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
24
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test)/}) }
|
25
|
+
end
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: r2m
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Paul Keen
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-05-01 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A command-line tool for converting RSpec files to minitest.
|
14
|
+
email:
|
15
|
+
- info@jetthoughts.com
|
16
|
+
executables:
|
17
|
+
- r2m
|
18
|
+
- rspec2minitest
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- ".gitignore"
|
23
|
+
- ".travis.yml"
|
24
|
+
- CODE_OF_CONDUCT.md
|
25
|
+
- Gemfile
|
26
|
+
- LICENSE
|
27
|
+
- LICENSE.txt
|
28
|
+
- README.md
|
29
|
+
- Rakefile
|
30
|
+
- bin/console
|
31
|
+
- bin/setup
|
32
|
+
- exe/r2m
|
33
|
+
- exe/rspec2minitest
|
34
|
+
- lib/r2m.rb
|
35
|
+
- lib/r2m/version.rb
|
36
|
+
- r2m.gemspec
|
37
|
+
homepage: https://github.com/jetthoughts/r2m
|
38
|
+
licenses:
|
39
|
+
- MIT
|
40
|
+
metadata:
|
41
|
+
homepage_uri: https://github.com/jetthoughts/r2m
|
42
|
+
source_code_uri: https://github.com/jetthoughts/r2m
|
43
|
+
changelog_uri: https://github.com/jetthoughts/r2m/README.md
|
44
|
+
post_install_message:
|
45
|
+
rdoc_options: []
|
46
|
+
require_paths:
|
47
|
+
- lib
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 2.3.0
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
requirements: []
|
59
|
+
rubygems_version: 3.1.2
|
60
|
+
signing_key:
|
61
|
+
specification_version: 4
|
62
|
+
summary: Converts RSpec files to minitest
|
63
|
+
test_files: []
|