rspec_pretty_status 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c35e992349aa583338c636b0de03c4f95acd0e35a54239673cc46edd255427ab
4
+ data.tar.gz: d91c4e12d6201d43c69d9b3598ea0352352e35527546e3514abcdd6f43f51697
5
+ SHA512:
6
+ metadata.gz: 41090831c97f48192ac538fcdb9946875e7bbd793d9226cb8a7d0da43643686ae0dc670cc5eb3a1b7f90f33292aa041461214865cebb1f1c11ecae0a3661407b
7
+ data.tar.gz: d3e5ba7a40409c02024657aef7d6cdc831432de044398b1555778302675851e7ff093e0c1cc482f6b67330d3c6e5f36bfc7bd281993cf094bc9f91bbf00c86ae
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
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
+ require:
2
+ - rubocop-rspec
3
+ - rubocop-performance
4
+
5
+ AllCops:
6
+ TargetRubyVersion: 2.7.2
7
+ NewCops: enable
8
+
9
+ Layout/LineLength:
10
+ Max: 120
11
+
12
+ Style/Documentation:
13
+ Enabled: false
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ rspec_pretty_status
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.2
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,70 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rspec_pretty_status (0.1.1)
5
+ rspec
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.2)
11
+ coderay (1.1.3)
12
+ diff-lcs (1.4.4)
13
+ lefthook (0.7.2)
14
+ method_source (1.0.0)
15
+ parallel (1.20.1)
16
+ parser (3.0.1.1)
17
+ ast (~> 2.4.1)
18
+ pry (0.14.0)
19
+ coderay (~> 1.1)
20
+ method_source (~> 1.0)
21
+ rainbow (3.0.0)
22
+ regexp_parser (2.1.1)
23
+ rexml (3.2.5)
24
+ rspec (3.10.0)
25
+ rspec-core (~> 3.10.0)
26
+ rspec-expectations (~> 3.10.0)
27
+ rspec-mocks (~> 3.10.0)
28
+ rspec-core (3.10.1)
29
+ rspec-support (~> 3.10.0)
30
+ rspec-expectations (3.10.1)
31
+ diff-lcs (>= 1.2.0, < 2.0)
32
+ rspec-support (~> 3.10.0)
33
+ rspec-mocks (3.10.2)
34
+ diff-lcs (>= 1.2.0, < 2.0)
35
+ rspec-support (~> 3.10.0)
36
+ rspec-support (3.10.2)
37
+ rubocop (1.14.0)
38
+ parallel (~> 1.10)
39
+ parser (>= 3.0.0.0)
40
+ rainbow (>= 2.2.2, < 4.0)
41
+ regexp_parser (>= 1.8, < 3.0)
42
+ rexml
43
+ rubocop-ast (>= 1.5.0, < 2.0)
44
+ ruby-progressbar (~> 1.7)
45
+ unicode-display_width (>= 1.4.0, < 3.0)
46
+ rubocop-ast (1.5.0)
47
+ parser (>= 3.0.1.1)
48
+ rubocop-performance (1.10.2)
49
+ rubocop (>= 0.90.0, < 2.0)
50
+ rubocop-ast (>= 0.4.0)
51
+ rubocop-rspec (2.2.0)
52
+ rubocop (~> 1.0)
53
+ rubocop-ast (>= 1.1.0)
54
+ ruby-progressbar (1.11.0)
55
+ unicode-display_width (2.0.0)
56
+
57
+ PLATFORMS
58
+ ruby
59
+
60
+ DEPENDENCIES
61
+ lefthook (~> 0.7.2)
62
+ pry (~> 0.14.0)
63
+ rspec (~> 3.0)
64
+ rspec_pretty_status!
65
+ rubocop (~> 1.14.0)
66
+ rubocop-performance (~> 1.10.2)
67
+ rubocop-rspec (~> 2.2.0)
68
+
69
+ BUNDLED WITH
70
+ 2.1.4
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Artem Shevchenko
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
+ # Rspec::Pretty::Status
2
+
3
+ Pretty controller specs with rails statuses in pure rspec.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'rspec_pretty_status'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install rspec-pretty-status
20
+
21
+
22
+ Then include in RSpec:
23
+
24
+ ```ruby
25
+ RSpec.configure do |config|
26
+ config.include RSpec::Pretty::Status
27
+ end
28
+ ```
29
+ ## Usage
30
+
31
+ In controller specs:
32
+
33
+ ```ruby
34
+ it { expect(response).to have_http_status(:ok) }
35
+ ```
36
+
37
+ ## Contributing
38
+
39
+ Bug reports and pull requests are welcome on GitHub at https://github.com/Ar2emis/rspec-pretty-status.
40
+
41
+
42
+ ## License
43
+
44
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/bin/console ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'rspec_pretty_status'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ require 'pry'
12
+ Pry.start
data/bin/setup ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
data/lefthook.yml ADDED
@@ -0,0 +1,6 @@
1
+ pre-commit:
2
+ parallel: true
3
+ commands:
4
+ rubocop:
5
+ glob: "*.rb"
6
+ run: bundle exec rubocop
@@ -0,0 +1,89 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rspec/expectations'
4
+
5
+ require_relative 'rspec_pretty_status/version'
6
+
7
+ module RSpecPrettyStatus
8
+ extend RSpec::Matchers::DSL
9
+
10
+ STATUSES = {
11
+ continue: 100,
12
+ switching_protocols: 101,
13
+ processing: 102,
14
+ ok: 200,
15
+ created: 201,
16
+ accepted: 202,
17
+ non_authoritative_information: 203,
18
+ no_content: 204,
19
+ reset_content: 205,
20
+ partial_content: 206,
21
+ multi_status: 207,
22
+ im_used: 226,
23
+ multiple_choices: 300,
24
+ moved_permanently: 301,
25
+ found: 302,
26
+ see_other: 303,
27
+ not_modified: 304,
28
+ use_proxy: 305,
29
+ temporary_redirect: 307,
30
+ bad_request: 400,
31
+ unauthorized: 401,
32
+ payment_required: 402,
33
+ forbidden: 403,
34
+ not_found: 404,
35
+ method_not_allowed: 405,
36
+ not_acceptable: 406,
37
+ proxy_authentication_required: 407,
38
+ request_timeout: 408,
39
+ conflict: 409,
40
+ gone: 410,
41
+ length_required: 411,
42
+ precondition_failed: 412,
43
+ request_entity_too_large: 413,
44
+ request_uri_too_long: 414,
45
+ unsupported_media_type: 415,
46
+ requested_range_not_satisfiable: 416,
47
+ expectation_failed: 417,
48
+ unprocessable_entity: 422,
49
+ locked: 423,
50
+ failed_dependency: 424,
51
+ upgrade_required: 426,
52
+ internal_server_error: 500,
53
+ not_implemented: 501,
54
+ bad_gateway: 502,
55
+ service_unavailable: 503,
56
+ gateway_timeout: 504,
57
+ http_version_not_supported: 505,
58
+ insufficient_storage: 507,
59
+ not_extended: 510
60
+ }.freeze
61
+
62
+ INVERTED_STATUSES = STATUSES.invert
63
+
64
+ def error_message(actual_status, expected_status)
65
+ "expected that status will be #{actual_status} but have #{expected_status}"
66
+ end
67
+
68
+ def error_message_when_negated(actual_status)
69
+ "expected that status won't be #{actual_status} but it is"
70
+ end
71
+
72
+ matcher :have_http_status do |status|
73
+ match do |response|
74
+ raise ArgumentError, 'Invalid http status' unless STATUSES.key?(status)
75
+
76
+ response.status == STATUSES[status.to_sym]
77
+ end
78
+
79
+ failure_message do |response|
80
+ status = INVERTED_STATUSES[response.status]
81
+ error_message(status, expected)
82
+ end
83
+
84
+ failure_message_when_negated do |response|
85
+ status = INVERTED_STATUSES[response.status]
86
+ error_message_when_negated(status)
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RSpecPrettyStatus
4
+ VERSION = '0.1.1'
5
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/rspec_pretty_status/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'rspec_pretty_status'
7
+ spec.version = RSpecPrettyStatus::VERSION
8
+ spec.authors = ['Artem Shevchenko']
9
+ spec.email = ['artemsheva0510@gmail.com']
10
+
11
+ spec.summary = 'Pretty response status as in rspec-rails'
12
+ spec.homepage = 'https://github.com/Ar2emis/rspec_pretty_status'
13
+ spec.license = 'MIT'
14
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.7.2')
15
+
16
+ spec.metadata['homepage_uri'] = spec.homepage
17
+ spec.metadata['source_code_uri'] = spec.homepage
18
+
19
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ end
22
+
23
+ spec.require_paths = ['lib']
24
+
25
+ spec.add_development_dependency 'lefthook', '~> 0.7.2'
26
+ spec.add_development_dependency 'pry', '~> 0.14.0'
27
+ spec.add_development_dependency 'rspec', '~> 3.0'
28
+ spec.add_development_dependency 'rubocop', '~> 1.14.0'
29
+ spec.add_development_dependency 'rubocop-performance', '~> 1.10.2'
30
+ spec.add_development_dependency 'rubocop-rspec', '~> 2.2.0'
31
+
32
+ spec.add_dependency 'rspec'
33
+ end
metadata ADDED
@@ -0,0 +1,158 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rspec_pretty_status
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Artem Shevchenko
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-06-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: lefthook
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.7.2
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.7.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.14.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.14.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.14.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 1.14.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop-performance
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 1.10.2
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 1.10.2
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 2.2.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 2.2.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description:
112
+ email:
113
+ - artemsheva0510@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".gitignore"
119
+ - ".rspec"
120
+ - ".rubocop.yml"
121
+ - ".ruby-gemset"
122
+ - ".ruby-version"
123
+ - Gemfile
124
+ - Gemfile.lock
125
+ - LICENSE.txt
126
+ - README.md
127
+ - bin/console
128
+ - bin/setup
129
+ - lefthook.yml
130
+ - lib/rspec_pretty_status.rb
131
+ - lib/rspec_pretty_status/version.rb
132
+ - rspec_pretty_status.gemspec
133
+ homepage: https://github.com/Ar2emis/rspec_pretty_status
134
+ licenses:
135
+ - MIT
136
+ metadata:
137
+ homepage_uri: https://github.com/Ar2emis/rspec_pretty_status
138
+ source_code_uri: https://github.com/Ar2emis/rspec_pretty_status
139
+ post_install_message:
140
+ rdoc_options: []
141
+ require_paths:
142
+ - lib
143
+ required_ruby_version: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ version: 2.7.2
148
+ required_rubygems_version: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ requirements: []
154
+ rubygems_version: 3.1.4
155
+ signing_key:
156
+ specification_version: 4
157
+ summary: Pretty response status as in rspec-rails
158
+ test_files: []