Sha256: 3e81db828430130d41d20fb7514975e1a05368a2c620897baff6b1f83bee505c

Contents?: true

Size: 1002 Bytes

Versions: 2

Compression:

Stored size: 1002 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

class TestApp < Sinatra::Base
  register Sinatra::AssetHelpers
  set :manifest_path, File.expand_path('../../support/assets/manifest.json', __FILE__)

  get '/' do
    slim :index
  end

  template :layout do
    "html\n\tbody\n\t\t==yield\n"
  end

  template :index do
    "==stylesheet_tag('app.css')\n==javascript_tag('app.js')\n==image_tag('image.png')\n"
  end
end

def app
  TestApp.new
end

describe Sinatra::AssetHelpers do
  it "will return 200 status code" do
    get "/"
    last_response.status.must_equal 200
  end

  it "outputs a stylesheet tag" do
    get '/'
    last_response.body.must_match(/<link href="\/assets\/app.css" media="screen" rel="stylesheet">/)
  end
  
  it "outputs a javascript tag" do
    get '/'
    last_response.body.must_match(/<script src="\/assets\/app.js"><\/script>/)
  end
  
  it "outputs an image tag" do
    get '/'
    last_response.body.must_match(/<img src="\/assets\/image.png" alt="" title="">/)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sinatra-asset_helpers-0.0.2 spec/sinatra/asset_helpers_spec.rb
sinatra-asset_helpers-0.0.1 spec/sinatra/asset_helpers_spec.rb