Sha256: a0c4ca3953d141ed54bf63316e5a6068595bd165533a2cc7acca1235252a2db9

Contents?: true

Size: 1.18 KB

Versions: 3

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'
require 'sinatra'
require 'rack/test'
require 'sibilant/sinatra'

class SibilantApp < Sinatra::Base
  helpers Sinatra::Sibilant
  set :views, ->{ root }
  get('/fixture.js') { sibilant :fixture }
  get('/inline.js') { sibilant '(alert "hello world")' }
end

describe SibilantApp do
  include Rack::Test::Methods
  def app() SibilantApp end

  describe 'rendering inline sibilant' do
    before(:each) { get '/inline.js' }

    it 'should succeed' do
      last_response.should be_ok
    end

    it 'should render the right content type' do
      last_response.content_type.should match('application/javascript')
    end

    it 'should properly translate the provided sibilant' do
      last_response.body.should == 'alert("hello world");'
    end
  end

  describe 'rendering fixture sibilant' do
    before(:each) { get '/fixture.js' }

    it 'should succeed' do
      last_response.should be_ok
    end

    it 'should render the right content type' do
      last_response.content_type.should match('application/javascript')
    end

    it 'should properly translate the fixture sibilant' do
      last_response.body.should == 'thisIsSibilantCode((1 + 2 + 3));'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sibilant-0.0.3 spec/sinatra_helper_spec.rb
sibilant-0.0.2 spec/sinatra_helper_spec.rb
sibilant-0.0.1 spec/sinatra_helper_spec.rb