rspock 1.0.0.pre.alpha.pre.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +53 -0
  3. data/.travis.yml +23 -0
  4. data/CHANGELOG.md +46 -0
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +6 -0
  7. data/Gemfile.lock +96 -0
  8. data/LICENSE.txt +21 -0
  9. data/README.md +454 -0
  10. data/Rakefile +18 -0
  11. data/bin/console +14 -0
  12. data/bin/setup +8 -0
  13. data/block_graph +38 -0
  14. data/block_graph.png +0 -0
  15. data/lib/Rakefile +4 -0
  16. data/lib/generators/rspock/install_generator.rb +17 -0
  17. data/lib/generators/templates/rspock_initializer.rb +2 -0
  18. data/lib/minitest/rspock_plugin.rb +10 -0
  19. data/lib/rspock/ast/block.rb +95 -0
  20. data/lib/rspock/ast/cleanup_block.rb +16 -0
  21. data/lib/rspock/ast/comparison_to_assertion_transformation.rb +40 -0
  22. data/lib/rspock/ast/end_block.rb +17 -0
  23. data/lib/rspock/ast/expect_block.rb +21 -0
  24. data/lib/rspock/ast/given_block.rb +16 -0
  25. data/lib/rspock/ast/header_nodes_transformation.rb +35 -0
  26. data/lib/rspock/ast/interaction_transformation.rb +148 -0
  27. data/lib/rspock/ast/method_call_to_lvar_transformation.rb +24 -0
  28. data/lib/rspock/ast/start_block.rb +28 -0
  29. data/lib/rspock/ast/test_method_def_transformation.rb +33 -0
  30. data/lib/rspock/ast/test_method_dstr_transformation.rb +23 -0
  31. data/lib/rspock/ast/test_method_transformation.rb +166 -0
  32. data/lib/rspock/ast/then_block.rb +34 -0
  33. data/lib/rspock/ast/transformation.rb +128 -0
  34. data/lib/rspock/ast/when_block.rb +16 -0
  35. data/lib/rspock/ast/where_block.rb +86 -0
  36. data/lib/rspock/backtrace_filter.rb +53 -0
  37. data/lib/rspock/declarative.rb +18 -0
  38. data/lib/rspock/minitest/backtrace_filter.rb +16 -0
  39. data/lib/rspock/railtie.rb +12 -0
  40. data/lib/rspock/tasks/rspock.rake +20 -0
  41. data/lib/rspock/tasks/truth_table.rb +82 -0
  42. data/lib/rspock/version.rb +3 -0
  43. data/lib/rspock.rb +12 -0
  44. data/rspock.gemspec +47 -0
  45. metadata +255 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 74ad1dcffce5ad08e752e9dde7c1f43e58d1471caa9f170e49242f40685f1136
