assert-rack-test 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'rake', '~> 0.9.2'
4
+
5
+ # Specify your gem's dependencies in assert-rack-test.gemspec
6
+ gemspec
data/README.markdown ADDED
@@ -0,0 +1,76 @@
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 ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+
4
+ require 'assert/rake_tasks'
5
+ Assert::RakeTasks.for :test
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/assert-rack-test/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Kelly Redding", "Collin Redding"]
6
+ gem.email = ["collin.redding@me.com"]
7
+ gem.description = %q{Assert with Rack::Test}
8
+ gem.summary = %q{Assert with Rack::Test}
9
+ gem.homepage = ""
10
+
11
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.name = "assert-rack-test"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Assert::Rack::Test::VERSION
17
+
18
+ gem.add_dependency("assert", ["~>0.7"])
19
+ gem.add_dependency("rack-test", ["~>0.6.1"])
20
+ end
21
+
@@ -0,0 +1,14 @@
1
+ require 'assert'
2
+ require 'rack/test'
3
+
4
+ module Assert
5
+ module Rack
6
+ module Test
7
+ autoload :VERSION, "assert-rack-test/version"
8
+ end
9
+ end
10
+ end
11
+
12
+ Assert::Context.class_eval do
13
+ include Rack::Test::Methods
14
+ end
@@ -0,0 +1,7 @@
1
+ module Assert
2
+ module Rack
3
+ module Test
4
+ VERSION = "0.1.0"
5
+ end
6
+ end
7
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,5 @@
1
+ root_path = File.expand_path("../..", __FILE__)
2
+ if !$LOAD_PATH.include?(root_path)
3
+ $LOAD_PATH.unshift(root_path)
4
+ end
5
+ require 'assert-rack-test'
@@ -0,0 +1,20 @@
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
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: assert-rack-test
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Kelly Redding
14
+ - Collin Redding
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2011-10-20 00:00:00 Z
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ type: :runtime
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 5
30
+ segments:
31
+ - 0
32
+ - 7
33
+ version: "0.7"
34
+ version_requirements: *id001
35
+ name: assert
36
+ - !ruby/object:Gem::Dependency
37
+ type: :runtime
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ hash: 5
45
+ segments:
46
+ - 0
47
+ - 6
48
+ - 1
49
+ version: 0.6.1
50
+ version_requirements: *id002
51
+ name: rack-test
52
+ description: Assert with Rack::Test
53
+ email:
54
+ - collin.redding@me.com
55
+ executables: []
56
+
57
+ extensions: []
58
+
59
+ extra_rdoc_files: []
60
+
61
+ files:
62
+ - .gitignore
63
+ - Gemfile
64
+ - README.markdown
65
+ - Rakefile
66
+ - assert-rack-test.gemspec
67
+ - lib/assert-rack-test.rb
68
+ - lib/assert-rack-test/version.rb
69
+ - test/helper.rb
70
+ - test/unit/assert-rack-test_test.rb
71
+ homepage: ""
72
+ licenses: []
73
+
74
+ post_install_message:
75
+ rdoc_options: []
76
+
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ hash: 3
85
+ segments:
86
+ - 0
87
+ version: "0"
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ hash: 3
94
+ segments:
95
+ - 0
96
+ version: "0"
97
+ requirements: []
98
+
99
+ rubyforge_project:
100
+ rubygems_version: 1.8.11
101
+ signing_key:
102
+ specification_version: 3
103
+ summary: Assert with Rack::Test
104
+ test_files:
105
+ - test/helper.rb
106
+ - test/unit/assert-rack-test_test.rb