Sha256: c1808979d2e6dee36acd0251d37619baba32f18688e4bcede1a86205979f05ce

Contents?: true

Size: 1.33 KB

Versions: 8

Compression:

Stored size: 1.33 KB

Contents

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

describe ::Inch::Language::Elixir::CodeObject::ModuleObject do
  before do
    @codebase = fresh_codebase(:elixir, :inch_test, 'all.json')
    @objects = @codebase.objects
  end

  describe 'Scores' do
    #
    it 'should not' do
      m = @objects.find('InchTest.Functions')
      refute m.docstring.empty?
      refute m.undocumented?
      assert m.score >= 50
    end
  end

  it 'should recognize moduledoc' do
    m = @objects.find('InchTest.Invisible')
    # defined in Hello-World-Elixir, but not in report since
    # `@moduledoc false` excludes it
    assert m.nil?
  end

  it 'should recognize moduledoc' do
    m = @objects.find('InchTest.Invisible.foo')
    # defined in Hello-World-Elixir, but not in report since
    # `@moduledoc false` excludes it
    assert m.nil?
  end

  it 'should recognize protocols' do
    m = @objects.find('InchTest.Html.Safe')
    refute m.nodoc?
  end

  it 'should recognize implementations' do
    m = @objects.find('InchTest.Html.Safe.Atom')
    assert m.nodoc?
    assert m.priority < 0
  end

  it 'should recognize code location' do
    m = @objects.find('InchTest.Functions')
    file = m.filename
    refute_nil file
    assert_equal 'lib/inch_test/functions.ex', file.relative_path
    assert_equal 1, file.line_no.to_i
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
inch-0.9.0.rc1 test/unit/language/elixir/code_object/module_object_test.rb
inch-0.8.0 test/unit/language/elixir/code_object/module_object_test.rb
inch-0.8.0.rc2 test/unit/language/elixir/code_object/module_object_test.rb
inch-0.8.0.rc1 test/unit/language/elixir/code_object/module_object_test.rb
inch-0.7.1 test/unit/language/elixir/code_object/module_object_test.rb
inch-0.7.0 test/unit/language/elixir/code_object/module_object_test.rb
inch-0.6.4 test/unit/language/elixir/code_object/module_object_test.rb
inch-0.6.3 test/unit/language/elixir/code_object/module_object_test.rb