assert-rack-test 1.0.1 → 1.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 +2 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -3
- data/LICENSE +22 -0
- data/README.md +63 -0
- data/assert-rack-test.gemspec +18 -12
- data/lib/assert-rack-test.rb +8 -15
- data/lib/assert-rack-test/version.rb +4 -6
- data/log/.gitkeep +0 -0
- data/test/helper.rb +10 -5
- data/test/support/factory.rb +5 -0
- data/test/unit/assert-rack-test_tests.rb +17 -0
- metadata +61 -78
- data/README.markdown +0 -76
- data/Rakefile +0 -5
- data/test/unit/assert-rack-test_test.rb +0 -20
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: aac6a95da870c26e356087445a4f8638e5a4617f76e69581f6e9fea400bdea5a
|
4
|
+
data.tar.gz: eb87e14ffb1e061c8be4e48eac760331b7006b31e47f7f99b9f9bfdf9ea4e76e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 41370665d50b23cbc2ee77d701b5c5ad425f8b9d5f90fc660949a3e147b53b5ab6a2c4326a52b36667233babf599b34a591ff6d5c86b4725e54e2a71997126ab
|
7
|
+
data.tar.gz: 442c548d94ed542cda32b5bae83c563066fc9bb79bd7a127ba2373831aaa42193719ad3a7fbc6b2aec93f3c56e7e14892459177aa5ca510faebe438c761a3005
|
data/.gitignore
CHANGED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.5.5
|
data/Gemfile
CHANGED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2011-Present Collin Redding and Kelly Redding
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# Assert-Rack-Test
|
2
|
+
|
3
|
+
The [assert](https://github.com/teaminsight/assert) gem with [rack/test](https://github.com/brynary/rack-test). This gem just mixes in the Rack::Test methods into the Assert context, allowing you to use Rack::Test's get, post, put, etc... methods within an Assert context.
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
Use assert as you normally would. Inherit from a context and use any of rack test's methods in your tests:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
class BaseTest < Asset::Context
|
11
|
+
desc "some test"
|
12
|
+
setup do
|
13
|
+
get '/some/route'
|
14
|
+
end
|
15
|
+
|
16
|
+
should "have returned a successful response" do
|
17
|
+
assert_equal 200, last_response.status
|
18
|
+
assert_equal "Some route indeed!", last_response.body
|
19
|
+
end
|
20
|
+
end
|
21
|
+
```
|
22
|
+
|
23
|
+
You still need to define an app method, like you normally would for rack test:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
# app method for entire test suite
|
27
|
+
Assert::Context.class_eval do
|
28
|
+
def app
|
29
|
+
MyApp.new
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# or for one context
|
34
|
+
class BaseTest < Assert::Context
|
35
|
+
|
36
|
+
def app
|
37
|
+
OtherApp.new
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
```
|
42
|
+
|
43
|
+
## Installation
|
44
|
+
|
45
|
+
Add this line to your application's Gemfile:
|
46
|
+
|
47
|
+
gem 'assert-rack-test'
|
48
|
+
|
49
|
+
And then execute:
|
50
|
+
|
51
|
+
$ bundle
|
52
|
+
|
53
|
+
Or install it yourself as:
|
54
|
+
|
55
|
+
$ gem install assert-rack-test
|
56
|
+
|
57
|
+
## Contributing
|
58
|
+
|
59
|
+
1. Fork it
|
60
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
61
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
62
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
63
|
+
5. Create new Pull Request
|
data/assert-rack-test.gemspec
CHANGED
@@ -1,21 +1,27 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "assert-rack-test/version"
|
3
5
|
|
4
6
|
Gem::Specification.new do |gem|
|
5
|
-
gem.
|
6
|
-
gem.
|
7
|
-
gem.
|
7
|
+
gem.name = "assert-rack-test"
|
8
|
+
gem.version = Assert::Rack::Test::VERSION
|
9
|
+
gem.authors = ["Collin Redding", "Kelly Redding"]
|
10
|
+
gem.email = ["collin.redding@me.com, kelly@kellyredding.com"]
|
8
11
|
gem.summary = %q{Assert with Rack::Test}
|
9
|
-
gem.
|
12
|
+
gem.description = %q{Assert with Rack::Test}
|
13
|
+
gem.homepage = "https://github.com/redding/assert-rack-test"
|
14
|
+
gem.license = 'MIT'
|
10
15
|
|
11
|
-
gem.
|
12
|
-
gem.
|
13
|
-
gem.test_files =
|
14
|
-
gem.name = "assert-rack-test"
|
16
|
+
gem.files = `git ls-files`.split($/)
|
17
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
18
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
15
19
|
gem.require_paths = ["lib"]
|
16
|
-
gem.version = Assert::Rack::Test::VERSION
|
17
20
|
|
18
|
-
gem.
|
19
|
-
|
21
|
+
gem.required_ruby_version = "~> 2.5"
|
22
|
+
|
23
|
+
gem.add_development_dependency("assert", ["~> 2.19.0"])
|
24
|
+
gem.add_dependency("rack-test", ["~> 1.1"])
|
25
|
+
|
20
26
|
end
|
21
27
|
|
data/lib/assert-rack-test.rb
CHANGED
@@ -1,18 +1,11 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
def self.included(klass)
|
11
|
-
klass.class_eval do
|
12
|
-
include ::Rack::Test::Methods
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
1
|
+
require "assert/context"
|
2
|
+
require "rack/test"
|
3
|
+
require "assert-rack-test/version"
|
4
|
+
|
5
|
+
module Assert::Rack::Test
|
6
|
+
def self.included(klass)
|
7
|
+
klass.class_eval do
|
8
|
+
include ::Rack::Test::Methods
|
16
9
|
end
|
17
10
|
end
|
18
11
|
end
|
data/log/.gitkeep
ADDED
File without changes
|
data/test/helper.rb
CHANGED
@@ -1,5 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
# this file is automatically required when you run `assert`
|
2
|
+
# put any test helpers here
|
3
|
+
|
4
|
+
# add the root dir to the load path
|
5
|
+
$LOAD_PATH.unshift(File.expand_path("../..", __FILE__))
|
6
|
+
|
7
|
+
# require pry for debugging (`binding.pry`)
|
8
|
+
require 'pry'
|
9
|
+
|
10
|
+
require 'test/support/factory'
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require "assert"
|
2
|
+
require "assert-rack-test"
|
3
|
+
|
4
|
+
module Assert::Rack::Test
|
5
|
+
class UnitTests < Assert::Context
|
6
|
+
desc "Assert::Context"
|
7
|
+
subject{ @context_class }
|
8
|
+
|
9
|
+
setup do
|
10
|
+
@context_class = Assert::Context
|
11
|
+
end
|
12
|
+
|
13
|
+
should "include the Rack::Test::Methods" do
|
14
|
+
assert_that(subject).includes(Rack::Test::Methods)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
metadata
CHANGED
@@ -1,105 +1,88 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: assert-rack-test
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 1
|
10
|
-
version: 1.0.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
13
|
-
- Kelly Redding
|
6
|
+
authors:
|
14
7
|
- Collin Redding
|
8
|
+
- Kelly Redding
|
15
9
|
autorequire:
|
16
10
|
bindir: bin
|
17
11
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
- !ruby/object:Gem::Dependency
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
24
|
-
none: false
|
25
|
-
requirements:
|
26
|
-
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 15
|
29
|
-
segments:
|
30
|
-
- 1
|
31
|
-
- 0
|
32
|
-
version: "1.0"
|
33
|
-
requirement: *id001
|
12
|
+
date: 2020-12-24 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
34
15
|
name: assert
|
35
|
-
|
36
|
-
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 2.19.0
|
21
|
+
type: :development
|
37
22
|
prerelease: false
|
38
|
-
version_requirements:
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
segments:
|
45
|
-
- 0
|
46
|
-
- 6
|
47
|
-
version: "0.6"
|
48
|
-
requirement: *id002
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 2.19.0
|
28
|
+
- !ruby/object:Gem::Dependency
|
49
29
|
name: rack-test
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '1.1'
|
50
35
|
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.1'
|
51
42
|
description: Assert with Rack::Test
|
52
|
-
email:
|
53
|
-
- collin.redding@me.com
|
43
|
+
email:
|
44
|
+
- collin.redding@me.com, kelly@kellyredding.com
|
54
45
|
executables: []
|
55
|
-
|
56
46
|
extensions: []
|
57
|
-
|
58
47
|
extra_rdoc_files: []
|
59
|
-
|
60
|
-
|
61
|
-
- .
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- ".ruby-version"
|
62
51
|
- Gemfile
|
63
|
-
-
|
64
|
-
-
|
52
|
+
- LICENSE
|
53
|
+
- README.md
|
65
54
|
- assert-rack-test.gemspec
|
66
55
|
- lib/assert-rack-test.rb
|
67
56
|
- lib/assert-rack-test/version.rb
|
57
|
+
- log/.gitkeep
|
68
58
|
- test/helper.rb
|
69
|
-
- test/
|
70
|
-
|
71
|
-
|
72
|
-
|
59
|
+
- test/support/factory.rb
|
60
|
+
- test/unit/assert-rack-test_tests.rb
|
61
|
+
- tmp/.gitkeep
|
62
|
+
homepage: https://github.com/redding/assert-rack-test
|
63
|
+
licenses:
|
64
|
+
- MIT
|
65
|
+
metadata: {}
|
73
66
|
post_install_message:
|
74
67
|
rdoc_options: []
|
75
|
-
|
76
|
-
require_paths:
|
68
|
+
require_paths:
|
77
69
|
- lib
|
78
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
- 0
|
86
|
-
version: "0"
|
87
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
-
none: false
|
89
|
-
requirements:
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '2.5'
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
90
77
|
- - ">="
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
|
93
|
-
segments:
|
94
|
-
- 0
|
95
|
-
version: "0"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
96
80
|
requirements: []
|
97
|
-
|
98
|
-
rubyforge_project:
|
99
|
-
rubygems_version: 1.8.15
|
81
|
+
rubygems_version: 3.1.2
|
100
82
|
signing_key:
|
101
|
-
specification_version:
|
83
|
+
specification_version: 4
|
102
84
|
summary: Assert with Rack::Test
|
103
|
-
test_files:
|
85
|
+
test_files:
|
104
86
|
- test/helper.rb
|
105
|
-
- test/
|
87
|
+
- test/support/factory.rb
|
88
|
+
- test/unit/assert-rack-test_tests.rb
|
data/README.markdown
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
# Assert-Rack-Test
|
2
|
-
|
3
|
-
The [assert](https://github.com/teaminsight/assert) gem with [rack/test](https://github.com/brynary/rack-test). This gem just mixes in the Rack::Test methods into the Assert context, allowing you to use Rack::Test's get, post, put, etc... methods within an Assert context.
|
4
|
-
|
5
|
-
## Installation
|
6
|
-
|
7
|
-
In your Gemfile add:
|
8
|
-
|
9
|
-
group :test do
|
10
|
-
gem 'assert-rack-test'
|
11
|
-
end
|
12
|
-
|
13
|
-
Then run `bundle install` to install the gem.
|
14
|
-
|
15
|
-
## Usage
|
16
|
-
|
17
|
-
Use assert as you normally would. Inherit from a context and use any of rack test's methods in your tests:
|
18
|
-
|
19
|
-
```ruby
|
20
|
-
class BaseTest < Asset::Context
|
21
|
-
desc "some test"
|
22
|
-
setup do
|
23
|
-
get '/some/route'
|
24
|
-
end
|
25
|
-
|
26
|
-
should "have returned a successful response" do
|
27
|
-
assert_equal 200, last_response.status
|
28
|
-
assert_equal "Some route indeed!", last_response.body
|
29
|
-
end
|
30
|
-
end
|
31
|
-
```
|
32
|
-
|
33
|
-
You still need to define an app method, like you normally would for rack test:
|
34
|
-
|
35
|
-
```ruby
|
36
|
-
# app method for entire test suite
|
37
|
-
Assert::Context.class_eval do
|
38
|
-
def app
|
39
|
-
MyApp.new
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
# or for one context
|
44
|
-
class BaseTest < Assert::Context
|
45
|
-
|
46
|
-
def app
|
47
|
-
OtherApp.new
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
51
|
-
```
|
52
|
-
|
53
|
-
## License
|
54
|
-
|
55
|
-
Copyright (c) 2011 Kelly Redding, Collin Redding, and Team Insight
|
56
|
-
|
57
|
-
Permission is hereby granted, free of charge, to any person
|
58
|
-
obtaining a copy of this software and associated documentation
|
59
|
-
files (the "Software"), to deal in the Software without
|
60
|
-
restriction, including without limitation the rights to use,
|
61
|
-
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
62
|
-
copies of the Software, and to permit persons to whom the
|
63
|
-
Software is furnished to do so, subject to the following
|
64
|
-
conditions:
|
65
|
-
|
66
|
-
The above copyright notice and this permission notice shall be
|
67
|
-
included in all copies or substantial portions of the Software.
|
68
|
-
|
69
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
70
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
71
|
-
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
72
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
73
|
-
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
74
|
-
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
75
|
-
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
76
|
-
OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'assert'
|
2
|
-
|
3
|
-
module Assert::Rack::Test
|
4
|
-
|
5
|
-
class BaseTest < Assert::Context
|
6
|
-
desc "Assert::Context"
|
7
|
-
setup do
|
8
|
-
@class = Assert::Context
|
9
|
-
@instance = Assert::Context.new
|
10
|
-
end
|
11
|
-
subject{ @instance }
|
12
|
-
|
13
|
-
should have_instance_methods :get, :post, :put, :delete
|
14
|
-
|
15
|
-
should "include the Rack::Test::Methods" do
|
16
|
-
assert_includes Rack::Test::Methods, @class.included_modules
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|