Sha256: 6c0960a0b032d719ad6181cd852ecadc148e9bef9704edf80c86336dbdc6d9d4

Contents?: true

Size: 1.39 KB

Versions: 2

Compression:

Stored size: 1.39 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/helper')

class TestProjectGenerator < Test::Unit::TestCase
  def setup
    @apptmp = "#{Dir.tmpdir}/appjam-tests/#{UUID.new.generate}"
    `mkdir -p #{@apptmp}`
  end

  def teardown
    `rm -rf #{@apptmp}`
    `rm -rf /tmp/project`
  end
  
  context 'the project generator' do  
  
    should "display the right path" do
      buffer = silence_logger { generate(:project, 'project', "--root=/tmp") }
      assert_file_exists("/tmp/project")
    end
  
    should "allow simple generator to run and create base_app with no options" do
      assert_nothing_raised { silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}") } }
      assert_file_exists("#{@apptmp}/sample_project")
      assert_file_exists("#{@apptmp}/sample_project/Classes")
      assert_file_exists("#{@apptmp}/sample_project/Contacts_Prefix.pch")
      assert_file_exists("#{@apptmp}/sample_project/Contacts-Info.plist")
      assert_file_exists("#{@apptmp}/sample_project/Contacts.xcodeproj")
      assert_file_exists("#{@apptmp}/sample_project/main.m")
    end  
    
    should "raise an Error when given invalid constant names" do
      assert_raise(::NameError) { silence_logger { generate(:project, "123asdf", "--root=#{@apptmp}") } }
      assert_raise(::NameError) { silence_logger { generate(:project, "./sample_project", "--root=#{@apptmp}") } }
    end    
    
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
appjam-0.1.0.pre11 test/test_project_generator.rb
appjam-0.1.0.pre9 test/test_project_generator.rb