chicago 0.3.9 → 0.3.10

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.9
1
+ 0.3.10
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{chicago}
8
- s.version = "0.3.9"
8
+ s.version = "0.3.10"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Justin 'Gus' Knowlden"]
12
- s.date = %q{2009-12-21}
12
+ s.date = %q{2010-05-10}
13
13
  s.description = %q{Sinatra runtime and testing extensions used commonly by Thumblemonks. For example, :json_response, which turns an object into JSON and sets the content-type appropriately.}
14
14
  s.email = %q{gus@gusg.us}
15
15
  s.extra_rdoc_files = [
@@ -43,7 +43,7 @@ Gem::Specification.new do |s|
43
43
  s.homepage = %q{http://github.com/thumblemonks/chicago}
44
44
  s.rdoc_options = ["--charset=UTF-8"]
45
45
  s.require_paths = ["lib"]
46
- s.rubygems_version = %q{1.3.5}
46
+ s.rubygems_version = %q{1.3.6}
47
47
  s.summary = %q{Sinatra runtime and testing extensions used commonly by Thumblemonks}
48
48
  s.test_files = [
49
49
  "test/riot_tests/application_test.rb",
@@ -25,8 +25,10 @@ module Chicago
25
25
  end.matches(expected_path)
26
26
  end
27
27
 
28
- def asserts_json_response(json)
29
- asserts_content_type 'application/json'
28
+ def asserts_json_response(*args)
29
+ content_type = args.length > 1 ? args.shift : 'application/json'
30
+ json = args.shift
31
+ asserts_content_type content_type
30
32
 
31
33
  json = json.to_json unless json.instance_of?(String)
32
34
  json
@@ -5,6 +5,16 @@ context "Riot Macros Test:" do
5
5
  mock_app {
6
6
  helpers Sinatra::Chicago::Responders
7
7
  get("/redirector") { redirect '/foo/bar' }
8
+
9
+ get("/basic-json") do
10
+ content_type 'application/json'
11
+ {:foo => "bar"}.to_json
12
+ end
13
+
14
+ get("/json-with-content-type") do
15
+ content_type 'text/javascript', :charset => "utf-8"
16
+ {:foo => "bar"}.to_json
17
+ end
8
18
  }
9
19
  end
10
20
 
@@ -12,4 +22,14 @@ context "Riot Macros Test:" do
12
22
  setup { get('/redirector') }
13
23
  asserts_redirected_to('/foo/bar')
14
24
  end # asserts redirected to
25
+
26
+ context "basic json response" do
27
+ setup { get('/basic-json') }
28
+ asserts_json_response({:foo => "bar"})
29
+ end # asserts redirected to
30
+
31
+ context "json response with special content-type" do
32
+ setup { get('/json-with-content-type') }
33
+ asserts_json_response("text/javascript;charset=utf-8", {:foo => "bar"})
34
+ end # asserts redirected to
15
35
  end
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chicago
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.9
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 3
8
+ - 10
9
+ version: 0.3.10
5
10
  platform: ruby
6
11
  authors:
7
12
  - Justin 'Gus' Knowlden
@@ -9,29 +14,33 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2009-12-21 00:00:00 -06:00
17
+ date: 2010-05-10 00:00:00 -05:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: riot
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
23
29
  version: "0"
24
- version:
30
+ type: :development
31
+ version_requirements: *id001
25
32
  - !ruby/object:Gem::Dependency
26
33
  name: rack-test
27
- type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
34
+ prerelease: false
35
+ requirement: &id002 !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - ">="
32
38
  - !ruby/object:Gem::Version
39
+ segments:
40
+ - 0
33
41
  version: "0"
34
- version:
42
+ type: :development
43
+ version_requirements: *id002
35
44
  description: Sinatra runtime and testing extensions used commonly by Thumblemonks. For example, :json_response, which turns an object into JSON and sets the content-type appropriately.
36
45
  email: gus@gusg.us
37
46
  executables: []
@@ -77,18 +86,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
77
86
  requirements:
78
87
  - - ">="
79
88
  - !ruby/object:Gem::Version
89
+ segments:
90
+ - 0
80
91
  version: "0"
81
- version:
82
92
  required_rubygems_version: !ruby/object:Gem::Requirement
83
93
  requirements:
84
94
  - - ">="
85
95
  - !ruby/object:Gem::Version
96
+ segments:
97
+ - 0
86
98
  version: "0"
87
- version:
88
99
  requirements: []
89
100
 
90
101
  rubyforge_project:
91
- rubygems_version: 1.3.5
102
+ rubygems_version: 1.3.6
92
103
  signing_key:
93
104
  specification_version: 3
94
105
  summary: Sinatra runtime and testing extensions used commonly by Thumblemonks