Sha256: 0560d803b1e75798eaa8dca2be5fa437f5d38c557ceb9c86ffd32cbe7f865166

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'

describe TinyRails::Commands::Add do
  before do
    Dir.exist?('.tmp') ? FileUtils.rm_rf('.tmp/*') : Dir.mkdir('.tmp')
    @original_wd = Dir.pwd
    FileUtils.cd '.tmp'
    %w(.gitignore application_controller.rb boot.rb Gemfile).each do |file|
      `touch #{file}`
    end
  end

  after { FileUtils.cd @original_wd }

  let(:output) do
    fixtures_path = "#{@original_wd}/spec/fixtures"
    fixtures = %W( #{fixtures_path}/sample_addon_1.rb ../spec/fixtures/sample_addon_2.rb )
    bundled_addon = 'activerecord'
    output = capture(:stdout) { described_class.start([fixtures, bundled_addon, bundled_addon].flatten) }
    output.gsub(/\e\[(\d+)m/, '')
  end

  it 'works with full path to file' do
    output.should =~ /gemfile\s+from-sample-addon-1/
  end

  it 'works with relative path to file' do
    output.should =~ /gemfile\s+from-sample-addon-2/
  end

  it 'works with bundled addons' do
    output.should =~ /gemfile\s+activerecord/
  end

  it 'applies addon scripts only once' do
    output.scan(/gemfile\s+activerecord/).should have(1).item
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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