rack-test 0.6.3 → 1.0.0
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 +7 -0
- data/History.md +243 -0
- data/README.md +148 -0
- data/lib/rack/mock_session.rb +6 -9
- data/lib/rack/test/cookie_jar.rb +39 -27
- data/lib/rack/test/methods.rb +22 -22
- data/lib/rack/test/mock_digest_request.rb +1 -5
- data/lib/rack/test/uploaded_file.rb +51 -19
- data/lib/rack/test/utils.rb +37 -43
- data/lib/rack/test/version.rb +5 -0
- data/lib/rack/test.rb +94 -85
- metadata +139 -60
- data/.document +0 -4
- data/.gitignore +0 -6
- data/Gemfile +0 -8
- data/Gemfile.lock +0 -41
- data/History.txt +0 -179
- data/README.rdoc +0 -85
- data/Rakefile +0 -33
- data/Thorfile +0 -114
- data/rack-test.gemspec +0 -77
- data/spec/fixtures/bar.txt +0 -1
- data/spec/fixtures/config.ru +0 -3
- data/spec/fixtures/fake_app.rb +0 -143
- data/spec/fixtures/foo.txt +0 -1
- data/spec/rack/test/cookie_spec.rb +0 -219
- data/spec/rack/test/digest_auth_spec.rb +0 -46
- data/spec/rack/test/multipart_spec.rb +0 -145
- data/spec/rack/test/uploaded_file_spec.rb +0 -24
- data/spec/rack/test/utils_spec.rb +0 -193
- data/spec/rack/test_spec.rb +0 -550
- data/spec/spec_helper.rb +0 -69
- data/spec/support/matchers/body.rb +0 -9
- data/spec/support/matchers/challenge.rb +0 -11
data/spec/spec_helper.rb
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
require "rubygems"
|
2
|
-
require "bundler/setup"
|
3
|
-
|
4
|
-
require "codeclimate-test-reporter"
|
5
|
-
CodeClimate::TestReporter.start
|
6
|
-
|
7
|
-
require "rack"
|
8
|
-
require "rspec"
|
9
|
-
|
10
|
-
Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f}
|
11
|
-
|
12
|
-
require "rack/test"
|
13
|
-
require File.dirname(__FILE__) + "/fixtures/fake_app"
|
14
|
-
|
15
|
-
RSpec.configure do |config|
|
16
|
-
config.mock_with :rspec
|
17
|
-
config.include Rack::Test::Methods
|
18
|
-
|
19
|
-
def app
|
20
|
-
Rack::Lint.new(Rack::Test::FakeApp.new)
|
21
|
-
end
|
22
|
-
|
23
|
-
def check(*args)
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
shared_examples_for "any #verb methods" do
|
29
|
-
it "requests the URL using VERB" do
|
30
|
-
send(verb, "/")
|
31
|
-
|
32
|
-
check last_request.env["REQUEST_METHOD"].should == verb.upcase
|
33
|
-
last_response.should be_ok
|
34
|
-
end
|
35
|
-
|
36
|
-
it "uses the provided env" do
|
37
|
-
send(verb, "/", {}, { "HTTP_USER_AGENT" => "Rack::Test" })
|
38
|
-
last_request.env["HTTP_USER_AGENT"].should == "Rack::Test"
|
39
|
-
end
|
40
|
-
|
41
|
-
it "yields the response to a given block" do
|
42
|
-
yielded = false
|
43
|
-
|
44
|
-
send(verb, "/") do |response|
|
45
|
-
response.should be_ok
|
46
|
-
yielded = true
|
47
|
-
end
|
48
|
-
|
49
|
-
yielded.should be_true
|
50
|
-
end
|
51
|
-
|
52
|
-
it "sets the HTTP_HOST header with port" do
|
53
|
-
send(verb, "http://example.org:8080/uri")
|
54
|
-
last_request.env["HTTP_HOST"].should == "example.org:8080"
|
55
|
-
end
|
56
|
-
|
57
|
-
it "sets the HTTP_HOST header without port" do
|
58
|
-
send(verb, "/uri")
|
59
|
-
last_request.env["HTTP_HOST"].should == "example.org"
|
60
|
-
end
|
61
|
-
|
62
|
-
context "for a XHR" do
|
63
|
-
it "sends XMLHttpRequest for the X-Requested-With header" do
|
64
|
-
send(verb, "/", {}, { :xhr => true })
|
65
|
-
last_request.env["HTTP_X_REQUESTED_WITH"].should == "XMLHttpRequest"
|
66
|
-
last_request.should be_xhr
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
RSpec::Matchers.define :be_challenge do
|
2
|
-
match do |actual_response|
|
3
|
-
actual_response.status == 401 &&
|
4
|
-
actual_response['WWW-Authenticate'] =~ /^Digest / &&
|
5
|
-
actual_response.body.empty?
|
6
|
-
end
|
7
|
-
|
8
|
-
description do
|
9
|
-
"a HTTP Digest challenge response"
|
10
|
-
end
|
11
|
-
end
|