Sha256: 57fc1ffba8a404a529a91d90596faf517ab46bd63c2efea3ca4cc7ca6c8a1fc1

Contents?: true

Size: 1.25 KB

Versions: 6

Compression:

Stored size: 1.25 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.rb').to have_content (
      """
      require 'sinatra/base'
      require 'tilt/erubis'
      require 'json'
      require 'yaml'

      require_relative 'dummy_app/helpers'
      require_relative 'dummy_app/racks'

      module DummyApp
        class App < Sinatra::Base
          helpers do
            include DummyApp::Helpers
          end

          get '/' do
            headers 'Vary' => 'Accept'

            respond_to do |wants|
              wants.html do
                @content = '<h1>Hello from DummyApp</h1>'
                @title = 'DummyApp'
                @github_url = CONFIG['github_url']
                erb :index
              end

              wants.json do
                {
                  app: 'DummyApp'
                }.to_json
              end
            end
          end

          # start the server if ruby file executed directly
          run! if app_file == $0

          not_found do
            status 404
            @title = '404'
            erb :oops
          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/app_spec.rb
skellington-0.8.8 spec/sinatra/app/app_spec.rb
skellington-0.8.7 spec/sinatra/app/app_spec.rb
skellington-0.8.6 spec/sinatra/app/app_spec.rb
skellington-0.8.5 spec/sinatra/app/app_spec.rb
skellington-0.8.4 spec/sinatra/app/app_spec.rb