innate 2009.05 → 2009.06
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +3 -3
- data/CHANGELOG +812 -738
- data/MANIFEST +3 -2
- data/Rakefile +3 -3
- data/innate.gemspec +13 -5
- data/lib/innate.rb +5 -6
- data/lib/innate/cache/drb.rb +3 -3
- data/lib/innate/helper/render.rb +15 -6
- data/lib/innate/log/hub.rb +5 -1
- data/lib/innate/middleware_compiler.rb +1 -1
- data/lib/innate/session.rb +26 -16
- data/lib/innate/spec.rb +1 -23
- data/lib/innate/spec/bacon.rb +28 -0
- data/lib/innate/version.rb +1 -1
- data/spec/example/app/retro_games.rb +1 -1
- data/spec/example/hello.rb +1 -1
- data/spec/example/link.rb +1 -1
- data/spec/example/provides.rb +1 -1
- data/spec/example/session.rb +1 -1
- data/spec/innate/action/layout.rb +1 -1
- data/spec/innate/helper/aspect.rb +1 -1
- data/spec/innate/helper/flash.rb +1 -1
- data/spec/innate/helper/link.rb +1 -1
- data/spec/innate/helper/redirect.rb +1 -1
- data/spec/innate/helper/render.rb +5 -5
- data/spec/innate/modes.rb +61 -0
- data/spec/innate/node/node.rb +1 -1
- data/spec/innate/node/wrap_action_call.rb +1 -1
- data/spec/innate/options.rb +5 -1
- data/spec/innate/provides.rb +2 -2
- data/spec/innate/request.rb +6 -4
- data/spec/innate/session.rb +5 -1
- data/tasks/{gem_installer.rake → gem_setup.rake} +45 -22
- data/tasks/release.rake +4 -2
- data/tasks/setup.rake +4 -26
- metadata +36 -5
- data/tasks/install_dependencies.rake +0 -4
data/MANIFEST
CHANGED
@@ -56,6 +56,7 @@ lib/innate/route.rb
|
|
56
56
|
lib/innate/session.rb
|
57
57
|
lib/innate/session/flash.rb
|
58
58
|
lib/innate/spec.rb
|
59
|
+
lib/innate/spec/bacon.rb
|
59
60
|
lib/innate/state.rb
|
60
61
|
lib/innate/state/accessor.rb
|
61
62
|
lib/innate/traited.rb
|
@@ -93,6 +94,7 @@ spec/innate/helper/view/num.xhtml
|
|
93
94
|
spec/innate/helper/view/partial.xhtml
|
94
95
|
spec/innate/helper/view/recursive.xhtml
|
95
96
|
spec/innate/mock.rb
|
97
|
+
spec/innate/modes.rb
|
96
98
|
spec/innate/node/mapping.rb
|
97
99
|
spec/innate/node/node.rb
|
98
100
|
spec/innate/node/resolve.rb
|
@@ -115,9 +117,8 @@ tasks/authors.rake
|
|
115
117
|
tasks/bacon.rake
|
116
118
|
tasks/changelog.rake
|
117
119
|
tasks/gem.rake
|
118
|
-
tasks/
|
120
|
+
tasks/gem_setup.rake
|
119
121
|
tasks/grancher.rake
|
120
|
-
tasks/install_dependencies.rake
|
121
122
|
tasks/manifest.rake
|
122
123
|
tasks/rcov.rake
|
123
124
|
tasks/release.rake
|
data/Rakefile
CHANGED
@@ -26,9 +26,9 @@ GEMSPEC = Gem::Specification.new{|s|
|
|
26
26
|
s.add_dependency('rack', '~> 1.0.0')
|
27
27
|
|
28
28
|
# rip those out if they cause you trouble
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
s.add_development_dependency('bacon', '>= 1.1.0')
|
30
|
+
s.add_development_dependency('json', '~> 1.1.6')
|
31
|
+
s.add_development_dependency('rack-test', '>= 0.3.0')
|
32
32
|
}
|
33
33
|
|
34
34
|
Dir['tasks/*.rake'].each{|f| import(f) }
|
data/innate.gemspec
CHANGED
@@ -2,19 +2,18 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{innate}
|
5
|
-
s.version = "2009.
|
5
|
+
s.version = "2009.06"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Michael 'manveru' Fellinger"]
|
9
|
-
s.date = %q{2009-
|
9
|
+
s.date = %q{2009-06-02}
|
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/helper/send_file.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/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/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/send_file.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/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/foo.html.xhtml", "spec/innate/node/view/only_view.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/route.rb", "spec/innate/session.rb", "spec/innate/traited.rb", "tasks/authors.rake", "tasks/bacon.rake", "tasks/changelog.rake", "tasks/gem.rake", "tasks/
|
13
|
-
s.has_rdoc = true
|
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/helper/send_file.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/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/send_file.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/foo.html.xhtml", "spec/innate/node/view/only_view.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/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"]
|
14
13
|
s.homepage = %q{http://github.com/manveru/innate}
|
15
14
|
s.require_paths = ["lib"]
|
16
15
|
s.rubyforge_project = %q{innate}
|
17
|
-
s.rubygems_version = %q{1.3.
|
16
|
+
s.rubygems_version = %q{1.3.3}
|
18
17
|
s.summary = %q{Powerful web-framework wrapper for Rack.}
|
19
18
|
|
20
19
|
if s.respond_to? :specification_version then
|
@@ -23,10 +22,19 @@ Gem::Specification.new do |s|
|
|
23
22
|
|
24
23
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
25
24
|
s.add_runtime_dependency(%q<rack>, ["~> 1.0.0"])
|
25
|
+
s.add_development_dependency(%q<bacon>, [">= 1.1.0"])
|
26
|
+
s.add_development_dependency(%q<json>, ["~> 1.1.6"])
|
27
|
+
s.add_development_dependency(%q<rack-test>, [">= 0.3.0"])
|
26
28
|
else
|
27
29
|
s.add_dependency(%q<rack>, ["~> 1.0.0"])
|
30
|
+
s.add_dependency(%q<bacon>, [">= 1.1.0"])
|
31
|
+
s.add_dependency(%q<json>, ["~> 1.1.6"])
|
32
|
+
s.add_dependency(%q<rack-test>, [">= 0.3.0"])
|
28
33
|
end
|
29
34
|
else
|
30
35
|
s.add_dependency(%q<rack>, ["~> 1.0.0"])
|
36
|
+
s.add_dependency(%q<bacon>, [">= 1.1.0"])
|
37
|
+
s.add_dependency(%q<json>, ["~> 1.1.6"])
|
38
|
+
s.add_dependency(%q<rack-test>, [">= 0.3.0"])
|
31
39
|
end
|
32
40
|
end
|
data/lib/innate.rb
CHANGED
@@ -107,7 +107,7 @@ module Innate
|
|
107
107
|
file = given_options.delete(:file)
|
108
108
|
|
109
109
|
found_root = go_figure_root(caller, :root => root, :file => file)
|
110
|
-
Innate.options.roots = [found_root] if found_root
|
110
|
+
Innate.options.roots = [*found_root] if found_root
|
111
111
|
|
112
112
|
# Convert some top-level option keys to the internal ones that we use.
|
113
113
|
PROXY_OPTIONS.each{|k,v| given_options[v] = given_options.delete(k) }
|
@@ -255,16 +255,15 @@ module Innate
|
|
255
255
|
#
|
256
256
|
# @see Rack::MiddlewareCompiler
|
257
257
|
middleware :dev do |m|
|
258
|
-
m.apps(Rack::Lint, Rack::
|
259
|
-
Rack::
|
260
|
-
Rack::Head)
|
258
|
+
m.apps(Rack::Lint, Rack::Head, Rack::ContentLength, Rack::CommonLogger,
|
259
|
+
Rack::ShowExceptions, Rack::ShowStatus, Rack::ConditionalGet)
|
261
260
|
m.use(Rack::Reloader, 2)
|
262
261
|
m.innate
|
263
262
|
end
|
264
263
|
|
265
264
|
middleware :live do |m|
|
266
|
-
m.apps(Rack::
|
267
|
-
Rack::
|
265
|
+
m.apps(Rack::Head, Rack::ContentLength, Rack::CommonLogger,
|
266
|
+
Rack::ShowStatus, Rack::ConditionalGet)
|
268
267
|
m.innate
|
269
268
|
end
|
270
269
|
end
|
data/lib/innate/cache/drb.rb
CHANGED
@@ -9,7 +9,7 @@ module Innate
|
|
9
9
|
# example below is using a normal Hash, but it is recommended to use a
|
10
10
|
# thread-safe alternative like SyncHash.
|
11
11
|
#
|
12
|
-
# @usage
|
12
|
+
# @example usage of DRb server
|
13
13
|
# require 'drb'
|
14
14
|
#
|
15
15
|
# URI = "druby://127.0.0.1:9069"
|
@@ -23,10 +23,10 @@ module Innate
|
|
23
23
|
# Please note that on some Ruby implementations, access to Hash is not
|
24
24
|
# atomic and you might need to lock around access to avoid race conditions.
|
25
25
|
#
|
26
|
-
# @
|
26
|
+
# @example for all caches
|
27
27
|
# Innate.options.cache.default = Innate::Cache::DRb
|
28
28
|
#
|
29
|
-
# @
|
29
|
+
# @example for sessions only
|
30
30
|
# Innate.options.cache.session = Innate::Cache::DRb
|
31
31
|
class DRb
|
32
32
|
include Cache::API
|
data/lib/innate/helper/render.rb
CHANGED
@@ -115,14 +115,23 @@ module Innate
|
|
115
115
|
# @see render_custom
|
116
116
|
# @author manveru
|
117
117
|
def render_file(filename, variables = {})
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
118
|
+
action = Action.create(:view => filename)
|
119
|
+
action.sync_variables(self.action)
|
120
|
+
|
121
|
+
action.node = self.class
|
122
|
+
action.engine = self.action.engine
|
123
|
+
action.instance = action.node.new
|
124
|
+
action.variables = variables.dup
|
125
|
+
|
126
|
+
yield(action) if block_given?
|
127
|
+
|
128
|
+
valid_action = action.view || action.method
|
129
|
+
Log.warn("Empty action: %p" % [action]) unless valid_action
|
130
|
+
action.render
|
124
131
|
end
|
125
132
|
|
133
|
+
# @api internal
|
134
|
+
# @author manveru
|
126
135
|
def render_custom(action_name, variables = {})
|
127
136
|
unless action = resolve(action_name.to_s)
|
128
137
|
raise(ArgumentError, "No Action %p on #{self}" % [action_name])
|
data/lib/innate/log/hub.rb
CHANGED
@@ -63,11 +63,15 @@ module Innate
|
|
63
63
|
eval %~
|
64
64
|
def #{meth}(*args, &block)
|
65
65
|
return unless @active
|
66
|
-
@loggers.each{|
|
66
|
+
args.each{|arg| @loggers.each{|logger| logger.#{meth}(arg, &block) }}
|
67
67
|
end
|
68
68
|
~
|
69
69
|
|
70
70
|
send(meth, *args, &block)
|
71
71
|
end
|
72
|
+
|
73
|
+
def write(*args)
|
74
|
+
self.<<(*args)
|
75
|
+
end
|
72
76
|
end
|
73
77
|
end
|
data/lib/innate/session.rb
CHANGED
@@ -9,12 +9,17 @@ module Innate
|
|
9
9
|
# You may store anything in here that you may also store in the corresponding
|
10
10
|
# store, usually it's best to keep it to things that are safe to Marshal.
|
11
11
|
#
|
12
|
-
# The
|
13
|
-
# Time.at(2147483647) # => Tue Jan 19 12:14:07 +0900 2038
|
12
|
+
# The Session instance is compatible with the specification of rack.session.
|
14
13
|
#
|
15
|
-
#
|
14
|
+
# Since the Time class is used to create the cookie expiration timestamp, you
|
15
|
+
# will have to keep the ttl in a reasonable range.
|
16
|
+
# The maximum value that Time can store on a 32bit system is:
|
17
|
+
# Time.at(2147483647) # => Tue Jan 19 12:14:07 +0900 2038
|
16
18
|
#
|
17
|
-
# The
|
19
|
+
# The default expiration time for cookies and the session cache was reduced
|
20
|
+
# to a default of 30 days.
|
21
|
+
# This was done to be compatible with the maximum ttl of MemCache. You may
|
22
|
+
# increase this value if you do not use MemCache to persist your sessions.
|
18
23
|
class Session
|
19
24
|
include Optioned
|
20
25
|
|
@@ -28,7 +33,14 @@ module Innate
|
|
28
33
|
o "Use secure cookie",
|
29
34
|
:secure, false
|
30
35
|
o "Time of cookie expiration",
|
31
|
-
:expires,
|
36
|
+
:expires, nil
|
37
|
+
o "Time to live for session cookies and cache, nil/false will prevent setting",
|
38
|
+
:ttl, (60 * 60 * 24 * 30) # 30 days
|
39
|
+
|
40
|
+
trigger(:expires){|v|
|
41
|
+
self.ttl = v - Time.now.to_i
|
42
|
+
Log.warn("Innate::Session.options.expires is deprecated, use #ttl instead")
|
43
|
+
}
|
32
44
|
end
|
33
45
|
|
34
46
|
attr_reader :cookie_set, :request, :response, :flash
|
@@ -67,21 +79,20 @@ module Innate
|
|
67
79
|
return if !@cache_sid or @cache_sid.empty?
|
68
80
|
|
69
81
|
flash.rotate!
|
70
|
-
|
71
|
-
cache.store(sid, cache_sid, :ttl => ttl)
|
82
|
+
cache.store(sid, cache_sid, :ttl => options.ttl)
|
72
83
|
set_cookie(response)
|
73
84
|
end
|
74
85
|
|
86
|
+
def sid
|
87
|
+
@sid ||= cookie || generate_sid
|
88
|
+
end
|
89
|
+
|
75
90
|
private
|
76
91
|
|
77
92
|
def cache_sid
|
78
93
|
@cache_sid ||= cache[sid] || {}
|
79
94
|
end
|
80
95
|
|
81
|
-
def sid
|
82
|
-
@sid ||= cookie || generate_sid
|
83
|
-
end
|
84
|
-
|
85
96
|
def cookie
|
86
97
|
@request.cookies[options.key]
|
87
98
|
end
|
@@ -98,11 +109,10 @@ module Innate
|
|
98
109
|
end
|
99
110
|
|
100
111
|
def cookie_value
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
:expires => options.expires }
|
112
|
+
o = options
|
113
|
+
cookie = {:domain => o.domain, :path => o.path, :secure => o.secure}
|
114
|
+
cookie[:expires] = (Time.now + o.ttl) if o.ttl
|
115
|
+
cookie.merge!(:value => sid)
|
106
116
|
end
|
107
117
|
|
108
118
|
def generate_sid
|
data/lib/innate/spec.rb
CHANGED
@@ -1,23 +1 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'bacon'
|
4
|
-
require 'rack/test'
|
5
|
-
require(File.expand_path("#{__FILE__}/../")) unless defined?(Innate)
|
6
|
-
|
7
|
-
Bacon.summary_on_exit
|
8
|
-
|
9
|
-
module Innate
|
10
|
-
# minimal middleware, no exception handling
|
11
|
-
middleware(:spec){|m| m.innate }
|
12
|
-
|
13
|
-
# skip starting adapter
|
14
|
-
options.started = true
|
15
|
-
options.mode = :spec
|
16
|
-
end
|
17
|
-
|
18
|
-
shared :mock do
|
19
|
-
Innate.setup_dependencies
|
20
|
-
extend Rack::Test::Methods
|
21
|
-
|
22
|
-
def app; Innate.middleware; end
|
23
|
-
end
|
1
|
+
require 'innate/spec/bacon'
|
@@ -0,0 +1,28 @@
|
|
1
|
+
begin; require 'rubygems'; rescue LoadError; end
|
2
|
+
|
3
|
+
require 'bacon'
|
4
|
+
require 'rack/test'
|
5
|
+
require File.expand_path('../../', __FILE__) unless defined?(Innate)
|
6
|
+
|
7
|
+
Bacon.summary_on_exit
|
8
|
+
|
9
|
+
module Innate
|
10
|
+
# minimal middleware, no exception handling
|
11
|
+
middleware(:spec){|m| m.innate }
|
12
|
+
|
13
|
+
# skip starting adapter
|
14
|
+
options.started = true
|
15
|
+
options.mode = :spec
|
16
|
+
end
|
17
|
+
|
18
|
+
shared :rack_test do
|
19
|
+
Innate.setup_dependencies
|
20
|
+
extend Rack::Test::Methods
|
21
|
+
|
22
|
+
def app; Innate.middleware; end
|
23
|
+
end
|
24
|
+
|
25
|
+
shared :mock do
|
26
|
+
warn 'behaves_like(:mock) is deprecated, use behaves_like(:rack_test) instead'
|
27
|
+
behaves_like :rack_test
|
28
|
+
end
|
data/lib/innate/version.rb
CHANGED
data/spec/example/hello.rb
CHANGED
data/spec/example/link.rb
CHANGED
data/spec/example/provides.rb
CHANGED
data/spec/example/session.rb
CHANGED
data/spec/innate/helper/flash.rb
CHANGED
data/spec/innate/helper/link.rb
CHANGED
@@ -130,7 +130,7 @@ describe Innate::Helper::Link do
|
|
130
130
|
end
|
131
131
|
|
132
132
|
describe '#route_self' do
|
133
|
-
behaves_like :
|
133
|
+
behaves_like :rack_test
|
134
134
|
should 'provide a route to the node of the currently active action' do
|
135
135
|
get('/auto_route').body.should == '/elsewhere'
|
136
136
|
get('/two/auto_route').body.should == '/two/elsewhere'
|
@@ -96,7 +96,7 @@ end
|
|
96
96
|
|
97
97
|
describe Innate::Helper::Render do
|
98
98
|
describe '#render_full' do
|
99
|
-
behaves_like :
|
99
|
+
behaves_like :rack_test
|
100
100
|
|
101
101
|
it 'renders a full action' do
|
102
102
|
get('/render_full/standard').body.should == 'foo: []'
|
@@ -120,7 +120,7 @@ describe Innate::Helper::Render do
|
|
120
120
|
end
|
121
121
|
|
122
122
|
describe '#render_partial' do
|
123
|
-
behaves_like :
|
123
|
+
behaves_like :rack_test
|
124
124
|
|
125
125
|
it 'renders action with layout' do
|
126
126
|
get('/render_partial/standard').body.should == '{ hello }'
|
@@ -132,7 +132,7 @@ describe Innate::Helper::Render do
|
|
132
132
|
end
|
133
133
|
|
134
134
|
describe '#render_view' do
|
135
|
-
behaves_like :
|
135
|
+
behaves_like :rack_test
|
136
136
|
|
137
137
|
it 'renders action without calling the method or applying layout' do
|
138
138
|
get('/render_view/without_method_or_layout').body.should == '{ 42 }'
|
@@ -140,7 +140,7 @@ describe Innate::Helper::Render do
|
|
140
140
|
end
|
141
141
|
|
142
142
|
describe 'misc functionality' do
|
143
|
-
behaves_like :
|
143
|
+
behaves_like :rack_test
|
144
144
|
|
145
145
|
it 'can render_partial in a loop' do
|
146
146
|
get('/misc/loop').body.scan(/\d+/).should == %w[1 2 3 4 5]
|
@@ -152,7 +152,7 @@ describe Innate::Helper::Render do
|
|
152
152
|
end
|
153
153
|
|
154
154
|
describe '#render_file' do
|
155
|
-
behaves_like :
|
155
|
+
behaves_like :rack_test
|
156
156
|
|
157
157
|
it 'renders file from absolute path' do
|
158
158
|
get('/render_file/absolute').body.should == '{ ! }'
|