Sha256: 0d44c2c6b8c6eb9e784b21df65c55fdc921d8e3b4ced222a9b4314472befbf34

Contents?: true

Size: 1.92 KB

Versions: 3

Compression:

Stored size: 1.92 KB

Contents

unless RUNNING_RAILS
  require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
  require 'markaby/sinatra'
  require 'rack/test'
  require File.expand_path(File.dirname(__FILE__) + "/app")

  describe "sinatra integration" do
    include Rack::Test::Methods

    def app
      @app ||= Sinatra::Application
    end

    it "should render an empty" do
      get '/empty_action'
      last_response.should be_ok
    end

    it "should render an empty markaby template" do
      get '/markaby_template'
      last_response.should be_ok
      last_response.body.should == ""
    end

    it "should render a template with html in it" do
      get '/simple_html'
      last_response.should be_ok
      last_response.body.should == "<ul><li>hi</li><li>there</li></ul>"
    end

    it "should be able to pass variables" do
      get '/variables'
      last_response.should be_ok
      last_response.body.should == '<p class="name">Scott Taylor</p>'
    end

    it "should be able to pass variables through locals" do
      get '/variables_with_locals'
      last_response.should be_ok
      last_response.body.should == '<p class="name">Scott Taylor</p>'
    end

    it "should have scope to instance variables" do
      get '/scope_instance_variables'
      last_response.should be_ok
      last_response.body.should == '<p class="name">Scott Taylor</p>'
    end

    it "should be able to use named templates" do
      get "/named_template"
      last_response.should be_ok
      last_response.body.should == '<div class="title">Hello World!</div>'
    end

    it "should be able to use a layout with :layout" do
      get '/layout'
      last_response.should be_ok
      last_response.body.should == '<html><div class="title">Hello World!</div></html>'
    end

    it "should be able to access helpers in a template" do
      get '/helpers'
      last_response.should be_ok
      last_response.body.should == "<li>bacon</li>"
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
mab-0.0.2 markaby/spec/markaby/sinatra/sinatra_spec.rb
markaby-0.7.2 spec/markaby/sinatra/sinatra_spec.rb
markaby-0.7.1 spec/markaby/sinatra/sinatra_spec.rb