cuba-sugar 0.2.2 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/cuba-sugar.gemspec CHANGED
@@ -1,18 +1,17 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cuba-sugar"
3
- s.version = "0.2.2"
3
+ s.version = "0.2.4"
4
4
  s.summary = "Give Cuba some Sugar!"
5
- s.description = "Useful stuff to use with cuba-contrib"
5
+ s.description = "Useful stuff to use with cuba"
6
6
  s.authors = ["elcuervo"]
7
7
  s.email = ["yo@brunoaguirre.com"]
8
8
  s.homepage = "http://github.com/elcuervo/cuba-sugar"
9
9
  s.files = `git ls-files`.split("\n")
10
10
  s.test_files = `git ls-files test`.split("\n")
11
11
 
12
- s.add_dependency("cuba")
13
- s.add_dependency("cuba-contrib")
14
- s.add_dependency("json")
15
- s.add_dependency("rack_csrf")
12
+ s.add_dependency("cuba", "~> 3.0")
13
+ s.add_dependency("json", "~> 1.6.6")
14
+ s.add_dependency("rack_csrf", "~> 2.4.0")
16
15
 
17
- s.add_development_dependency("cutest")
16
+ s.add_development_dependency("cutest", "~> 1.1.3")
18
17
  end
data/lib/cuba/sugar.rb CHANGED
@@ -1,18 +1,7 @@
1
- require "cuba/contrib"
2
1
  require "rack/csrf"
3
2
 
4
3
  module Cuba::Sugar
5
4
 
6
- # Sugar to access root of a page
7
- #
8
- # @example
9
- # on post, root do
10
- # as do
11
- # "Welcome!"
12
- # end
13
- # end
14
- def root; "" end
15
-
16
5
  # Sugar to access an option verb
17
6
  #
18
7
  # @example
data/test/as.rb CHANGED
@@ -12,9 +12,9 @@ test "set status and headers through helper" do
12
12
 
13
13
  env = { "SCRIPT_NAME" => "/", "PATH_INFO" => "/users" }
14
14
 
15
- _, _, resp = Cuba.call(env)
15
+ code, headers, resp = Cuba.call(env)
16
16
 
17
- assert_equal 201, resp.status
18
- assert_equal ["User Created"], resp.body
19
- assert_equal "http://somewhere.com/users/705", resp.headers["Content-Location"]
17
+ assert_equal 201, code
18
+ assert_equal ["User Created"], resp
19
+ assert_equal "http://somewhere.com/users/705", headers["Content-Location"]
20
20
  end
data/test/as_json.rb CHANGED
@@ -15,10 +15,10 @@ test "set a block to return json" do
15
15
 
16
16
  env = { "SCRIPT_NAME" => "/", "PATH_INFO" => "/drinks" }
17
17
 
18
- _, _, resp = Cuba.call(env)
18
+ code, headers, resp = Cuba.call(env)
19
19
 
20
- assert_equal 201, resp.status
21
- assert_equal "application/json", resp.headers["Content-Type"]
22
- assert_equal [rum_and_coke.to_json], resp.body
23
- assert_equal "http://somewhere.com/drinks/42", resp.headers["Content-Location"]
20
+ assert_equal 201, code
21
+ assert_equal "application/json", headers["Content-Type"]
22
+ assert_equal [rum_and_coke.to_json], resp
23
+ assert_equal "http://somewhere.com/drinks/42", headers["Content-Location"]
24
24
  end
data/test/csrf.rb CHANGED
@@ -1,7 +1,9 @@
1
1
  require File.expand_path("helper", File.dirname(__FILE__))
2
+ require 'cuba/render'
2
3
 
3
4
  test "set status and headers through helper" do
4
5
  Cuba.plugin Cuba::Sugar
6
+ Cuba.plugin Cuba::Render
5
7
  Cuba.define do
6
8
  on "users" do
7
9
  as do
@@ -12,9 +14,9 @@ test "set status and headers through helper" do
12
14
 
13
15
  env = { "SCRIPT_NAME" => "/", "PATH_INFO" => "/users", 'rack.session' => {} }
14
16
 
15
- _, _, resp = Cuba.call(env)
17
+ code, headers, resp = Cuba.call(env)
16
18
 
17
19
  assert env.fetch("rack.session").has_key?("csrf.token")
18
- assert /_csrf/ =~ resp.body.first
20
+ assert /_csrf/ =~ resp.first
19
21
  assert_equal 44, env.fetch("rack.session").fetch("csrf.token").size
