Sha256: 3d3407bb8b75c848f074691f183947c7182fccec4e04a97397f46f82db3b8668

Contents?: true

Size: 1.22 KB

Versions: 3

Compression:

Stored size: 1.22 KB

Contents

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

    it 'generates an app at a non-local path' do
      subject.generate 'subdir/some_app'
      expect('subdir/some_app/lib/some_app.rb').to have_content (
      """
      require 'sinatra/base'
      require 'tilt/erubis'

      require_relative 'some_app/racks'
      require_relative 'some_app/helpers'

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

          get '/' do
            respond_to do |wants|
              wants.html do
                @content = '<h1>Hello from SomeApp</h1>'
                @title = 'SomeApp'
                erb :index, layout: :default
              end

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

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

      expect('subdir/some_app/config.ru').to have_content (
      """
      require File.join(File.dirname(__FILE__), 'lib/some_app.rb')

      run SomeApp::App
      """
      )
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
skellington-0.4.4 spec/cli/non_local_path_spec.rb
skellington-0.4.3 spec/cli/non_local_path_spec.rb
skellington-0.4.2 spec/cli/non_local_path_spec.rb