Sha256: c83fc4e53e45e79ade58e18d524bf3247015ecce89ea401d8e5515e9a0c80ffb

Contents?: true

Size: 1.71 KB

Versions: 40

Compression:

Stored size: 1.71 KB

Contents

require 'test_helper'
require 'generators/generators_test_helper'
require "generators/angular/install/install_generator"

class InstallGeneratorTest < Rails::Generators::TestCase
  include GeneratorsTestHelper
  tests Angular::Generators::InstallGenerator

  def setup
    mkdir_p "#{destination_root}/app/assets/javascripts"
    cp fixture("application.js"), "#{destination_root}/app/assets/javascripts"
    super
  end

  test "Assert template directory structure is created" do
    run_generator
    assert_directory angular_templates_path
    assert_file "#{angular_templates_path}/.gitkeep"
  end

  test "Assert angular directory structure is created" do
    run_generator

    %W{controllers filters services widgets}.each do |dir|
      assert_directory "#{angular_path}/#{dir}"
      assert_file "#{angular_path}/#{dir}/.gitkeep"
    end
  end

  test "Assert angular spec directory structure is created" do
    run_generator
    assert_directory angular_spec_path
    assert_file "#{angular_spec_path}/.gitkeep"
  end
  

  test "Assert no gitkeep files are created when skipping git" do
    run_generator [destination_root, "--skip-git"]
    
    %W{controllers filters services widgets}.each do |dir|
      assert_no_file "#{angular_path}/#{dir}/.gitkeep"
    end
		assert_no_file "#{angular_spec_path}/.gitkeep"
		assert_no_file "#{assets_path}/templates/.gitkeep"
  end
  
  test "Assert application.js require angular.js and angular directory" do
    run_generator
    
    assert_file "app/assets/javascripts/application.js" do |application|
      assert_match /require angular(.*)require_tree \.\/angular/m, application
    end
  end  
  
  def fixture(file)
    File.expand_path("fixtures/#{file}", File.dirname(__FILE__))
  end
  
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
angular-gem-1.3.8 test/generators/install_generator_test.rb
angular-gem-1.3.7 test/generators/install_generator_test.rb
angular-gem-1.3.6 test/generators/install_generator_test.rb
angular-gem-1.3.5 test/generators/install_generator_test.rb
angular-gem-1.3.4 test/generators/install_generator_test.rb
angular-gem-1.3.2 test/generators/install_generator_test.rb
angular-gem-1.3.1 test/generators/install_generator_test.rb
angular-gem-1.3.0 test/generators/install_generator_test.rb
angular-gem-1.2.26 test/generators/install_generator_test.rb
angular-gem-1.2.25 test/generators/install_generator_test.rb
angular-gem-1.2.24 test/generators/install_generator_test.rb
angular-gem-1.2.23 test/generators/install_generator_test.rb
angular-gem-1.2.22 test/generators/install_generator_test.rb
angular-gem-1.2.21 test/generators/install_generator_test.rb
angular-gem-1.2.20 test/generators/install_generator_test.rb
angular-gem-1.2.19 test/generators/install_generator_test.rb
angular-gem-1.2.18.1 test/generators/install_generator_test.rb
angular-gem-1.2.18 test/generators/install_generator_test.rb
angular-gem-1.2.16 test/generators/install_generator_test.rb
angular-gem-1.2.15 test/generators/install_generator_test.rb