rspec-padrino 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/.rvmrc +1 -0
- data/Gemfile +16 -0
- data/Gemfile.lock +53 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +50 -0
- data/VERSION +1 -0
- data/lib/rspec-padrino.rb +3 -0
- data/lib/rspec/padrino.rb +12 -0
- data/lib/rspec/padrino/initializers/last_application.rb +44 -0
- data/lib/rspec/padrino/matchers.rb +9 -0
- data/lib/rspec/padrino/matchers/routing_matchers.rb +64 -0
- data/lib/rspec/padrino/methods.rb +7 -0
- data/rspec-padrino.gemspec +79 -0
- data/spec/integrations/last_application_spec.rb +24 -0
- data/spec/integrations/matchers_spec.rb +34 -0
- data/spec/integrations/mock_app_helper.rb +34 -0
- data/spec/rspec-padrino_spec.rb +15 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +12 -0
- metadata +150 -0
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm 1.9.2@padrino-rspec
|
data/Gemfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
gem "sinatra"
|
6
|
+
gem "padrino-core", ">= 0.10.2"
|
7
|
+
gem "rspec", "~> 2.3.0"
|
8
|
+
gem "rack-test", ">= 0"
|
9
|
+
|
10
|
+
# Add dependencies to develop your gem here.
|
11
|
+
# Include everything needed to run rake, tests, features, etc.
|
12
|
+
group :development do
|
13
|
+
gem "bundler", "~> 1.0.0"
|
14
|
+
gem "jeweler", "~> 1.6.4"
|
15
|
+
gem "rcov", ">= 0"
|
16
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activesupport (3.1.0)
|
5
|
+
multi_json (~> 1.0)
|
6
|
+
diff-lcs (1.1.3)
|
7
|
+
git (1.2.5)
|
8
|
+
http_router (0.10.2)
|
9
|
+
rack (>= 1.0.0)
|
10
|
+
url_mount (~> 0.2.1)
|
11
|
+
jeweler (1.6.4)
|
12
|
+
bundler (~> 1.0)
|
13
|
+
git (>= 1.2.5)
|
14
|
+
rake
|
15
|
+
multi_json (1.0.3)
|
16
|
+
padrino-core (0.10.2)
|
17
|
+
activesupport (~> 3.1.0)
|
18
|
+
http_router (~> 0.10.2)
|
19
|
+
sinatra (~> 1.2.6)
|
20
|
+
thor (~> 0.14.3)
|
21
|
+
tilt (~> 1.3.0)
|
22
|
+
rack (1.3.4)
|
23
|
+
rack-test (0.6.1)
|
24
|
+
rack (>= 1.0)
|
25
|
+
rake (0.9.2)
|
26
|
+
rcov (0.9.10)
|
27
|
+
rspec (2.3.0)
|
28
|
+
rspec-core (~> 2.3.0)
|
29
|
+
rspec-expectations (~> 2.3.0)
|
30
|
+
rspec-mocks (~> 2.3.0)
|
31
|
+
rspec-core (2.3.1)
|
32
|
+
rspec-expectations (2.3.0)
|
33
|
+
diff-lcs (~> 1.1.2)
|
34
|
+
rspec-mocks (2.3.0)
|
35
|
+
sinatra (1.2.7)
|
36
|
+
rack (~> 1.1)
|
37
|
+
tilt (>= 1.2.2, < 2.0)
|
38
|
+
thor (0.14.6)
|
39
|
+
tilt (1.3.3)
|
40
|
+
url_mount (0.2.1)
|
41
|
+
rack
|
42
|
+
|
43
|
+
PLATFORMS
|
44
|
+
ruby
|
45
|
+
|
46
|
+
DEPENDENCIES
|
47
|
+
bundler (~> 1.0.0)
|
48
|
+
jeweler (~> 1.6.4)
|
49
|
+
padrino-core (>= 0.10.2)
|
50
|
+
rack-test
|
51
|
+
rcov
|
52
|
+
rspec (~> 2.3.0)
|
53
|
+
sinatra
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Uchio Kondo
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= rspec-padrino
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Contributing to rspec-padrino
|
6
|
+
|
7
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
8
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
9
|
+
* Fork the project
|
10
|
+
* Start a feature/bugfix branch
|
11
|
+
* Commit and push until you are happy with your contribution
|
12
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2011 Uchio Kondo. See LICENSE.txt for
|
18
|
+
further details.
|
19
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "rspec-padrino"
|
18
|
+
gem.homepage = "http://github.com/udzura/rspec-padrino"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{rspec-padrino is a gem including helpers for testing a Padrino app.}
|
21
|
+
gem.description = %Q{rspec-padrino is a gem including helpers for testing a Padrino app using RSpec. Taking much from rspec-rails.}
|
22
|
+
gem.email = "udzura@udzura.jp"
|
23
|
+
gem.authors = ["Uchio Kondo"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rspec/core'
|
29
|
+
require 'rspec/core/rake_task'
|
30
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
31
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
32
|
+
spec.rspec_opts = "-fs --color"
|
33
|
+
end
|
34
|
+
|
35
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
36
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
37
|
+
spec.rcov = true
|
38
|
+
end
|
39
|
+
|
40
|
+
task :default => :spec
|
41
|
+
|
42
|
+
require 'rake/rdoctask'
|
43
|
+
Rake::RDocTask.new do |rdoc|
|
44
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
45
|
+
|
46
|
+
rdoc.rdoc_dir = 'rdoc'
|
47
|
+
rdoc.title = "rspec-padrino #{version}"
|
48
|
+
rdoc.rdoc_files.include('README*')
|
49
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
50
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module RSpec
|
2
|
+
module Padrino
|
3
|
+
require 'rspec/padrino/matchers'
|
4
|
+
require 'rspec/padrino/methods'
|
5
|
+
|
6
|
+
def self.included(base)
|
7
|
+
require 'rspec/padrino/initializers/last_application'
|
8
|
+
base.send :include, RSpec::Padrino::Matchers
|
9
|
+
base.send :include, RSpec::Padrino::Methods
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'sinatra/base'
|
2
|
+
require 'rack/test'
|
3
|
+
|
4
|
+
last_app = nil
|
5
|
+
|
6
|
+
Sinatra::Base.class_eval do
|
7
|
+
attr_reader :last_app
|
8
|
+
undef :call
|
9
|
+
define_method :call do |env|
|
10
|
+
_dup = dup
|
11
|
+
last_app = _dup
|
12
|
+
_dup.call!(env)
|
13
|
+
end
|
14
|
+
|
15
|
+
def assigns(sym)
|
16
|
+
valname = (RUBY_VERSION > '1.9') ? :"@#{sym}" : "@#{sym}"
|
17
|
+
instance_variables.include?(valname) ? instance_variable_get(valname) : nil
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
Rack::MockSession.class_eval do
|
22
|
+
alias original_request request
|
23
|
+
undef :request
|
24
|
+
define_method :request do |uri, env|
|
25
|
+
ret = original_request(uri, env)
|
26
|
+
@last_application = last_app
|
27
|
+
ret
|
28
|
+
end
|
29
|
+
|
30
|
+
def last_application
|
31
|
+
raise Rack::Test::Error.new("No application called yet. Request a page first.") unless @last_application
|
32
|
+
@last_application
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
module Rack::Test::Methods
|
37
|
+
def last_application
|
38
|
+
current_session.last_application
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
class Rack::Test::Session
|
43
|
+
def_delegator :@rack_mock_session, :last_application
|
44
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'sinatra/base'
|
2
|
+
require 'padrino-core'
|
3
|
+
module RSpec::Padrino::Matchers
|
4
|
+
module RoutingMatchers
|
5
|
+
last_params = nil
|
6
|
+
last_name = nil
|
7
|
+
Padrino::Application.class_eval do
|
8
|
+
before do
|
9
|
+
last_params = params
|
10
|
+
last_name = request.route_obj.named rescue nil
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
extend RSpec::Matchers::DSL
|
15
|
+
|
16
|
+
matcher :route_to do |*expected|
|
17
|
+
expected_routes = nil
|
18
|
+
|
19
|
+
match do |verb_to_path_map|
|
20
|
+
expected_names = expected.select{|v| Symbol === v }
|
21
|
+
expected_params = expected.select{|v| Hash === v }.first || {}
|
22
|
+
expected_routes = expected_names.dup.tap{|exp| exp << expected_params.symbolize_keys }
|
23
|
+
path, query = *verb_to_path_map.values.first.split('?')
|
24
|
+
query = Rack::Utils::parse_query(query)
|
25
|
+
method = verb_to_path_map.keys.first
|
26
|
+
begin
|
27
|
+
Padrino.application.call(Rack::MockRequest.env_for(verb_to_path_map.values.first, :method => method.to_s.upcase))
|
28
|
+
rescue
|
29
|
+
end
|
30
|
+
last_name == expected_names.join("_").to_sym &&
|
31
|
+
last_params.symbolize_keys == expected_params.symbolize_keys
|
32
|
+
end
|
33
|
+
|
34
|
+
failure_message_for_should do |actual|
|
35
|
+
last_names = last_name.to_s.split("_").map(&:to_sym)
|
36
|
+
last_names << last_params.symbolize_keys
|
37
|
+
"expected #{actual.inspect} to route to #{expected_routes.inspect}, got #{last_names.inspect}"
|
38
|
+
end
|
39
|
+
|
40
|
+
failure_message_for_should_not do |actual|
|
41
|
+
last_names = last_name.to_s.split("_").map(&:to_sym)
|
42
|
+
last_names << last_params.symbolize_keys
|
43
|
+
"expected #{actual.inspect} not to route to #{expected.inspect}, got #{last_names.inspect}"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
matcher :be_routable do
|
48
|
+
match do |verb_to_path_map|
|
49
|
+
begin
|
50
|
+
# compile Padrino's routing information
|
51
|
+
Padrino.application.call(Rack::MockRequest.env_for("/"))
|
52
|
+
end
|
53
|
+
path = verb_to_path_map.values.first
|
54
|
+
method = verb_to_path_map.keys.first.to_s.upcase
|
55
|
+
@routed_to = Padrino.mounted_apps.map(&:app_obj).
|
56
|
+
map{|a| a.router.recognize(Rack::MockRequest.env_for(path, :method => method))}.first
|
57
|
+
end
|
58
|
+
|
59
|
+
failure_message_for_should_not do |path|
|
60
|
+
"expected #{path.inspect} not to be routable, but it routes to #{@routed_to.inspect}"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "rspec-padrino"
|
8
|
+
s.version = "0.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Uchio Kondo"]
|
12
|
+
s.date = "2011-10-03"
|
13
|
+
s.description = "rspec-padrino is a gem including helpers for testing a Padrino app using RSpec. Taking much from rspec-rails."
|
14
|
+
s.email = "udzura@udzura.jp"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".rspec",
|
22
|
+
".rvmrc",
|
23
|
+
"Gemfile",
|
24
|
+
"Gemfile.lock",
|
25
|
+
"LICENSE.txt",
|
26
|
+
"README.rdoc",
|
27
|
+
"Rakefile",
|
28
|
+
"VERSION",
|
29
|
+
"lib/rspec-padrino.rb",
|
30
|
+
"lib/rspec/padrino.rb",
|
31
|
+
"lib/rspec/padrino/initializers/last_application.rb",
|
32
|
+
"lib/rspec/padrino/matchers.rb",
|
33
|
+
"lib/rspec/padrino/matchers/routing_matchers.rb",
|
34
|
+
"lib/rspec/padrino/methods.rb",
|
35
|
+
"rspec-padrino.gemspec",
|
36
|
+
"spec/integrations/last_application_spec.rb",
|
37
|
+
"spec/integrations/matchers_spec.rb",
|
38
|
+
"spec/integrations/mock_app_helper.rb",
|
39
|
+
"spec/rspec-padrino_spec.rb",
|
40
|
+
"spec/spec.opts",
|
41
|
+
"spec/spec_helper.rb"
|
42
|
+
]
|
43
|
+
s.homepage = "http://github.com/udzura/rspec-padrino"
|
44
|
+
s.licenses = ["MIT"]
|
45
|
+
s.require_paths = ["lib"]
|
46
|
+
s.rubygems_version = "1.8.10"
|
47
|
+
s.summary = "rspec-padrino is a gem including helpers for testing a Padrino app."
|
48
|
+
|
49
|
+
if s.respond_to? :specification_version then
|
50
|
+
s.specification_version = 3
|
51
|
+
|
52
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
53
|
+
s.add_runtime_dependency(%q<sinatra>, [">= 0"])
|
54
|
+
s.add_runtime_dependency(%q<padrino-core>, [">= 0.10.2"])
|
55
|
+
s.add_runtime_dependency(%q<rspec>, ["~> 2.3.0"])
|
56
|
+
s.add_runtime_dependency(%q<rack-test>, [">= 0"])
|
57
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
58
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
59
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
60
|
+
else
|
61
|
+
s.add_dependency(%q<sinatra>, [">= 0"])
|
62
|
+
s.add_dependency(%q<padrino-core>, [">= 0.10.2"])
|
63
|
+
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
64
|
+
s.add_dependency(%q<rack-test>, [">= 0"])
|
65
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
66
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
67
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
68
|
+
end
|
69
|
+
else
|
70
|
+
s.add_dependency(%q<sinatra>, [">= 0"])
|
71
|
+
s.add_dependency(%q<padrino-core>, [">= 0.10.2"])
|
72
|
+
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
73
|
+
s.add_dependency(%q<rack-test>, [">= 0"])
|
74
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
75
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
76
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/mock_app_helper')
|
3
|
+
|
4
|
+
describe "Integrations" do
|
5
|
+
context "last_application" do
|
6
|
+
subject { last_application }
|
7
|
+
|
8
|
+
it "exists" do
|
9
|
+
get "/foo"
|
10
|
+
should_not be_nil
|
11
|
+
end
|
12
|
+
|
13
|
+
it "is an instance of PadrinoApp" do
|
14
|
+
get "/foo"
|
15
|
+
should be_kind_of(TestApp)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "exists with assignment" do
|
19
|
+
get "/foo/assign"
|
20
|
+
last_application.assigns(:nonexist).should be_nil
|
21
|
+
last_application.assigns(:assigned).should eq(1)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/mock_app_helper')
|
3
|
+
|
4
|
+
describe "Integrations" do
|
5
|
+
context "routing" do
|
6
|
+
it "routes to /foo" do
|
7
|
+
{:get => "/foo"}.should route_to(:foo, :index)
|
8
|
+
end
|
9
|
+
|
10
|
+
it "routes to /foo/create" do
|
11
|
+
{:post => "/foo/create"}.should route_to(:foo, :create)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "routes to /foo/assign" do
|
15
|
+
{:get => "/foo/assign"}.should route_to(:foo, :assign)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "routes to /foo/assign?hoge=1234" do
|
19
|
+
{:get => "/foo/assign?hoge=1234"}.should route_to(:foo, :assign, :hoge => "1234")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "is not routeble on /" do
|
23
|
+
{:get => "/"}.should_not be_routable
|
24
|
+
end
|
25
|
+
|
26
|
+
it "is routable on /foo" do
|
27
|
+
{:get => "/foo"}.should be_routable
|
28
|
+
end
|
29
|
+
|
30
|
+
it "is routable on /foo/create with method POST" do
|
31
|
+
{:post => "/foo/create"}.should be_routable
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'padrino-core'
|
2
|
+
require 'rack/test'
|
3
|
+
|
4
|
+
class TestApp < Padrino::Application
|
5
|
+
register Padrino::Rendering
|
6
|
+
enable :sessions
|
7
|
+
set :session_secret, "fooo"
|
8
|
+
disable :logging
|
9
|
+
|
10
|
+
controllers :foo do
|
11
|
+
get :index do
|
12
|
+
"foo"
|
13
|
+
end
|
14
|
+
|
15
|
+
post :create do
|
16
|
+
"foo"
|
17
|
+
end
|
18
|
+
|
19
|
+
get :assign do
|
20
|
+
@assigned = 1
|
21
|
+
"bar"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
Padrino.mount("TestApp").to('/')
|
27
|
+
Padrino.load!
|
28
|
+
|
29
|
+
include Rack::Test::Methods
|
30
|
+
include RSpec::Padrino
|
31
|
+
|
32
|
+
def app
|
33
|
+
Padrino.application
|
34
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe Rspec::Padrino do
|
4
|
+
it "can be included" do
|
5
|
+
lambda { include Rspec::Padrino }.should_not raise_error
|
6
|
+
end
|
7
|
+
|
8
|
+
it "includes RSpec::Padrino::* automatically" do
|
9
|
+
module Foo
|
10
|
+
include RSpec::Padrino
|
11
|
+
end
|
12
|
+
Foo.should be_include(RSpec::Padrino::Methods)
|
13
|
+
Foo.should be_include(RSpec::Padrino::Matchers)
|
14
|
+
end
|
15
|
+
end
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
-fs --color
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'rspec'
|
4
|
+
require 'rspec-padrino'
|
5
|
+
|
6
|
+
# Requires supporting files with custom matchers and macros, etc,
|
7
|
+
# in ./support/ and its subdirectories.
|
8
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
|
12
|
+
end
|
metadata
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rspec-padrino
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Uchio Kondo
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-10-03 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: sinatra
|
16
|
+
requirement: &13069780 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *13069780
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: padrino-core
|
27
|
+
requirement: &13069240 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.10.2
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *13069240
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
requirement: &13068660 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 2.3.0
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *13068660
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rack-test
|
49
|
+
requirement: &13068060 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *13068060
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: bundler
|
60
|
+
requirement: &13067460 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ~>
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 1.0.0
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *13067460
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: jeweler
|
71
|
+
requirement: &13066840 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 1.6.4
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *13066840
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: rcov
|
82
|
+
requirement: &12936420 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *12936420
|
91
|
+
description: rspec-padrino is a gem including helpers for testing a Padrino app using
|
92
|
+
RSpec. Taking much from rspec-rails.
|
93
|
+
email: udzura@udzura.jp
|
94
|
+
executables: []
|
95
|
+
extensions: []
|
96
|
+
extra_rdoc_files:
|
97
|
+
- LICENSE.txt
|
98
|
+
- README.rdoc
|
99
|
+
files:
|
100
|
+
- .document
|
101
|
+
- .rspec
|
102
|
+
- .rvmrc
|
103
|
+
- Gemfile
|
104
|
+
- Gemfile.lock
|
105
|
+
- LICENSE.txt
|
106
|
+
- README.rdoc
|
107
|
+
- Rakefile
|
108
|
+
- VERSION
|
109
|
+
- lib/rspec-padrino.rb
|
110
|
+
- lib/rspec/padrino.rb
|
111
|
+
- lib/rspec/padrino/initializers/last_application.rb
|
112
|
+
- lib/rspec/padrino/matchers.rb
|
113
|
+
- lib/rspec/padrino/matchers/routing_matchers.rb
|
114
|
+
- lib/rspec/padrino/methods.rb
|
115
|
+
- rspec-padrino.gemspec
|
116
|
+
- spec/integrations/last_application_spec.rb
|
117
|
+
- spec/integrations/matchers_spec.rb
|
118
|
+
- spec/integrations/mock_app_helper.rb
|
119
|
+
- spec/rspec-padrino_spec.rb
|
120
|
+
- spec/spec.opts
|
121
|
+
- spec/spec_helper.rb
|
122
|
+
homepage: http://github.com/udzura/rspec-padrino
|
123
|
+
licenses:
|
124
|
+
- MIT
|
125
|
+
post_install_message:
|
126
|
+
rdoc_options: []
|
127
|
+
require_paths:
|
128
|
+
- lib
|
129
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
130
|
+
none: false
|
131
|
+
requirements:
|
132
|
+
- - ! '>='
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
segments:
|
136
|
+
- 0
|
137
|
+
hash: 3951091987802476587
|
138
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
none: false
|
140
|
+
requirements:
|
141
|
+
- - ! '>='
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
144
|
+
requirements: []
|
145
|
+
rubyforge_project:
|
146
|
+
rubygems_version: 1.8.10
|
147
|
+
signing_key:
|
148
|
+
specification_version: 3
|
149
|
+
summary: rspec-padrino is a gem including helpers for testing a Padrino app.
|
150
|
+
test_files: []
|