Sha256: 4920eff53bef2457559ea0c10e780ab4030dd00630327eb0fba789271092dd4b

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 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'] || 'https://github.com'
                erb :index, layout: :default
              end

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
skellington-0.7.2 spec/cli/app_spec.rb