Sha256: 4b5928328250ebe0ff4590ada08cc7716bb58d376f589c05b48d9ec0863cdd1d

Contents?: true

Size: 1.65 KB

Versions: 3

Compression:

Stored size: 1.65 KB

Contents

require "spec_helper"

describe ArchitectureJS::Command do  
  
  context 'API' do
    before :each do
      suppress_output do
        @project = ArchitectureJS::Project.new({ name: 'myapp' }, TMP_DIR)
        @project.create
      end
    end

    after :each do
      FileUtils.rm_rf TMP_DIR
    end

    it 'should have a watch command' do
      ArchitectureJS::Command.should respond_to :watch
    end

    it 'should have a compile command' do
      ArchitectureJS::Command.should respond_to :compile
    end

    it 'should have a generate command' do
      ArchitectureJS::Command.should respond_to :generate
    end

    it 'should have a create command' do
      ArchitectureJS::Command.should respond_to :create
    end
  end
  
  context 'Usage' do
    before :each do
      suppress_output { ArchitectureJS::Command.create({ name: 'myapp', root: TMP_DIR }) }
    end

    after :each do
      FileUtils.rm_rf TMP_DIR
    end

    it 'should create a new application' do
      "#{TMP_DIR}/myapp.architecture".should be_same_file_as "#{FIXTURES}/myapp.architecture"
      File.directory?("#{TMP_DIR}/lib").should be_true
      File.directory?("#{TMP_DIR}/src").should be_true
    end

    it 'should compile the application' do
      FileUtils.cp "#{FIXTURES}/lib1.js", "#{TMP_DIR}/src/lib1.js"
      FileUtils.cp "#{FIXTURES}/lib2.js", "#{TMP_DIR}/src/lib2.js"
      FileUtils.cp "#{FIXTURES}/src_file.js", "#{TMP_DIR}/src/myapp.js"

      suppress_output { ArchitectureJS::Command.compile({ path: TMP_DIR }) }

      File.exists?("#{TMP_DIR}/lib/myapp.js").should be_true
      "#{TMP_DIR}/lib/myapp.js".should be_same_file_as "#{FIXTURES}/compressed.js"
    end

  end # Usage
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
architecture-js-0.1.11 spec/command_spec.rb
architecture-js-0.1.10 spec/command_spec.rb
architecture-js-0.1.9 spec/command_spec.rb