spec/templates_spec.rb in nyny-3.0.1 vs spec/templates_spec.rb in nyny-3.1.0
- old
+ new
@@ -1,10 +1,16 @@
require 'spec_helper'
describe Templates do
- let (:app) do
- mock_app do
+ let (:app_class) do
+ mock_app_class do
+ helpers do
+ def template_root
+ File.join(__dir__, "views")
+ end
+ end
+
get '/without_layout' do
render template('index.erb')
end
get '/with_layout' do
@@ -16,16 +22,22 @@
get '/instance_var' do
@foo = 'bar'
render template('instance.erb')
end
+ get '/via_helper' do
+ erb :index
+ end
+
get '/local_var' do
render template('local.erb'), :foo => 'bar'
end
end
end
+ let (:app) { Rack::MockRequest.new(app_class.new)}
+
it 'renders correctly without layout' do
response = app.get('/without_layout')
response.body.should == '<p>Hello!</p>'
end
@@ -46,7 +58,6 @@
Tilt.new(template('index.erb')).render
end
response.body.should == rendered
end
-
end