hobbit-contrib 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +234 -6
- data/hobbit-contrib.gemspec +6 -2
- data/lib/hobbit/asset_tag.rb +23 -0
- data/lib/hobbit/contrib/version.rb +1 -1
- data/lib/hobbit/contrib.rb +6 -0
- data/lib/hobbit/enhanced_render.rb +1 -1
- data/lib/hobbit/environment.rb +15 -0
- data/lib/hobbit/error_handling.rb +25 -0
- data/lib/hobbit/filter.rb +54 -0
- data/lib/hobbit/render.rb +17 -0
- data/lib/hobbit/session.rb +7 -0
- data/spec/asset_tag_spec.rb +84 -0
- data/spec/enhanced_render_spec.rb +28 -3
- data/spec/environment_spec.rb +65 -0
- data/spec/error_handling_and_filter_spec.rb +140 -0
- data/spec/error_handling_spec.rb +94 -0
- data/spec/filter_spec.rb +101 -0
- data/spec/fixtures/{test_enhanced_render_app → enhanced_render}/views/_partial.erb +0 -0
- data/spec/fixtures/{test_enhanced_render_app → enhanced_render}/views/index.erb +0 -0
- data/spec/fixtures/{test_enhanced_render_app → enhanced_render}/views/layouts/layout.erb +0 -0
- data/spec/fixtures/render/views/hello.erb +5 -0
- data/spec/fixtures/render/views/index.erb +5 -0
- data/spec/minitest_helper.rb +13 -2
- data/spec/render_spec.rb +33 -0
- data/spec/session_spec.rb +33 -0
- metadata +95 -19
- data/spec/fixtures/test_enhanced_render_app/test_enhanced_render_app.rb +0 -25
- data/spec/fixtures/test_enhanced_render_app.rb +0 -25
@@ -0,0 +1,140 @@
|
|
1
|
+
require 'minitest_helper'
|
2
|
+
|
3
|
+
describe 'combine Hobbit::ErrorHandling and Hobbit::Filter' do
|
4
|
+
include Hobbit::Contrib::Mock
|
5
|
+
include Rack::Test::Methods
|
6
|
+
|
7
|
+
describe 'when the exception ocurrs in a route' do
|
8
|
+
let(:app) do
|
9
|
+
mock_app do
|
10
|
+
include Hobbit::Filter
|
11
|
+
include Hobbit::ErrorHandling
|
12
|
+
|
13
|
+
error Exception do |exc|
|
14
|
+
exc.message
|
15
|
+
end
|
16
|
+
|
17
|
+
before do
|
18
|
+
env['hobbit.before'] = 'this is before'
|
19
|
+
end
|
20
|
+
|
21
|
+
after do
|
22
|
+
env['hobbit.after'] = 'this is after'
|
23
|
+
end
|
24
|
+
|
25
|
+
get '/' do
|
26
|
+
raise Exception, 'Sorry'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'must call the before filter' do
|
32
|
+
get '/'
|
33
|
+
last_response.must_be :ok?
|
34
|
+
last_response.body.must_equal 'Sorry'
|
35
|
+
last_request.env.must_include 'hobbit.before'
|
36
|
+
last_request.env.wont_include 'hobbit.after'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe 'when the exception ocurrs in a before filter' do
|
41
|
+
let(:app) do
|
42
|
+
mock_app do
|
43
|
+
include Hobbit::Filter
|
44
|
+
include Hobbit::ErrorHandling
|
45
|
+
|
46
|
+
error Exception do |exc|
|
47
|
+
exc.message
|
48
|
+
end
|
49
|
+
|
50
|
+
before do
|
51
|
+
raise Exception, 'Sorry'
|
52
|
+
end
|
53
|
+
|
54
|
+
after do
|
55
|
+
env['hobbit.after'] = 'this is after'
|
56
|
+
end
|
57
|
+
|
58
|
+
get '/' do
|
59
|
+
'this wont be the body'
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'must call the before filter' do
|
65
|
+
get '/'
|
66
|
+
last_response.must_be :ok?
|
67
|
+
last_response.body.must_equal 'Sorry'
|
68
|
+
last_request.env.wont_include 'hobbit.after'
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe 'when the exception ocurrs in an after filter' do
|
73
|
+
let(:app) do
|
74
|
+
mock_app do
|
75
|
+
include Hobbit::Filter
|
76
|
+
include Hobbit::ErrorHandling
|
77
|
+
|
78
|
+
error Exception do |exc|
|
79
|
+
exc.message
|
80
|
+
end
|
81
|
+
|
82
|
+
before do
|
83
|
+
env['hobbit.before'] = 'this is before'
|
84
|
+
end
|
85
|
+
|
86
|
+
after do
|
87
|
+
raise Exception, 'Sorry'
|
88
|
+
end
|
89
|
+
|
90
|
+
get '/' do
|
91
|
+
'this wont be the body'
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'must call the before filter' do
|
97
|
+
get '/'
|
98
|
+
last_response.must_be :ok?
|
99
|
+
last_response.body.must_equal 'Sorry'
|
100
|
+
last_request.env.must_include 'hobbit.before'
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
describe 'the order of the modules inclusion matters' do
|
105
|
+
describe 'when ErrorHandling is included before Filter' do
|
106
|
+
let(:app) do
|
107
|
+
mock_app do
|
108
|
+
include Hobbit::ErrorHandling
|
109
|
+
include Hobbit::Filter
|
110
|
+
|
111
|
+
error Exception do |exc|
|
112
|
+
exc.message
|
113
|
+
end
|
114
|
+
|
115
|
+
before do
|
116
|
+
env['hobbit.before'] = 'this is before'
|
117
|
+
end
|
118
|
+
|
119
|
+
after do
|
120
|
+
env['hobbit.after'] = 'this is after'
|
121
|
+
end
|
122
|
+
|
123
|
+
get '/' do
|
124
|
+
raise Exception, 'Sorry'
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
it 'wont work as expected' do
|
130
|
+
get '/'
|
131
|
+
last_response.must_be :ok?
|
132
|
+
last_response.body.must_equal 'Sorry'
|
133
|
+
last_request.env.must_include 'hobbit.before'
|
134
|
+
# this is contrary to a previous test, which is not the desired workflow
|
135
|
+
# or is it?
|
136
|
+
last_request.env.must_include 'hobbit.after'
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
require 'minitest_helper'
|
2
|
+
|
3
|
+
describe Hobbit::ErrorHandling do
|
4
|
+
include Hobbit::Contrib::Mock
|
5
|
+
include Rack::Test::Methods
|
6
|
+
|
7
|
+
class NotFoundException < StandardError ; end
|
8
|
+
|
9
|
+
let(:app) do
|
10
|
+
mock_app do
|
11
|
+
include Hobbit::ErrorHandling
|
12
|
+
|
13
|
+
error Exception do |exception|
|
14
|
+
exception.message
|
15
|
+
end
|
16
|
+
|
17
|
+
error NotFoundException do
|
18
|
+
'Not Found'
|
19
|
+
end
|
20
|
+
|
21
|
+
get '/' do
|
22
|
+
'hello'
|
23
|
+
end
|
24
|
+
|
25
|
+
get '/raises' do
|
26
|
+
'not this'
|
27
|
+
raise Exception, 'Exception'
|
28
|
+
end
|
29
|
+
|
30
|
+
get '/other_raises' do
|
31
|
+
response.write 'not this'
|
32
|
+
raise NotFoundException
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '::error' do
|
38
|
+
specify do
|
39
|
+
p = Proc.new { 'error' }
|
40
|
+
app = mock_app do
|
41
|
+
include Hobbit::ErrorHandling
|
42
|
+
error Exception, &p
|
43
|
+
end
|
44
|
+
|
45
|
+
app.to_app.class.errors.must_include Exception
|
46
|
+
app.to_app.class.errors[Exception].call.must_equal p.call
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe '::errors' do
|
51
|
+
it 'must return a Hash' do
|
52
|
+
app.to_app.class.errors.must_be_kind_of Hash
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe 'when does not raises an exception' do
|
57
|
+
it 'must work as expected' do
|
58
|
+
get '/'
|
59
|
+
last_response.must_be :ok?
|
60
|
+
last_response.body.must_equal 'hello'
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe 'when raises an exception' do
|
65
|
+
it 'must call the block set in error' do
|
66
|
+
get '/raises'
|
67
|
+
last_response.must_be :ok?
|
68
|
+
last_response.body.must_equal 'Exception'
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'must allow to define more than one exception' do
|
72
|
+
get '/other_raises'
|
73
|
+
last_response.must_be :ok?
|
74
|
+
last_response.body.must_equal 'Not Found'
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'must set the returned value of the error block as the body' do
|
78
|
+
get '/other_raises'
|
79
|
+
last_response.must_be :ok?
|
80
|
+
last_response.body.must_equal 'Not Found'
|
81
|
+
last_response.body.wont_equal 'not this'
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'must override a previous block if a new one is passed' do
|
85
|
+
app.to_app.class.error Exception do
|
86
|
+
'other handler!'
|
87
|
+
end
|
88
|
+
|
89
|
+
get '/raises'
|
90
|
+
last_response.must_be :ok?
|
91
|
+
last_response.body.must_equal 'other handler!'
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
data/spec/filter_spec.rb
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
require 'minitest_helper'
|
2
|
+
|
3
|
+
describe Hobbit::Filter do
|
4
|
+
include Hobbit::Contrib::Mock
|
5
|
+
include Rack::Test::Methods
|
6
|
+
|
7
|
+
let(:app) do
|
8
|
+
mock_app do
|
9
|
+
include Hobbit::Filter
|
10
|
+
|
11
|
+
before do
|
12
|
+
env['hobbit.before'] = 'this is before'
|
13
|
+
end
|
14
|
+
|
15
|
+
get '/' do
|
16
|
+
'GET /'
|
17
|
+
end
|
18
|
+
|
19
|
+
after do
|
20
|
+
env['hobbit.after'] = 'this is after'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
%w(after before).each do |kind|
|
26
|
+
str = <<EOS
|
27
|
+
describe '::#{kind}' do
|
28
|
+
specify do
|
29
|
+
p = Proc.new { 'do something' }
|
30
|
+
app = mock_app do
|
31
|
+
include Hobbit::Filter
|
32
|
+
#{kind}('', &p)
|
33
|
+
end
|
34
|
+
|
35
|
+
app.to_app.class.filters[:#{kind}].size.must_equal 1
|
36
|
+
app.to_app.class.filters[:#{kind}].first[:block].call.must_equal p.call
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe 'when a filter matches' do
|
41
|
+
it "must call the filters' block" do
|
42
|
+
get '/'
|
43
|
+
last_response.must_be :ok?
|
44
|
+
last_request.env.must_include 'hobbit.#{kind}'
|
45
|
+
last_request.env['hobbit.#{kind}'].must_equal 'this is #{kind}'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
EOS
|
49
|
+
class_eval str
|
50
|
+
end
|
51
|
+
|
52
|
+
describe '::filters' do
|
53
|
+
it 'must return a Hash' do
|
54
|
+
app.to_app.class.filters.must_be_kind_of Hash
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'must call before and after filters' do
|
59
|
+
get '/'
|
60
|
+
last_response.must_be :ok?
|
61
|
+
last_request.env.must_include 'hobbit.before'
|
62
|
+
last_request.env['hobbit.before'].must_equal 'this is before'
|
63
|
+
last_request.env.must_include 'hobbit.after'
|
64
|
+
last_request.env['hobbit.after'].must_equal 'this is after'
|
65
|
+
end
|
66
|
+
|
67
|
+
describe 'when multiple filters are declared' do
|
68
|
+
let(:app) do
|
69
|
+
mock_app do
|
70
|
+
include Hobbit::Filter
|
71
|
+
|
72
|
+
before do
|
73
|
+
env['hobbit.before'] = 'this will match'
|
74
|
+
end
|
75
|
+
|
76
|
+
before '/' do
|
77
|
+
env['hobbit.before'] = 'this wont match'
|
78
|
+
end
|
79
|
+
|
80
|
+
after do
|
81
|
+
env['hobbit.after'] = 'this will match'
|
82
|
+
end
|
83
|
+
|
84
|
+
after '/' do
|
85
|
+
env['hobbit.after'] = 'this wont match'
|
86
|
+
end
|
87
|
+
|
88
|
+
get('/') { 'GET /' }
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'must call the first that matches' do
|
93
|
+
get '/'
|
94
|
+
last_response.must_be :ok?
|
95
|
+
last_request.env.must_include 'hobbit.before'
|
96
|
+
last_request.env['hobbit.before'].must_equal 'this will match'
|
97
|
+
last_request.env.must_include 'hobbit.after'
|
98
|
+
last_request.env['hobbit.after'].must_equal 'this will match'
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
data/spec/minitest_helper.rb
CHANGED
@@ -3,6 +3,9 @@ ENV['RACK_ENV'] ||= 'test'
|
|
3
3
|
require 'bundler'
|
4
4
|
Bundler.require :default, ENV['RACK_ENV'].to_sym
|
5
5
|
|
6
|
+
require 'coveralls'
|
7
|
+
Coveralls.wear!
|
8
|
+
|
6
9
|
require 'minitest/autorun'
|
7
10
|
require 'rack'
|
8
11
|
require 'rack/test'
|
@@ -10,5 +13,13 @@ require 'rack/test'
|
|
10
13
|
require 'hobbit'
|
11
14
|
require 'hobbit/contrib'
|
12
15
|
|
13
|
-
|
14
|
-
|
16
|
+
module Hobbit
|
17
|
+
module Contrib
|
18
|
+
module Mock
|
19
|
+
def mock_app(&block)
|
20
|
+
app = Class.new Hobbit::Base, &block
|
21
|
+
app.new
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/spec/render_spec.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'minitest_helper'
|
2
|
+
|
3
|
+
describe Hobbit::Render do
|
4
|
+
include Hobbit::Contrib::Mock
|
5
|
+
include Rack::Test::Methods
|
6
|
+
|
7
|
+
def app
|
8
|
+
mock_app do
|
9
|
+
include Hobbit::Render
|
10
|
+
|
11
|
+
def name
|
12
|
+
'Hobbit'
|
13
|
+
end
|
14
|
+
|
15
|
+
get('/') { render File.expand_path('../fixtures/render/views/index.erb', __FILE__) }
|
16
|
+
get('/using-context') { render File.expand_path('../fixtures/render/views/hello.erb', __FILE__) }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#render' do
|
21
|
+
it 'must render a template' do
|
22
|
+
get '/'
|
23
|
+
last_response.must_be :ok?
|
24
|
+
last_response.body.must_match /Hello World!/
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'must use the app as context' do
|
28
|
+
get '/using-context'
|
29
|
+
last_response.must_be :ok?
|
30
|
+
last_response.body.must_match /Hello Hobbit!/
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'minitest_helper'
|
2
|
+
|
3
|
+
describe Hobbit::Session do
|
4
|
+
include Hobbit::Contrib::Mock
|
5
|
+
include Rack::Test::Methods
|
6
|
+
|
7
|
+
def app
|
8
|
+
mock_app do
|
9
|
+
include Hobbit::Session
|
10
|
+
use Rack::Session::Cookie, secret: SecureRandom.hex(64)
|
11
|
+
|
12
|
+
get '/' do
|
13
|
+
session[:name] = 'hobbit'
|
14
|
+
end
|
15
|
+
|
16
|
+
get '/name' do
|
17
|
+
session[:name]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '#session' do
|
23
|
+
it 'must return a session object' do
|
24
|
+
get '/'
|
25
|
+
last_response.must_be :ok?
|
26
|
+
last_response.body.must_equal 'hobbit'
|
27
|
+
|
28
|
+
get '/name'
|
29
|
+
last_response.must_be :ok?
|
30
|
+
last_response.body.must_equal 'hobbit'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
metadata
CHANGED
@@ -1,23 +1,37 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hobbit-contrib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patricio Mac Adden
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: coveralls
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
31
|
- - '>='
|
18
32
|
- !ruby/object:Gem::Version
|
19
33
|
version: '0'
|
20
|
-
type: :
|
34
|
+
type: :development
|
21
35
|
prerelease: false
|
22
36
|
version_requirements: !ruby/object:Gem::Requirement
|
23
37
|
requirements:
|
@@ -25,19 +39,19 @@ dependencies:
|
|
25
39
|
- !ruby/object:Gem::Version
|
26
40
|
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
42
|
+
name: hobbit
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- -
|
45
|
+
- - '>='
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
47
|
+
version: '0'
|
34
48
|
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- -
|
52
|
+
- - '>='
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: minitest
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +94,48 @@ dependencies:
|
|
80
94
|
- - '>='
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: tilt
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: hobbit
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: tilt
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
83
139
|
description: Contributed Hobbit extensions
|
84
140
|
email:
|
85
141
|
- patriciomacadden@gmail.com
|
@@ -94,16 +150,29 @@ files:
|
|
94
150
|
- README.md
|
95
151
|
- Rakefile
|
96
152
|
- hobbit-contrib.gemspec
|
153
|
+
- lib/hobbit/asset_tag.rb
|
97
154
|
- lib/hobbit/contrib.rb
|
98
155
|
- lib/hobbit/contrib/version.rb
|
99
156
|
- lib/hobbit/enhanced_render.rb
|
157
|
+
- lib/hobbit/environment.rb
|
158
|
+
- lib/hobbit/error_handling.rb
|
159
|
+
- lib/hobbit/filter.rb
|
160
|
+
- lib/hobbit/render.rb
|
161
|
+
- lib/hobbit/session.rb
|
162
|
+
- spec/asset_tag_spec.rb
|
100
163
|
- spec/enhanced_render_spec.rb
|
101
|
-
- spec/
|
102
|
-
- spec/
|
103
|
-
- spec/
|
104
|
-
- spec/
|
105
|
-
- spec/fixtures/
|
164
|
+
- spec/environment_spec.rb
|
165
|
+
- spec/error_handling_and_filter_spec.rb
|
166
|
+
- spec/error_handling_spec.rb
|
167
|
+
- spec/filter_spec.rb
|
168
|
+
- spec/fixtures/enhanced_render/views/_partial.erb
|
169
|
+
- spec/fixtures/enhanced_render/views/index.erb
|
170
|
+
- spec/fixtures/enhanced_render/views/layouts/layout.erb
|
171
|
+
- spec/fixtures/render/views/hello.erb
|
172
|
+
- spec/fixtures/render/views/index.erb
|
106
173
|
- spec/minitest_helper.rb
|
174
|
+
- spec/render_spec.rb
|
175
|
+
- spec/session_spec.rb
|
107
176
|
homepage: ''
|
108
177
|
licenses:
|
109
178
|
- MIT
|
@@ -129,10 +198,17 @@ signing_key:
|
|
129
198
|
specification_version: 4
|
130
199
|
summary: Contributed Hobbit extensions
|
131
200
|
test_files:
|
201
|
+
- spec/asset_tag_spec.rb
|
132
202
|
- spec/enhanced_render_spec.rb
|
133
|
-
- spec/
|
134
|
-
- spec/
|
135
|
-
- spec/
|
136
|
-
- spec/
|
137
|
-
- spec/fixtures/
|
203
|
+
- spec/environment_spec.rb
|
204
|
+
- spec/error_handling_and_filter_spec.rb
|
205
|
+
- spec/error_handling_spec.rb
|
206
|
+
- spec/filter_spec.rb
|
207
|
+
- spec/fixtures/enhanced_render/views/_partial.erb
|
208
|
+
- spec/fixtures/enhanced_render/views/index.erb
|
209
|
+
- spec/fixtures/enhanced_render/views/layouts/layout.erb
|
210
|
+
- spec/fixtures/render/views/hello.erb
|
211
|
+
- spec/fixtures/render/views/index.erb
|
138
212
|
- spec/minitest_helper.rb
|
213
|
+
- spec/render_spec.rb
|
214
|
+
- spec/session_spec.rb
|
@@ -1,25 +0,0 @@
|
|
1
|
-
class TestEnhancedRenderApp < Hobbit::Base
|
2
|
-
include Hobbit::EnhancedRender
|
3
|
-
|
4
|
-
# we do this because it the layout path is relative to file being run
|
5
|
-
def layout_path(template)
|
6
|
-
File.expand_path("../#{super}", __FILE__)
|
7
|
-
end
|
8
|
-
|
9
|
-
# we do this because it the view path is relative to file being run
|
10
|
-
def view_path(template)
|
11
|
-
File.expand_path("../#{super}", __FILE__)
|
12
|
-
end
|
13
|
-
|
14
|
-
get '/' do
|
15
|
-
render 'index', {}, layout: 'layout'
|
16
|
-
end
|
17
|
-
|
18
|
-
get '/without-layout' do
|
19
|
-
render 'index'
|
20
|
-
end
|
21
|
-
|
22
|
-
get '/partial' do
|
23
|
-
partial 'partial'
|
24
|
-
end
|
25
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
class TestEnhancedRenderApp < Hobbit::Base
|
2
|
-
include Hobbit::EnhancedRender
|
3
|
-
|
4
|
-
# we do this because it the layout path is relative to file being run
|
5
|
-
def layout_path(template)
|
6
|
-
File.expand_path("../#{super}", __FILE__)
|
7
|
-
end
|
8
|
-
|
9
|
-
# we do this because it the view path is relative to file being run
|
10
|
-
def view_path(template)
|
11
|
-
File.expand_path("../#{super}", __FILE__)
|
12
|
-
end
|
13
|
-
|
14
|
-
get '/' do
|
15
|
-
render 'index', {}, layout: 'layout'
|
16
|
-
end
|
17
|
-
|
18
|
-
get '/without-layout' do
|
19
|
-
render 'index'
|
20
|
-
end
|
21
|
-
|
22
|
-
get '/partial' do
|
23
|
-
partial 'partial'
|
24
|
-
end
|
25
|
-
end
|