Sha256: 9990a4e963d97fd265157781273640be8e17336b88dd8b1d1aae969ed9bc8ab8

Contents?: true

Size: 965 Bytes

Versions: 2

Compression:

Stored size: 965 Bytes

Contents

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

describe Simplabs::Excellent::Checks::ModuleNameCheck do

  before do
    @excellent = Simplabs::Excellent::Core::ParseTreeRunner.new(Simplabs::Excellent::Checks::ModuleNameCheck.new)
  end

  describe '#evaluate' do

    it 'should accept camel case module names starting in capitals' do
      content = <<-END
        module GoodModuleName 
        end
      END
      @excellent.check_content(content)

      @excellent.errors.should be_empty
    end

    it 'should reject module names with underscores' do
      content = <<-END
        module Bad_ModuleName 
        end
      END
      @excellent.check_content(content)
      errors = @excellent.errors

      errors.should_not be_empty
      errors[0].info.should        == { :module => :Bad_ModuleName }
      errors[0].line_number.should == 1
      errors[0].message.should     == 'Bad module name Bad_ModuleName.'
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simplabs-excellent-1.0.0 spec/checks/module_name_check_spec.rb
simplabs-excellent-1.0.1 spec/checks/module_name_check_spec.rb