innate 2010.07 → 2011.01
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/.gitignore +5 -0
- data/AUTHORS +4 -3
- data/CHANGELOG +895 -829
- data/MANIFEST +1 -2
- data/README.md +5 -9
- data/innate.gemspec +3 -3
- data/lib/innate/helper.rb +2 -2
- data/lib/innate/session.rb +19 -3
- data/lib/innate/version.rb +1 -1
- data/spec/innate/helper.rb +12 -1
- data/spec/innate/session.rb +37 -0
- metadata +5 -13
- data/lib/innate/helper/send_file.rb +0 -26
- data/spec/innate/helper/send_file.rb +0 -21
data/MANIFEST
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
.gitignore
|
|
1
2
|
AUTHORS
|
|
2
3
|
CHANGELOG
|
|
3
4
|
COPYING
|
|
@@ -40,7 +41,6 @@ lib/innate/helper/flash.rb
|
|
|
40
41
|
lib/innate/helper/link.rb
|
|
41
42
|
lib/innate/helper/redirect.rb
|
|
42
43
|
lib/innate/helper/render.rb
|
|
43
|
-
lib/innate/helper/send_file.rb
|
|
44
44
|
lib/innate/log.rb
|
|
45
45
|
lib/innate/log/color_formatter.rb
|
|
46
46
|
lib/innate/log/hub.rb
|
|
@@ -87,7 +87,6 @@ spec/innate/helper/flash.rb
|
|
|
87
87
|
spec/innate/helper/link.rb
|
|
88
88
|
spec/innate/helper/redirect.rb
|
|
89
89
|
spec/innate/helper/render.rb
|
|
90
|
-
spec/innate/helper/send_file.rb
|
|
91
90
|
spec/innate/helper/view/aspect_hello.xhtml
|
|
92
91
|
spec/innate/helper/view/locals.xhtml
|
|
93
92
|
spec/innate/helper/view/loop.xhtml
|
data/README.md
CHANGED
|
@@ -115,7 +115,7 @@ And another example, using Node with a normal server:
|
|
|
115
115
|
Installing Innate from git is highly recommended, since it gives you easy
|
|
116
116
|
access to alternate branches, bugfixes, and new features.
|
|
117
117
|
|
|
118
|
-
git clone git://github.com/
|
|
118
|
+
git clone git://github.com/Ramaze/innate.git
|
|
119
119
|
|
|
120
120
|
Do not forget to add the innate/lib directory to your `RUBYLIB` environment
|
|
121
121
|
variable.
|
|
@@ -127,15 +127,11 @@ your shell:
|
|
|
127
127
|
|
|
128
128
|
### Via gem install
|
|
129
129
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
gem install manveru-innate --source=http://gems.github.com
|
|
133
|
-
|
|
134
|
-
#### From Rubyforge
|
|
135
|
-
|
|
136
|
-
Not yet, and not sure when I'll get around to do this, feel free to ask if you
|
|
137
|
-
want to maintain the project at rubyforge.
|
|
130
|
+
gem install innate
|
|
138
131
|
|
|
132
|
+
### Direct download
|
|
133
|
+
|
|
134
|
+
Download the latest tarball from [here](http://github.com/Ramaze/innate/tarball/master).
|
|
139
135
|
|
|
140
136
|
## Concepts
|
|
141
137
|
|
data/innate.gemspec
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |s|
|
|
4
4
|
s.name = %q{innate}
|
|
5
|
-
s.version = "
|
|
5
|
+
s.version = "2011.01"
|
|
6
6
|
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.1") if s.respond_to? :required_rubygems_version=
|
|
8
8
|
s.authors = ["Michael 'manveru' Fellinger"]
|
|
9
|
-
s.date = %q{
|
|
9
|
+
s.date = %q{2011-01-26}
|
|
10
10
|
s.description = %q{Simple, straight-forward base for web-frameworks.}
|
|
11
11
|
s.email = %q{m.fellinger@gmail.com}
|
|
12
|
-
s.files = ["AUTHORS", "CHANGELOG", "COPYING", "MANIFEST", "README.md", "Rakefile", "example/app/retro_games.rb", "example/app/todo/layout/default.xhtml", "example/app/todo/spec/todo.rb", "example/app/todo/start.rb", "example/app/todo/view/index.xhtml", "example/app/whywiki_erb/layout/wiki.html.erb", "example/app/whywiki_erb/spec/wiki.rb", "example/app/whywiki_erb/start.rb", "example/app/whywiki_erb/view/edit.erb", "example/app/whywiki_erb/view/index.erb", "example/custom_middleware.rb", "example/hello.rb", "example/howto_spec.rb", "example/link.rb", "example/provides.rb", "example/session.rb", "innate.gemspec", "lib/innate.rb", "lib/innate/action.rb", "lib/innate/adapter.rb", "lib/innate/cache.rb", "lib/innate/cache/api.rb", "lib/innate/cache/drb.rb", "lib/innate/cache/file_based.rb", "lib/innate/cache/marshal.rb", "lib/innate/cache/memory.rb", "lib/innate/cache/yaml.rb", "lib/innate/current.rb", "lib/innate/dynamap.rb", "lib/innate/helper.rb", "lib/innate/helper/aspect.rb", "lib/innate/helper/cgi.rb", "lib/innate/helper/flash.rb", "lib/innate/helper/link.rb", "lib/innate/helper/redirect.rb", "lib/innate/helper/render.rb", "lib/innate/
|
|
12
|
+
s.files = [".gitignore", "AUTHORS", "CHANGELOG", "COPYING", "MANIFEST", "README.md", "Rakefile", "example/app/retro_games.rb", "example/app/todo/layout/default.xhtml", "example/app/todo/spec/todo.rb", "example/app/todo/start.rb", "example/app/todo/view/index.xhtml", "example/app/whywiki_erb/layout/wiki.html.erb", "example/app/whywiki_erb/spec/wiki.rb", "example/app/whywiki_erb/start.rb", "example/app/whywiki_erb/view/edit.erb", "example/app/whywiki_erb/view/index.erb", "example/custom_middleware.rb", "example/hello.rb", "example/howto_spec.rb", "example/link.rb", "example/provides.rb", "example/session.rb", "innate.gemspec", "lib/innate.rb", "lib/innate/action.rb", "lib/innate/adapter.rb", "lib/innate/cache.rb", "lib/innate/cache/api.rb", "lib/innate/cache/drb.rb", "lib/innate/cache/file_based.rb", "lib/innate/cache/marshal.rb", "lib/innate/cache/memory.rb", "lib/innate/cache/yaml.rb", "lib/innate/current.rb", "lib/innate/dynamap.rb", "lib/innate/helper.rb", "lib/innate/helper/aspect.rb", "lib/innate/helper/cgi.rb", "lib/innate/helper/flash.rb", "lib/innate/helper/link.rb", "lib/innate/helper/redirect.rb", "lib/innate/helper/render.rb", "lib/innate/log.rb", "lib/innate/log/color_formatter.rb", "lib/innate/log/hub.rb", "lib/innate/middleware_compiler.rb", "lib/innate/mock.rb", "lib/innate/node.rb", "lib/innate/options.rb", "lib/innate/options/dsl.rb", "lib/innate/options/stub.rb", "lib/innate/request.rb", "lib/innate/response.rb", "lib/innate/route.rb", "lib/innate/session.rb", "lib/innate/session/flash.rb", "lib/innate/spec.rb", "lib/innate/spec/bacon.rb", "lib/innate/state.rb", "lib/innate/state/accessor.rb", "lib/innate/traited.rb", "lib/innate/trinity.rb", "lib/innate/version.rb", "lib/innate/view.rb", "lib/innate/view/erb.rb", "lib/innate/view/etanni.rb", "lib/innate/view/none.rb", "spec/example/app/retro_games.rb", "spec/example/hello.rb", "spec/example/link.rb", "spec/example/provides.rb", "spec/example/session.rb", "spec/helper.rb", "spec/innate/action/layout.rb", "spec/innate/action/layout/file_layout.xhtml", "spec/innate/cache/common.rb", "spec/innate/cache/marshal.rb", "spec/innate/cache/memory.rb", "spec/innate/cache/yaml.rb", "spec/innate/dynamap.rb", "spec/innate/etanni.rb", "spec/innate/helper.rb", "spec/innate/helper/aspect.rb", "spec/innate/helper/cgi.rb", "spec/innate/helper/flash.rb", "spec/innate/helper/link.rb", "spec/innate/helper/redirect.rb", "spec/innate/helper/render.rb", "spec/innate/helper/view/aspect_hello.xhtml", "spec/innate/helper/view/locals.xhtml", "spec/innate/helper/view/loop.xhtml", "spec/innate/helper/view/num.xhtml", "spec/innate/helper/view/partial.xhtml", "spec/innate/helper/view/recursive.xhtml", "spec/innate/mock.rb", "spec/innate/modes.rb", "spec/innate/node/mapping.rb", "spec/innate/node/node.rb", "spec/innate/node/resolve.rb", "spec/innate/node/view/another_layout/another_layout.xhtml", "spec/innate/node/view/bar.xhtml", "spec/innate/node/view/cat2/cat22.xhtml", "spec/innate/node/view/cat3/cat33.xhtml", "spec/innate/node/view/foo.html.xhtml", "spec/innate/node/view/only_view.xhtml", "spec/innate/node/view/sub/baz.xhtml", "spec/innate/node/view/sub/foo/baz.xhtml", "spec/innate/node/view/with_layout.xhtml", "spec/innate/node/wrap_action_call.rb", "spec/innate/options.rb", "spec/innate/parameter.rb", "spec/innate/provides.rb", "spec/innate/provides/list.html.xhtml", "spec/innate/provides/list.txt.xhtml", "spec/innate/request.rb", "spec/innate/response.rb", "spec/innate/route.rb", "spec/innate/session.rb", "spec/innate/traited.rb", "tasks/authors.rake", "tasks/bacon.rake", "tasks/changelog.rake", "tasks/gem.rake", "tasks/gem_setup.rake", "tasks/grancher.rake", "tasks/manifest.rake", "tasks/rcov.rake", "tasks/release.rake", "tasks/reversion.rake", "tasks/setup.rake", "tasks/ycov.rake"]
|
|
13
13
|
s.homepage = %q{http://github.com/manveru/innate}
|
|
14
14
|
s.require_paths = ["lib"]
|
|
15
15
|
s.rubyforge_project = %q{innate}
|
data/lib/innate/helper.rb
CHANGED
|
@@ -77,7 +77,7 @@ module Innate
|
|
|
77
77
|
:exts, %w[rb so bundle]
|
|
78
78
|
|
|
79
79
|
o "Default helpers, added on inclusion of the Helper module",
|
|
80
|
-
:default, [:aspect, :cgi, :flash, :link, :render, :redirect
|
|
80
|
+
:default, [:aspect, :cgi, :flash, :link, :render, :redirect]
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
EXTS = %w[rb so bundle]
|
|
@@ -152,7 +152,7 @@ module Innate
|
|
|
152
152
|
# helper :foo_bar # => FooBar
|
|
153
153
|
# helper :foo # => Foo
|
|
154
154
|
def get(name)
|
|
155
|
-
module_name = /^#{name.to_s.dup.delete('_')}
|
|
155
|
+
module_name = /^#{name.to_s.dup.delete('_')}(?:helper)?$/i
|
|
156
156
|
|
|
157
157
|
options.namespaces.each do |namespace|
|
|
158
158
|
found = namespace.constants.grep(module_name).first
|
data/lib/innate/session.rb
CHANGED
|
@@ -38,6 +38,8 @@ module Innate
|
|
|
38
38
|
:ttl, (60 * 60 * 24 * 30) # 30 days
|
|
39
39
|
o "Length of generated Session ID (only applies when using SecureRandom)",
|
|
40
40
|
:sid_length, 64
|
|
41
|
+
o "cookie cannot be accessed through client side script (http://www.owasp.org/index.php/HttpOnly)",
|
|
42
|
+
:httponly, false
|
|
41
43
|
|
|
42
44
|
trigger(:expires){|value|
|
|
43
45
|
self.ttl = value - Time.now.to_i
|
|
@@ -50,6 +52,7 @@ module Innate
|
|
|
50
52
|
def initialize(request, response)
|
|
51
53
|
@request, @response = request, response
|
|
52
54
|
@cookie_set = false
|
|
55
|
+
@force_new_cookie = false
|
|
53
56
|
@cache_sid = nil
|
|
54
57
|
@flash = Flash.new(self)
|
|
55
58
|
end
|
|
@@ -89,6 +92,13 @@ module Innate
|
|
|
89
92
|
@sid ||= cookie || generate_sid
|
|
90
93
|
end
|
|
91
94
|
|
|
95
|
+
def resid!
|
|
96
|
+
cache_sid
|
|
97
|
+
cache.delete(sid)
|
|
98
|
+
@sid = generate_sid
|
|
99
|
+
@force_new_cookie = true
|
|
100
|
+
end
|
|
101
|
+
|
|
92
102
|
private
|
|
93
103
|
|
|
94
104
|
def cache_sid
|
|
@@ -104,15 +114,21 @@ module Innate
|
|
|
104
114
|
end
|
|
105
115
|
|
|
106
116
|
def set_cookie(response)
|
|
107
|
-
return if @cookie_set || cookie
|
|
108
|
-
|
|
117
|
+
return if @cookie_set || (!@force_new_cookie && cookie)
|
|
118
|
+
|
|
109
119
|
@cookie_set = true
|
|
110
120
|
response.set_cookie(options.key, cookie_value)
|
|
121
|
+
@force_new_cookie = false
|
|
111
122
|
end
|
|
112
123
|
|
|
113
124
|
def cookie_value
|
|
114
125
|
o = options
|
|
115
|
-
cookie = {
|
|
126
|
+
cookie = {
|
|
127
|
+
:domain => o.domain,
|
|
128
|
+
:path => o.path,
|
|
129
|
+
:secure => o.secure,
|
|
130
|
+
:httponly => o.httponly
|
|
131
|
+
}
|
|
116
132
|
cookie[:expires] = (Time.now + o.ttl) if o.ttl
|
|
117
133
|
cookie.merge!(:value => sid)
|
|
118
134
|
end
|
data/lib/innate/version.rb
CHANGED
data/spec/innate/helper.rb
CHANGED
|
@@ -16,6 +16,12 @@ module Innate
|
|
|
16
16
|
':('
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
|
+
|
|
20
|
+
module FooBarHelper
|
|
21
|
+
def self.baz
|
|
22
|
+
"baz"
|
|
23
|
+
end
|
|
24
|
+
end
|
|
19
25
|
end
|
|
20
26
|
end
|
|
21
27
|
|
|
@@ -60,7 +66,7 @@ describe Innate::Helper::Link do
|
|
|
60
66
|
should 'construct link from ::a' do
|
|
61
67
|
FNL.a(:index).should == '<a href="/foo/index">index</a>'
|
|
62
68
|
FNL.a('index', :index, :x => :y).should == '<a href="/foo/index?x=y">index</a>'
|
|
63
|
-
FNL.a('duh/bar', 'duh/bar', :x => :y).should ==
|
|
69
|
+
FNL.a('duh/bar', 'duh/bar', :x => :y).should == "<a href=\"/foo/duh/bar?x=y\">duh/bar</a>"
|
|
64
70
|
FNL.a('foo', :/, :x => :y).should == '<a href="/foo/?x=y">foo</a>'
|
|
65
71
|
end
|
|
66
72
|
|
|
@@ -83,4 +89,9 @@ describe Innate::Helper::Link do
|
|
|
83
89
|
}.should.raise(LoadError).
|
|
84
90
|
message.should == "Helper foo not found"
|
|
85
91
|
end
|
|
92
|
+
|
|
93
|
+
should 'allow helper to be suffixed with "helper"' do
|
|
94
|
+
Innate::HelpersHelper.get(:foo_bar).baz.should == "baz"
|
|
95
|
+
Innate::HelpersHelper.get(:foo_bar_helper).baz.should == "baz"
|
|
96
|
+
end
|
|
86
97
|
end
|
data/spec/innate/session.rb
CHANGED
|
@@ -26,6 +26,11 @@ class SpecSession
|
|
|
26
26
|
def reset
|
|
27
27
|
session.clear
|
|
28
28
|
end
|
|
29
|
+
|
|
30
|
+
def resid
|
|
31
|
+
session.resid!
|
|
32
|
+
end
|
|
33
|
+
|
|
29
34
|
end
|
|
30
35
|
|
|
31
36
|
describe Innate::Session do
|
|
@@ -51,7 +56,39 @@ describe Innate::Session do
|
|
|
51
56
|
get('/decrement').body.should == n.to_s
|
|
52
57
|
end
|
|
53
58
|
end
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
should 'set a session cookie that can be changed with #resid!' do
|
|
62
|
+
clear_cookies
|
|
63
|
+
get '/init'
|
|
64
|
+
|
|
65
|
+
last_response['Set-Cookie'].should.not == nil
|
|
66
|
+
old_set_cookie = last_response['Set-Cookie']
|
|
67
|
+
sid = Innate::Current.session.sid
|
|
68
|
+
get '/increment'
|
|
69
|
+
get '/view'
|
|
70
|
+
last_response.body.should == '1'
|
|
71
|
+
|
|
72
|
+
get '/resid'
|
|
73
|
+
last_response['Set-Cookie'].should.not == nil
|
|
74
|
+
new_sid = Innate::Current.session.sid
|
|
75
|
+
new_sid.should.not == sid
|
|
54
76
|
|
|
77
|
+
get '/view'
|
|
78
|
+
last_response.body.should == '1'
|
|
79
|
+
last_response['Set-Cookie'].should == nil
|
|
80
|
+
Innate::Current.session.sid.should == new_sid
|
|
81
|
+
|
|
82
|
+
# We need to verify that the old session ID has been invalidated.
|
|
83
|
+
# The session data must be moved, not copied, on #resid!.
|
|
84
|
+
clear_cookies
|
|
85
|
+
set_cookie(old_set_cookie)
|
|
86
|
+
get '/view'
|
|
87
|
+
last_response.body.should == ''
|
|
88
|
+
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
|
|
55
92
|
should 'expose sid method' do
|
|
56
93
|
Innate::Current.session.sid.should.not.be.empty
|
|
57
94
|
end
|
metadata
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: innate
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash: 8045
|
|
5
4
|
prerelease: false
|
|
6
5
|
segments:
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
version: "
|
|
6
|
+
- 2011
|
|
7
|
+
- 1
|
|
8
|
+
version: "2011.01"
|
|
10
9
|
platform: ruby
|
|
11
10
|
authors:
|
|
12
11
|
- Michael 'manveru' Fellinger
|
|
@@ -14,7 +13,7 @@ autorequire:
|
|
|
14
13
|
bindir: bin
|
|
15
14
|
cert_chain: []
|
|
16
15
|
|
|
17
|
-
date:
|
|
16
|
+
date: 2011-01-26 00:00:00 -06:00
|
|
18
17
|
default_executable:
|
|
19
18
|
dependencies:
|
|
20
19
|
- !ruby/object:Gem::Dependency
|
|
@@ -25,7 +24,6 @@ dependencies:
|
|
|
25
24
|
requirements:
|
|
26
25
|
- - ">="
|
|
27
26
|
- !ruby/object:Gem::Version
|
|
28
|
-
hash: 19
|
|
29
27
|
segments:
|
|
30
28
|
- 1
|
|
31
29
|
- 1
|
|
@@ -41,7 +39,6 @@ dependencies:
|
|
|
41
39
|
requirements:
|
|
42
40
|
- - ">="
|
|
43
41
|
- !ruby/object:Gem::Version
|
|
44
|
-
hash: 19
|
|
45
42
|
segments:
|
|
46
43
|
- 1
|
|
47
44
|
- 1
|
|
@@ -57,7 +54,6 @@ dependencies:
|
|
|
57
54
|
requirements:
|
|
58
55
|
- - ">="
|
|
59
56
|
- !ruby/object:Gem::Version
|
|
60
|
-
hash: 13
|
|
61
57
|
segments:
|
|
62
58
|
- 0
|
|
63
59
|
- 5
|
|
@@ -73,7 +69,6 @@ dependencies:
|
|
|
73
69
|
requirements:
|
|
74
70
|
- - ~>
|
|
75
71
|
- !ruby/object:Gem::Version
|
|
76
|
-
hash: 31
|
|
77
72
|
segments:
|
|
78
73
|
- 1
|
|
79
74
|
- 2
|
|
@@ -90,6 +85,7 @@ extensions: []
|
|
|
90
85
|
extra_rdoc_files: []
|
|
91
86
|
|
|
92
87
|
files:
|
|
88
|
+
- .gitignore
|
|
93
89
|
- AUTHORS
|
|
94
90
|
- CHANGELOG
|
|
95
91
|
- COPYING
|
|
@@ -132,7 +128,6 @@ files:
|
|
|
132
128
|
- lib/innate/helper/link.rb
|
|
133
129
|
- lib/innate/helper/redirect.rb
|
|
134
130
|
- lib/innate/helper/render.rb
|
|
135
|
-
- lib/innate/helper/send_file.rb
|
|
136
131
|
- lib/innate/log.rb
|
|
137
132
|
- lib/innate/log/color_formatter.rb
|
|
138
133
|
- lib/innate/log/hub.rb
|
|
@@ -179,7 +174,6 @@ files:
|
|
|
179
174
|
- spec/innate/helper/link.rb
|
|
180
175
|
- spec/innate/helper/redirect.rb
|
|
181
176
|
- spec/innate/helper/render.rb
|
|
182
|
-
- spec/innate/helper/send_file.rb
|
|
183
177
|
- spec/innate/helper/view/aspect_hello.xhtml
|
|
184
178
|
- spec/innate/helper/view/locals.xhtml
|
|
185
179
|
- spec/innate/helper/view/loop.xhtml
|
|
@@ -237,7 +231,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
237
231
|
requirements:
|
|
238
232
|
- - ">="
|
|
239
233
|
- !ruby/object:Gem::Version
|
|
240
|
-
hash: 3
|
|
241
234
|
segments:
|
|
242
235
|
- 0
|
|
243
236
|
version: "0"
|
|
@@ -246,7 +239,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
246
239
|
requirements:
|
|
247
240
|
- - ">="
|
|
248
241
|
- !ruby/object:Gem::Version
|
|
249
|
-
hash: 25
|
|
250
242
|
segments:
|
|
251
243
|
- 1
|
|
252
244
|
- 3
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
module Innate
|
|
2
|
-
module Helper
|
|
3
|
-
module SendFile
|
|
4
|
-
# Not optimally performing but convenient way to send files by their
|
|
5
|
-
# filename.
|
|
6
|
-
#
|
|
7
|
-
# I think we should remove this from the default helpers and move it into
|
|
8
|
-
# Ramaze, the functionality is almost never used, the naming is ambigous,
|
|
9
|
-
# and it doesn't use the send_file capabilities of frontend servers.
|
|
10
|
-
#
|
|
11
|
-
# So for now, I'll mark it for deprecation
|
|
12
|
-
def send_file(filename, content_type = nil, content_disposition = nil)
|
|
13
|
-
content_type ||= Rack::Mime.mime_type(::File.extname(filename))
|
|
14
|
-
content_disposition ||= File.basename(filename)
|
|
15
|
-
|
|
16
|
-
response.body = ::File.readlines(filename, 'rb')
|
|
17
|
-
response['Content-Length'] = ::File.size(filename).to_s
|
|
18
|
-
response['Content-Type'] = content_type
|
|
19
|
-
response['Content-Disposition'] = content_disposition
|
|
20
|
-
response.status = 200
|
|
21
|
-
|
|
22
|
-
throw(:respond, response)
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
require File.expand_path('../../../helper', __FILE__)
|
|
2
|
-
|
|
3
|
-
class SpecSendFile
|
|
4
|
-
include Innate::Node
|
|
5
|
-
map '/'
|
|
6
|
-
|
|
7
|
-
def this
|
|
8
|
-
send_file(__FILE__)
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
describe Innate::Helper::SendFile do
|
|
13
|
-
should 'send __FILE__' do
|
|
14
|
-
got = Innate::Mock.get('/this')
|
|
15
|
-
|
|
16
|
-
got.body.should == File.read(__FILE__)
|
|
17
|
-
got.status.should == 200
|
|
18
|
-
got['Content-Length'].should == File.size(__FILE__).to_s
|
|
19
|
-
got['Content-Type'].should == 'text/x-script.ruby'
|
|
20
|
-
end
|
|
21
|
-
end
|