Sha256: 973c75d3edb7411f3fad1678fa0c88189deefa9159e241fb71ebe4379b9c1ea6

Contents?: true

Size: 860 Bytes

Versions: 2

Compression:

Stored size: 860 Bytes

Contents

require 'spec_helper'

describe TinyRails::Commands::Console do
  before do
    Dir.exist?('.tmp') ? FileUtils.rm_rf('.tmp/*') : Dir.mkdir('.tmp')
    @original_wd = Dir.pwd
    FileUtils.cd '.tmp'
    `touch boot.rb`

    class ::TinyRailsApp; end
    class ::Rails
      class Console
      end
    end

    Rails::Console.stub(:start)

    command = described_class.new
    @required_files = []
    command.stub(:require) do |file|
      @required_files << file
    end

    capture(:stdout) { command.invoke_all }
  end

  after { FileUtils.cd @original_wd }

  it 'requires boot.rb file' do
    @required_files.should include('./boot.rb')
  end

  it 'requires rails command' do
    @required_files.should include('rails/commands/console')
  end

  it 'starts rails console' do
    Rails::Console.should have_received(:start).with(TinyRailsApp)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tiny-rails-0.1.1 spec/commands/console_spec.rb
tiny-rails-0.1.0 spec/commands/console_spec.rb