20
22
  end
data/test/helpers.rb CHANGED
@@ -20,5 +20,5 @@ test "set status and headers through helpers" do
20
20
 
21
21
  _, _, resp = Cuba.call(env)
22
22
 
23
- assert_equal ["I will shout: HELLO"], resp.body
23
+ assert_equal ["I will shout: HELLO"], resp
24
24
  end
data/test/redirect.rb CHANGED
@@ -10,8 +10,8 @@ test "redirect helper" do
10
10
 
11
11
  env = { "SCRIPT_NAME" => "/", "PATH_INFO" => "/old" }
12
12
 
13
- _, _, resp = Cuba.call(env)
13
+ code, headers, _ = Cuba.call(env)
14
14
 
15
- assert_equal 302, resp.status
16
- assert_equal "/new", resp.headers["Location"]
15
+ assert_equal 302, code
16
+ assert_equal "/new", headers["Location"]
17
17
  end
data/test/subdomain.rb CHANGED
@@ -22,6 +22,6 @@ test "eval only in a given subdomain" do
22
22
  _, _, sub_resp = Cuba.call(subdomain_env)
23
23
  _, _, resp = Cuba.call(standard_env)
24
24
 
25
- assert_equal ["Subdomain"], sub_resp.body
26
- assert_equal ["Main"], resp.body
25
+ assert_equal ["Subdomain"], sub_resp
26
+ assert_equal ["Main"], resp
27
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuba-sugar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,64 +9,53 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-19 00:00:00.000000000Z
12
+ date: 2012-03-29 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cuba
16
- requirement: &70204609640940 !ruby/object:Gem::Requirement
16
+ requirement: &70145888408160 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: '3.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70204609640940
25
- - !ruby/object:Gem::Dependency
26
- name: cuba-contrib
27
- requirement: &70204609640500 !ruby/object:Gem::Requirement
28
- none: false
29
- requirements:
30
- - - ! '>='
31
- - !ruby/object:Gem::Version
32
- version: '0'
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: *70204609640500
24
+ version_requirements: *70145888408160
36
25
  - !ruby/object:Gem::Dependency
37
26
  name: json
38
- requirement: &70204605330560 !ruby/object:Gem::Requirement
27
+ requirement: &70145888407580 !ruby/object:Gem::Requirement
39
28
  none: false
40
29
  requirements:
41
- - - ! '>='
30
+ - - ~>
42
31
  - !ruby/object:Gem::Version
43
- version: '0'
32
+ version: 1.6.6
44
33
  type: :runtime
45
34
  prerelease: false
46
- version_requirements: *70204605330560
35
+ version_requirements: *70145888407580
47
36
  - !ruby/object:Gem::Dependency
48
37
  name: rack_csrf
49
- requirement: &70204605330140 !ruby/object:Gem::Requirement
38
+ requirement: &70145888407060 !ruby/object:Gem::Requirement
50
39
  none: false
51
40
  requirements:
52
- - - ! '>='
41
+ - - ~>
53
42
  - !ruby/object:Gem::Version
54
- version: '0'
43
+ version: 2.4.0
55
44
  type: :runtime
56
45
  prerelease: false
57
- version_requirements: *70204605330140
46
+ version_requirements: *70145888407060
58
47
  - !ruby/object:Gem::Dependency
59
48
  name: cutest
60
- requirement: &70204605329720 !ruby/object:Gem::Requirement
49
+ requirement: &70145888406560 !ruby/object:Gem::Requirement
61
50
  none: false
62
51
  requirements:
63
- - - ! '>='
52
+ - - ~>
64
53
  - !ruby/object:Gem::Version
65
- version: '0'
54
+ version: 1.1.3
66
55
  type: :development
67
56
  prerelease: false
68
- version_requirements: *70204605329720
69
- description: Useful stuff to use with cuba-contrib
57
+ version_requirements: *70145888406560
58
+ description: Useful stuff to use with cuba
70
59
  email:
71
60
  - yo@brunoaguirre.com
72
61
  executables: []
@@ -108,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
97
  version: '0'
109
98
  requirements: []
110
99
  rubyforge_project:
111
- rubygems_version: 1.8.10
100
+ rubygems_version: 1.8.15
112
101
  signing_key:
113
102
  specification_version: 3
114
103
  summary: Give Cuba some Sugar!