Sha256: b521901ea85f7e26dbebf564906b8e78523cf85eec25390074b0803f68d41b6e

Contents?: true

Size: 913 Bytes

Versions: 9

Compression:

Stored size: 913 Bytes

Contents

require 'spec_helper'
require 'fileutils'

describe Rgentpl::Command::Generate do
  let(:app) { 'test_app' }

  before do
    Rgentpl::Command::Base.start %W[generate #{app}]
  end

  let(:path) do
    Rgentpl::Command::Generate.class_options[:app_path].default.chomp('/')
  end
  let(:file) { "#{path}/#{app}" }

  after do
    FileUtils.rm_rf(file) if File.exists?(file)
  end

  describe '#source_root' do
    it 'sets application source path root' do
      expect(Rgentpl::Command::Generate.source_root)
        .to eq File.absolute_path(File.join(File.dirname(__FILE__), '../../../../'))
    end
  end

  describe '.create_app' do
    it 'adds a new directory with defined structure' do
      expect(File.exists?(file)).to be
    end
  end

  describe '.add_perms' do
    it 'add executions perms to binary file' do
      expect(File.stat(File.join(file, "/bin/#{app}")).mode).to eq 33_261
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rgentpl-1.0.9 spec/lib/rgentpl/command/generate_spec.rb
rgentpl-1.0.8 spec/lib/rgentpl/command/generate_spec.rb
rgentpl-1.0.7 spec/lib/rgentpl/command/generate_spec.rb
rgentpl-1.0.6 spec/lib/rgentpl/command/generate_spec.rb
rgentpl-1.0.5 spec/lib/rgentpl/command/generate_spec.rb
rgentpl-1.0.4 spec/lib/rgentpl/command/generate_spec.rb
rgentpl-1.0.3 spec/lib/rgentpl/command/generate_spec.rb
rgentpl-1.0.2 spec/lib/rgentpl/command/generate_spec.rb
rgentpl-1.0.1 spec/lib/rgentpl/command/generate_spec.rb