Sha256: 63b5d06e9853563b3e586912bd40123445375258eda5bf5c4b57711cf632b495

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

require 'test_helper'

module Vedeu

  module Generator

    describe Application do

      let(:described) { Vedeu::Generator::Application }
      let(:instance)  { described.new(_name) }
      let(:_name)     { 'my_first_app' }

      before do
        FileUtils.stubs(:cp_r)
        FileUtils.stubs(:mkdir)
      end

      describe '#initialize' do
        it { instance.must_be_instance_of(described) }
        it { instance.instance_variable_get('@name').must_equal(_name) }
      end

      describe '.generate' do
        subject { described.generate(_name) }
      end

      describe '#generate' do
        it { instance.must_respond_to(:generate) }
      end

      describe '#name_as_class' do
        subject { instance.name_as_class }

        context 'when the name is a single value' do
          let(:_name) { 'VEDEU' }

          it { subject.must_equal('Vedeu') }
        end

        context 'when the name is an underscored value' do
          it { subject.must_equal('MyFirstApp') }
        end

        context 'when the name contains hyphens' do
          let(:_name) { 'hyphenated-APP' }

          it { subject.must_equal('HyphenatedApp')}
        end
      end

    end # Application

  end # Generator

end # Vedeu

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vedeu-0.4.37 test/lib/vedeu/generator/application_test.rb
vedeu-0.4.36 test/lib/vedeu/generator/application_test.rb