Sha256: 3ac0cbb26b46571faa6ccab5e8dd495a9c2345f333149814b9b3a57dc5a1437e

Contents?: true

Size: 1.04 KB

Versions: 10

Compression:

Stored size: 1.04 KB

Contents

require 'spec_helper'
require 'recursive-open-struct'

describe New::Project do
  let(:template_dir){ File.join(@tmp_dir, 'custom_bar_template') }
  let(:project_dir){ File.join(@tmp_dir, 'new_project') }
  let(:project){ New::Project.new(:custom_bar_template, :new_project) }
  let(:project_config) { YAML.load(File.open(File.join(project_dir, New::CONFIG_FILE))).deep_symbolize_keys! }

  before do
    @tmp_dir = Dir.mktmpdir
    FileUtils.cp_r root('spec', 'fixtures', 'custom', 'templates', 'custom_bar_template'), @tmp_dir
    New::Template.stub(:new).and_return(RecursiveOpenStruct.new({ options: {}, dir: template_dir }))

    # change directory before creating a project since it uses pwd
    Dir.chdir @tmp_dir
    project
  end

  after do
    New::Template.unstub(:new)
    FileUtils.rm_rf template_dir
    FileUtils.rm_rf project_dir
  end

  it 'should copy the template' do
    expect(Dir.exists?(project_dir)).to eq true
  end

  it 'should create a config file' do
    expect(File.exists?(File.join(project_dir, New::CONFIG_FILE))).to eq true
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
new-0.0.14 spec/lib/new/project_spec.rb
new-0.0.13 spec/lib/new/project_spec.rb
new-0.0.12 spec/lib/new/project_spec.rb
new-0.0.11 spec/lib/new/project_spec.rb
new-0.0.10 spec/lib/new/project_spec.rb
new-0.0.9 spec/lib/new/project_spec.rb
new-0.0.8 spec/lib/new/project_spec.rb
new-0.0.7 spec/lib/new/project_spec.rb
new-0.0.6 spec/lib/new/project_spec.rb
new-0.0.5 spec/lib/new/project_spec.rb