thumblemonks-chicago 0.3.2 → 0.3.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/chicago.gemspec +4 -4
- data/lib/chicago/protest/macros.rb +13 -0
- data/test/application_test.rb +5 -14
- data/test/helpers_test.rb +2 -2
- data/test/protest_macros_test.rb +15 -0
- data/test/responders_test.rb +3 -8
- metadata +3 -4
- data/HISTORY.txt +0 -8
data/chicago.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "chicago"
|
3
|
-
s.version = "0.3.2"
|
3
|
+
s.version = "0.3.2.1"
|
4
4
|
s.date = "2009-06-28"
|
5
5
|
s.summary = "Sinatra runtime and testing extensions used commonly by Thumblemonks"
|
6
6
|
s.email = %w[gus@gusg.us gabriel.gironda@gmail.com]
|
@@ -10,14 +10,12 @@ Gem::Specification.new do |s|
|
|
10
10
|
|
11
11
|
s.has_rdoc = false
|
12
12
|
s.rdoc_options = ["--main", "README.markdown"]
|
13
|
-
s.extra_rdoc_files = ["
|
13
|
+
s.extra_rdoc_files = ["README.markdown"]
|
14
14
|
|
15
15
|
# run git ls-files to get an updated list
|
16
16
|
s.files = %w[
|
17
|
-
HISTORY.txt
|
18
17
|
MIT-LICENSE
|
19
18
|
README.markdown
|
20
|
-
Rakefile
|
21
19
|
chicago.gemspec
|
22
20
|
lib/chicago.rb
|
23
21
|
lib/chicago/application.rb
|
@@ -30,8 +28,10 @@ Gem::Specification.new do |s|
|
|
30
28
|
]
|
31
29
|
|
32
30
|
s.test_files = %w[
|
31
|
+
Rakefile
|
33
32
|
test/application_test.rb
|
34
33
|
test/helpers_test.rb
|
34
|
+
test/protest_macros_test.rb
|
35
35
|
test/responders_test.rb
|
36
36
|
test/test_helper.rb
|
37
37
|
]
|
@@ -27,6 +27,19 @@ module Chicago
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
+
# Usage:
|
31
|
+
# assert_redirected_to '/foo/bar'
|
32
|
+
def asserts_redirected_to(expected_path)
|
33
|
+
asserts_response_status 302
|
34
|
+
asserts_location expected_path
|
35
|
+
# TODO: implement a matches operator
|
36
|
+
# action = expected_path.kind_of?(Regexp) ? 'match' : 'equal'
|
37
|
+
# send("assert_#{action}", expected_path, last_response.headers["Location"])
|
38
|
+
end
|
39
|
+
|
40
|
+
def asserts_location(expected_path)
|
41
|
+
asserts("location header").equals(expected_path) { last_response.headers["Location"] }
|
42
|
+
end
|
30
43
|
end # Macros
|
31
44
|
end # Protest
|
32
45
|
end # Chicago
|
data/test/application_test.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
1
|
+
require 'test_helper'
|
2
2
|
|
3
|
-
context "
|
3
|
+
context "Application Test:" do
|
4
4
|
|
5
5
|
setup do
|
6
6
|
mock_app {
|
@@ -20,30 +20,21 @@ context "ApplicationTest:" do
|
|
20
20
|
# TODO: change to namespace
|
21
21
|
context "catching all css" do
|
22
22
|
context "with default path" do
|
23
|
-
setup
|
24
|
-
get '/stylesheets/foo.css'
|
25
|
-
end
|
26
|
-
|
23
|
+
setup { get '/stylesheets/foo.css' }
|
27
24
|
asserts_response_status 200
|
28
25
|
asserts_content_type 'text/css'
|
29
26
|
asserts_response_body %r[.bar \{\s+display: none; \}\s]
|
30
27
|
end
|
31
28
|
|
32
29
|
context "with specified path" do
|
33
|
-
setup
|
34
|
-
get '/css/goo.css'
|
35
|
-
end
|
36
|
-
|
30
|
+
setup { get '/css/goo.css' }
|
37
31
|
asserts_response_status 200
|
38
32
|
asserts_content_type 'text/css'
|
39
33
|
asserts_response_body %r[.car \{\s+display: some; \}\s]
|
40
34
|
end
|
41
35
|
|
42
36
|
context "with path that's not a defined a sass file" do
|
43
|
-
setup
|
44
|
-
get '/stylesheets/zoo.css'
|
45
|
-
end
|
46
|
-
|
37
|
+
setup { get '/stylesheets/zoo.css' }
|
47
38
|
asserts_response_status 404
|
48
39
|
asserts_content_type 'text/html'
|
49
40
|
end
|
data/test/helpers_test.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
context "Protest Macros Test:" do
|
4
|
+
setup do
|
5
|
+
mock_app {
|
6
|
+
helpers Sinatra::Chicago::Responders
|
7
|
+
get("/redirecter") { redirect '/foo/bar' }
|
8
|
+
}
|
9
|
+
end
|
10
|
+
|
11
|
+
context "asserts redirected to" do
|
12
|
+
setup { get('/redirecter') }
|
13
|
+
asserts_redirected_to('/foo/bar')
|
14
|
+
end # asserts redirected to
|
15
|
+
end
|
data/test/responders_test.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
context "RespondersTest" do
|
1
|
+
require 'test_helper'
|
4
2
|
|
3
|
+
context "Responders Test:" do
|
5
4
|
setup do
|
6
5
|
mock_app {
|
7
6
|
helpers Sinatra::Chicago::Responders
|
@@ -13,12 +12,8 @@ context "RespondersTest" do
|
|
13
12
|
end
|
14
13
|
|
15
14
|
context "json response" do
|
16
|
-
setup
|
17
|
-
get "/json_bait"
|
18
|
-
end
|
19
|
-
|
15
|
+
setup { get "/json_bait" }
|
20
16
|
asserts_response_status 201
|
21
17
|
asserts_json_response({:foo => :bar})
|
22
18
|
end # json response
|
23
|
-
|
24
19
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thumblemonks-chicago
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.2
|
4
|
+
version: 0.3.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Knowlden
|
@@ -23,13 +23,10 @@ executables: []
|
|
23
23
|
extensions: []
|
24
24
|
|
25
25
|
extra_rdoc_files:
|
26
|
-
- HISTORY.txt
|
27
26
|
- README.markdown
|
28
27
|
files:
|
29
|
-
- HISTORY.txt
|
30
28
|
- MIT-LICENSE
|
31
29
|
- README.markdown
|
32
|
-
- Rakefile
|
33
30
|
- chicago.gemspec
|
34
31
|
- lib/chicago.rb
|
35
32
|
- lib/chicago/application.rb
|
@@ -67,7 +64,9 @@ signing_key:
|
|
67
64
|
specification_version: 2
|
68
65
|
summary: Sinatra runtime and testing extensions used commonly by Thumblemonks
|
69
66
|
test_files:
|
67
|
+
- Rakefile
|
70
68
|
- test/application_test.rb
|
71
69
|
- test/helpers_test.rb
|
70
|
+
- test/protest_macros_test.rb
|
72
71
|
- test/responders_test.rb
|
73
72
|
- test/test_helper.rb
|