require "spec_helper" require "generators/angular_velocity/install/install_generator" describe AngularVelocity::Generators::InstallGenerator do include GeneratorSpec::TestCase include GenSpecHelpers include AngularVelocity::Generators::AngularConfig destination File.expand_path("../../tmp", __FILE__) before(:each) do prepare_destination create_fixtures run_generator @angular_test_app_path = "spec/tmp/#{angular_path}" @test_app_path = "spec/tmp/app" @angular_spec_path = "#{angular_spec_path}" end context "angular components" do it "should generate an angular application" do pp angular_path expect("#{angular_path}/app.coffee").to be_a_file_containing_text(%{angular.module('AngularVelocityApp', [])}) expect("#{@test_app_path}/assets/javascripts/application.js").to be_a_file_containing_text(%{//= require ./AngularVelocityApp/angular.js}) file_should_exist("#{angular_path}/angular-mocks.js") file_should_exist("#{angular_path}/angular-cookies.js") file_should_exist("#{angular_path}/angular-resource.js") file_should_exist("#{angular_path}/angular-sanitize.js") end it "should package the angular app in an easy to consume sprockets file" do expect("#{angular_path}/AngularVelocityAppLoader.js").to be_a_file_containing_text("//= require ./app") end it "should create an empty service module for later services to use" do expect("#{angular_path}/services/#{application_name}_service.coffee").to be_a_file_containing_text(%{angular.module('AngularVelocityAppService', [])}) end it "should create a main_angular controller like yeoman and the seed does" do expect("#{angular_path}/controllers/main_controller.coffee").to be_a_file_containing_text(%{angular.module('AngularVelocityApp').controller( 'MainCtrl'}) expect("#{angular_path}/views/main_control.html").to be_a_file_containing_text(%{