test/render/template_vars_test.rb in rocketio-0.1.0 vs test/render/template_vars_test.rb in rocketio-0.2.0

- old
+ new

@@ -4,32 +4,32 @@ context :compositing do it 'inherits vars from superclass' do a = mock_controller { define_template_var(:a, 'a') } - b = mock_controller(a) {}.initialize_controller + b = mock_controller(a) {}.new assert(b.template_vars[:a]) == 'a' end it 'complements vars inherited from superclass' do a = mock_controller { define_template_var(:a, 'a') } b = mock_controller(a) { define_template_var(:b, 'b') - }.initialize_controller + }.new assert(b.template_vars[:a]) == 'a' assert(b.template_vars[:b]) == 'b' end it 'overrides vars inherited from superclass' do a = mock_controller { define_template_var(:a, 'a') } b = mock_controller(a) { define_template_var(:a, 'b') - }.initialize_controller + }.new assert(b.template_vars[:a]) == 'b' end test '`inherit` overrides vars inherited from superclass' do a = mock_controller { @@ -38,11 +38,11 @@ b = mock_controller(a) { define_template_var(:a, 'b') } c = mock_controller(a) { import :template_vars, from: b - }.initialize_controller + }.new assert(c.template_vars[:a]) == 'b' end test '`inherit` complements vars inherited from superclass' do a = mock_controller { @@ -51,11 +51,11 @@ b = mock_controller(a) { define_template_var(:b, 'b') } c = mock_controller(a) { import :template_vars, from: b - }.initialize_controller + }.new assert(c.template_vars[:a]) == 'a' assert(c.template_vars[:b]) == 'b' end test '`inherit` overrides defined vars' do @@ -63,37 +63,37 @@ define_template_var(:a, 'a') } b = mock_controller { define_template_var(:a, 'b') import :template_vars, from: a - }.initialize_controller + }.new assert(b.template_vars[:a]) == 'a' end end context :rendering do it 'accepts plain value via second argument' do c = mock_controller { define_template(:get) {'<%= x %>'} define_template_var(:x, 'y') - }.initialize_controller + }.new assert(c.render(:get)) == 'y' end it 'accepts a proc as second argument' do c = mock_controller { define_template(:get) {'<%= x %>'} define_template_var(:x, -> {'y'}) - }.initialize_controller + }.new assert(c.render(:get)) == 'y' end it 'accepts a block without second argument' do c = mock_controller { define_template(:get) {'<%= x %>'} define_template_var(:x) {'y'} - }.initialize_controller + }.new assert(c.render(:get)) == 'y' end it 'raises ArgumentError if no value nor block given' do assert { mock_controller {