Sha256: 3c8fa4170d6bf1b4e88c86e1a5ae7915faf86c6911cbe50016184b2094af9205

Contents?: true

Size: 1004 Bytes

Versions: 6

Compression:

Stored size: 1004 Bytes

Contents

require 'test_helper'
require_relative '../../../../lib/nesta/commands'

describe 'nesta theme:create' do
  include TemporaryFiles

  def theme_path(path = '')
    File.join('themes', 'theme-name', path)
  end

  before do
    FileUtils.mkdir_p(project_root)
  end

  after do
    remove_temp_directory
  end

  def process_stub
    Object.new.tap do |stub|
      def stub.run(*args); end
    end
  end

  it 'creates default files in the theme directory' do
    Dir.chdir(project_root) do
      Nesta::Commands::Theme::Create.new('theme-name').execute(process_stub)
    end
    assert_exists_in_project theme_path('README.md')
    assert_exists_in_project theme_path('app.rb')
  end

  it 'copies default view templates into views directory' do
    Dir.chdir(project_root) do
      Nesta::Commands::Theme::Create.new('theme-name').execute(process_stub)
    end
    %w(layout.haml page.haml master.sass).each do |template|
      assert_exists_in_project theme_path("views/#{template}")
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nesta-0.18.0 test/integration/commands/theme/create_test.rb
nesta-0.17.0 test/integration/commands/theme/create_test.rb
nesta-0.16.0 test/integration/commands/theme/create_test.rb
nesta-0.15.0 test/integration/commands/theme/create_test.rb
nesta-0.14.0 test/integration/commands/theme/create_test.rb
nesta-0.13.0 test/integration/commands/theme/create_test.rb