Sha256: 6562f3ce6d965064bf2dcf496e2e221741d756e3c82f4ddb6e4da320802bee61

Contents?: true

Size: 1.28 KB

Versions: 13

Compression:

Stored size: 1.28 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 'json'

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

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

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

            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

13 entries across 13 versions & 1 rubygems

Version Path
skellington-0.7.0 spec/cli/non_local_path_spec.rb
skellington-0.6.2 spec/cli/non_local_path_spec.rb
skellington-0.6.1 spec/cli/non_local_path_spec.rb
skellington-0.5.2 spec/cli/non_local_path_spec.rb
skellington-0.5.1 spec/cli/non_local_path_spec.rb
skellington-0.5.0 spec/cli/non_local_path_spec.rb
skellington-0.4.16 spec/cli/non_local_path_spec.rb
skellington-0.4.15 spec/cli/non_local_path_spec.rb
skellington-0.4.13 spec/cli/non_local_path_spec.rb
skellington-0.4.11 spec/cli/non_local_path_spec.rb
skellington-0.4.10 spec/cli/non_local_path_spec.rb
skellington-0.4.9 spec/cli/non_local_path_spec.rb
skellington-0.4.8 spec/cli/non_local_path_spec.rb