Sha256: dd2116ad80cc7eec28efd1e15fdd1c3e518502a47ca403f33f154854ccb9b785

Contents?: true

Size: 1.75 KB

Versions: 19

Compression:

Stored size: 1.75 KB

Contents

require File.join(File.dirname(__FILE__), "test_helper")

require 'sprout/generators/ruby/ruby_generator'

class RubyGeneratorTest < Test::Unit::TestCase
  include SproutTestCase

  context "A generated ruby application" do

    setup do
      @temp = File.join(fixtures, 'generators', 'ruby')
      FileUtils.mkdir_p @temp
      @generator = Sprout::RubyGenerator.new
      @generator.path = @temp
      @generator.logger = StringIO.new
    end

    teardown do
      remove_file @temp
    end

    should "generate a new ruby application" do
      @generator.input = 'SomeProject'
      @generator.version = '4.2.pre'
      @generator.lib = 'libs'
      @generator.execute

      project_dir = File.join @temp, 'some_project'
      assert_file project_dir

      gem_file = File.join project_dir, 'Gemfile'
      assert_file gem_file

      lib_dir = File.join project_dir, 'libs'
      assert_file lib_dir

      module_file = File.join lib_dir, 'some_project.rb'
      assert_file module_file do |content|
        assert_matches /VERSION/, content
        assert_matches /4.2.pre/, content
      end

      classes_dir = File.join lib_dir, 'some_project'
      assert_file classes_dir

      main_file = File.join classes_dir, 'base.rb'
      assert_file main_file

      test_dir = File.join project_dir, 'test'
      assert_file test_dir

      unit_dir = File.join test_dir, 'unit'
      assert_file unit_dir

      fixtures_dir = File.join test_dir, 'fixtures'
      assert_file fixtures_dir

      bin_dir = File.join project_dir, 'bin'
      assert_file bin_dir

      exe_file = File.join bin_dir, 'some-project'
      assert_file exe_file do |content|
        assert_matches /some_project/, content
        assert_matches /SomeProject::Base.new/, content
      end

    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
sprout-1.0.23.pre test/unit/ruby_generator_test.rb
sprout-1.0.22.pre test/unit/ruby_generator_test.rb
sprout-1.0.20.pre test/unit/ruby_generator_test.rb
sprout-1.0.19.pre test/unit/ruby_generator_test.rb
sprout-1.0.18.pre test/unit/ruby_generator_test.rb
sprout-1.0.17.pre test/unit/ruby_generator_test.rb
sprout-1.0.16.pre test/unit/ruby_generator_test.rb
sprout-1.0.15.pre test/unit/ruby_generator_test.rb
sprout-1.0.14.pre test/unit/ruby_generator_test.rb
sprout-1.0.13.pre test/unit/ruby_generator_test.rb
sprout-1.0.11.pre test/unit/ruby_generator_test.rb
sprout-1.0.9.pre test/unit/ruby_generator_test.rb
sprout-1.0.8.pre test/unit/ruby_generator_test.rb
sprout-1.0.5.pre test/unit/ruby_generator_test.rb
sprout-1.0.4.pre test/unit/ruby_generator_test.rb
sprout-1.0.3.pre test/unit/ruby_generator_test.rb
sprout-1.0.2.pre test/unit/ruby_generator_test.rb
sprout-1.0.1.pre test/unit/ruby_generator_test.rb
sprout-1.0.0.pre test/unit/ruby_generator_test.rb