Sha256: 6105e98a671168ebbb22d3ed7d3d83a34b8bfd7489ca58c6128c83dd28d6dcba

Contents?: true

Size: 1.35 KB

Versions: 5

Compression:

Stored size: 1.35 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 'yaml'

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

      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'
                @github_url = CONFIG['github_url']
                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

5 entries across 5 versions & 1 rubygems

Version Path
skellington-0.8.1 spec/non_local_path_spec.rb
skellington-0.8.0 spec/non_local_path_spec.rb
skellington-0.7.5 spec/cli/non_local_path_spec.rb
skellington-0.7.4 spec/cli/non_local_path_spec.rb
skellington-0.7.3 spec/cli/non_local_path_spec.rb