Sha256: d24d9787ffad7325b3c2ceb12e33f16bcc64dcc046f5db6c39578c502ae46dc5

Contents?: true

Size: 1.36 KB

Versions: 5

Compression:

Stored size: 1.36 KB

Contents

#          Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the MIT license.

require File.expand_path('../../../../spec/helper', __FILE__)
spec_require 'remarkably'

Ramaze::App.options.views = 'remarkably'

class SpecRemarkably < Ramaze::Controller
  map '/'
  engine :Remarkably
  helper :remarkably

  def index
    h1 "Remarkably Index"
  end

  def links
    ul do
      li { a "Index page", :href => r(:index) }
      li { a "Internal template", :href => r(:internal) }
      li { a "External template", :href => r(:external) }
    end
  end

  def sum(num1, num2)
    @num1, @num2 = num1.to_i, num2.to_i
  end
end

describe Ramaze::View::Remarkably do
  behaves_like :rack_test

  should 'use remarkably methods' do
    get('/').body.should == '<h1>Remarkably Index</h1>'
  end

  should 'use other helper methods' do
    get('/links').body.should == '<ul><li><a href="/index">Index page</a></li><li><a href="/internal">Internal template</a></li><li><a href="/external">External template</a></li></ul>'
  end

  should 'render external template' do
    get('/external').body.should == "<html><head><title>Remarkably Test</title></head><body><h1>Remarkably Template</h1></body></html>"
  end

  should 'render external template with instance variables' do
    get('/sum/1/2').body.should == '<div>3</div>'
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ramaze-2023.01.06 spec/ramaze/view/remarkably.rb
ramaze-2012.12.08 spec/ramaze/view/remarkably.rb
ramaze-2012.12.08b spec/ramaze/view/remarkably.rb
ramaze-2012.04.14 spec/ramaze/view/remarkably.rb
ramaze-2012.03.07 spec/ramaze/view/remarkably.rb