Sha256: 02707494ba3e96b5ebabf47c3da9df8b2550e6badd458c14b1cd382a8e0e0e51

Contents?: true

Size: 1.04 KB

Versions: 6

Compression:

Stored size: 1.04 KB

Contents

module Skellington
  describe CLI do
    let :subject do
      described_class.new
    end

    it 'generates an app file' do
      subject.generate 'dummy-app'
      expect('dummy_app/lib/dummy_app/racks.rb').to have_content (
      """
      require 'rack/conneg'
      require 'rack/tracker'

      module DummyApp
        class App < Sinatra::Base
          set :public_folder, 'public'
          set :views, 'views'

          if CONFIG['google-analytics-tag']
            use Rack::Tracker do
              handler :google_analytics, { tracker: CONFIG['google-analytics-tag'] }
            end
          end

          use Rack::Conneg do |conneg|
            conneg.set :accept_all_extensions, true
            conneg.set :fallback, :html
            conneg.ignore_contents_of 'public'
            conneg.provide [
              :html,
              :json
            ]
          end

          before do
            if negotiated?
              content_type negotiated_type
            end
          end
        end
      end
      """
      )
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
skellington-0.8.9 spec/sinatra/app/racks_spec.rb
skellington-0.8.8 spec/sinatra/app/racks_spec.rb
skellington-0.8.7 spec/sinatra/app/racks_spec.rb
skellington-0.8.6 spec/sinatra/app/racks_spec.rb
skellington-0.8.5 spec/sinatra/app/racks_spec.rb
skellington-0.8.4 spec/sinatra/app/racks_spec.rb