4
+ data.tar.gz: d93d9728febd3b779453bbc1ce1ef4af7a8e417dd4713e0dc102e8a55d784ab8
5
+ SHA512:
6
+ metadata.gz: 8d656516295fe8981a18cae3117070f372b19dab5a5a280df64865039bee01cf1c25f1126a42fc79e1e37683ad982438a937fff1f0345a6f97b20c62f2792157
7
+ data.tar.gz: 0b32ac9e850378ee5b21e8df8233e420aec200a0510ad437c7e45a9d273d199170b449bb3f2afbb67f9587d8547a985f8afc4a0245675c2da92fc820ed7c1d2c
data/.gitignore ADDED
@@ -0,0 +1,53 @@
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
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ # Gemfile.lock
46
+ # .ruby-version
47
+ # .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
51
+
52
+ # RubyMine
53
+ /.idea
data/.travis.yml ADDED
@@ -0,0 +1,23 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 2.5
5
+ - 2.6
6
+ - 2.7
7
+
8
+ install: ./bin/setup
9
+
10
+ jobs:
11
+ include:
12
+ - stage: deploy
13
+ rvm: 2.7
14
+ install: ./bin/setup
15
+ script: echo Deploy
16
+ deploy:
17
+ provider: rubygems
18
+ gemspec: rspock.gemspec
19
+ gem: rspock
20
+ on:
21
+ branch: master
22
+ api_key:
23
+ secure: rIfUyBSv8ETaJ06vDiVGnhjNG9aiwa+h5ud/8D7/ieJQzpbvZY7N+5R5buHcEIdWIpj/FrkO8H1QuTrB8VDpa+ckDzAXoQKf7EsXtZYGPEwLymfpVCIzix8/8Wbu2lmsLwexAFDZ3YWUZHga1hOc+FuiI2I0TiFsjnzU+mPxdKnpDH1H2ZAUecW0DcEb3zEVtTV4oSgGMYPG2493gjUFnVAEbq1ODPtLKJ2qQw2R0Es20h1QQ0w06LNCcQ9XfoJY/aWTQJHp9uolmhXh97/NTntNvPTXDhv6aCTldtI/A5PuRl03CRtsHd5qLNt23hSCNBGnkZx1uEirTVSfSrha/XOJ4OopMYYa4DkbzSLC/yfpyfdvqW+ewymbOf9EjVqkQVtKb9rul8Gw5QlVQNhu+zpL0zTsC4BLmna4PrtqjeUVkhsOtXpE+rMDFjrjbFS89+VwHLzGipJDA4N5eRv1NB5s4Lkj5CExOBG2MsKlxN0+KYe5Gm255lP+JI9TUgV+26BitStBpZLv1/brLR5Ui9Z5U+4mH6f/DRLgMl8cOkuv9VABn6NEcFW3gbmVs4TaykcQdiozOIat7Zi+H4PcZ2bZcMvY8qCZgcEJDepg9nF4ArnxYlrnYkKdEM7jleryNS6whVM67k6IfrQnDyesvI5gsH4YNAkMtVl1TYPDa7s=
data/CHANGELOG.md ADDED
@@ -0,0 +1,46 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [UNRELEASED]
8
+ ### Added
9
+ - Interaction-based testing: Mock with expectations in the Then block.
10
+
11
+ ### Changed
12
+ - Test names now have the test index and line number as suffix instead of prefix.
13
+ - Cleanup transformed code output.
14
+
15
+ ### Fixed
16
+ - Fixed source mapping for transformed assertion nodes.
17
+
18
+ ## [0.2.5] 2019-05-28
19
+ ### Fixed
20
+ - Fixed BacktraceFilter so that source mapping works again
21
+
22
+ ## [0.2.4] 2019-05-27
23
+ ### Changed
24
+ - Bump Unparser dependency from ~> 0.2.8 to ~> 0.4
25
+
26
+ ## [0.2.3] 2018-11-09
27
+ ### Fixed
28
+ - Cleanup block can now contain more than one node
29
+
30
+ ## [0.2.2] 2018-11-08
31
+ ### Changed
32
+ - Extracted ASTTransform to its own gem: `ast_transform`
33
+
34
+ ## [0.2.1] 2018-10-09
35
+ ### Added
36
+ - _line_number_ is now displayed in the test name, and is available in test scope for debugging purposes
37
+
38
+ ### Changed
39
+ - Renamed test_index to _test_index_
40
+
41
+ ## [0.2.0] 2018-09-21
42
+ ### Added
43
+ - Truth table generator Rake task.
44
+
45
+ ## [0.1.1] 2018-09-19
46
+ ### Initial Release!
@@ -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 jpduchesne89@gmail.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 [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in rspock.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,96 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rspock (1.0.0)
5
+ ast_transform (~> 1.0.0.pre.alpha.pre)
6
+ minitest (~> 5.0)
7
+ mocha (~> 1.0)
8
+ parser (~> 2.5)
9
+ unparser (~> 0.4)
10
+
11
+ GEM
12
+ remote: https://rubygems.org/
13
+ specs:
14
+ abstract_type (0.0.7)
15
+ adamantium (0.2.0)
16
+ ice_nine (~> 0.11.0)
17
+ memoizable (~> 0.4.0)
18
+ ansi (1.5.0)
19
+ ast (2.4.1)
20
+ ast_transform (1.0.0.pre.alpha.pre.37)
21
+ parser (~> 2.7)
22
+ unparser (~> 0.4)
23
+ builder (3.2.4)
24
+ byebug (11.1.3)
25
+ coderay (1.1.3)
26
+ concord (0.1.5)
27
+ adamantium (~> 0.2.0)
28
+ equalizer (~> 0.0.9)
29
+ coveralls (0.8.23)
30
+ json (>= 1.8, < 3)
31
+ simplecov (~> 0.16.1)
32
+ term-ansicolor (~> 1.3)
33
+ thor (>= 0.19.4, < 2.0)
34
+ tins (~> 1.6)
35
+ diff-lcs (1.4.4)
36
+ docile (1.3.2)
37
+ equalizer (0.0.11)
38
+ ice_nine (0.11.2)
39
+ json (2.3.1)
40
+ memoizable (0.4.2)
41
+ thread_safe (~> 0.3, >= 0.3.1)
42
+ method_source (1.0.0)
43
+ minitest (5.14.1)
44
+ minitest-reporters (1.4.2)
45
+ ansi
46
+ builder
47
+ minitest (>= 5.0)
48
+ ruby-progressbar
49
+ mocha (1.11.2)
50
+ parser (2.7.1.4)
51
+ ast (~> 2.4.1)
52
+ procto (0.0.3)
53
+ pry (0.13.1)
54
+ coderay (~> 1.1)
55
+ method_source (~> 1.0)
56
+ pry-byebug (3.9.0)
57
+ byebug (~> 11.0)
58
+ pry (~> 0.13.0)
59
+ rake (13.0.1)
60
+ ruby-progressbar (1.10.1)
61
+ simplecov (0.16.1)
62
+ docile (~> 1.1)
63
+ json (>= 1.8, < 3)
64
+ simplecov-html (~> 0.10.0)
65
+ simplecov-html (0.10.2)
66
+ sync (0.5.0)
67
+ term-ansicolor (1.7.1)
68
+ tins (~> 1.0)
69
+ thor (1.0.1)
70
+ thread_safe (0.3.6)
71
+ tins (1.25.0)
72
+ sync
73
+ unparser (0.4.7)
74
+ abstract_type (~> 0.0.7)
75
+ adamantium (~> 0.2.0)
76
+ concord (~> 0.1.5)
77
+ diff-lcs (~> 1.3)
78
+ equalizer (~> 0.0.9)
79
+ parser (>= 2.6.5)
80
+ procto (~> 0.0.2)
81
+
82
+ PLATFORMS
83
+ ruby
84
+
85
+ DEPENDENCIES
86
+ bundler (~> 2.1)
87
+ coveralls (~> 0.8)
88
+ minitest (~> 5.14)
89
+ minitest-reporters (~> 1.4)
90
+ pry (~> 0.13)
91
+ pry-byebug (~> 3.9)
92
+ rake (~> 13.0)
93
+ rspock!
94
+
95
+ BUNDLED WITH
96
+ 2.1.4
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Jean-Philippe Duchesne
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.