Sha256: 015260938137678590816ddea6f429eec325faad26fa22b65a378716a6f2b014

Contents?: true

Size: 1.93 KB

Versions: 3

Compression:

Stored size: 1.93 KB

Contents

require 'spec_helper'
require 'fileutils'

describe Sunrise::Generators::InstallGenerator do
  include GeneratorSpec::TestCase
  destination File.expand_path("../../tmp", __FILE__)
#  arguments %w(something)

  before(:all) do
    prepare_destination
    
    dir = File.expand_path("../../", __FILE__)
    FileUtils.mkdir_p(File.join(dir, "tmp/config"))
    FileUtils.copy_file(File.join(dir, "dummy/config/routes.rb"), File.join(dir, "tmp/config", "routes.rb"))
    FileUtils.copy_file(File.join(dir, "dummy/config/application.rb"), File.join(dir, "tmp/config", "application.rb"))
    
    run_generator
  end
  
  it "should copy_images" do
    assert_directory "public/images/manage"
    assert_file "public/images/alert.png"
  end
  
  it "should copy_javascripts" do
    assert_directory "public/javascripts"
    assert_file "public/javascripts/manage.js"
  end
  
  it "should copy_stylesheets" do
    assert_directory "public/stylesheets/manage"
    assert_file "public/stylesheets/alert.css"
  end
  
  it "should copy_views" do
    assert_directory "app/views"
  end
  
  it "should copy_configurations" do
    ["db/seeds.rb", "config/initializers/sunrise.rb", "config/application.yml.sample", "config/database.yml.sample",
     "config/logrotate-config.sample", "config/nginx-config-passenger.sample"].each do |file|
      assert_file file
    end
  end
  
  it "should copy_helpers" do
    assert_directory "app/helpers/manage"
  end
  
  it "should copy_models" do
    assert_directory "app/models/defaults"
  end

  it "should copy_specs" do
    assert_directory "spec"
    assert_file "spec/spec_helper.rb"
    assert_file ".rspec"
  end

  it "should create migration" do
    [:users, :roles, :structures, :pages, :assets, :headers].each do |item|
      assert_migration "db/migrate/sunrise_create_#{item}.rb" do |migration|
        assert_class_method :up, migration do |up|
          assert_match /create_table/, up
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sunrise-core-0.2.2 spec/generators/install_generator_spec.rb
sunrise-core-0.2.1 spec/generators/install_generator_spec.rb
sunrise-core-0.2.0 spec/generators/install_generator_spec.rb