Sha256: 9652b792f9e5f2441c0923406a72bbfabb889148cd9e1cea42d11b8e3e18b6d2

Contents?: true

Size: 1.02 KB

Versions: 6

Compression:

Stored size: 1.02 KB

Contents

# encoding: utf-8

class Nanoc::CLI::ErrorHandlerTest < Nanoc::TestCase

  def setup
    super
    @handler = Nanoc::CLI::ErrorHandler.new
  end

  def test_resolution_for_with_unknown_gem
    error = LoadError.new('no such file to load -- afjlrestjlsgrshter')
    assert_nil @handler.send(:resolution_for, error)
  end

  def test_resolution_for_with_known_gem_without_bundler
    def @handler.using_bundler? ; false ; end
    error = LoadError.new('no such file to load -- kramdown')
    assert_match(/^Install the 'kramdown' gem using `gem install kramdown`./, @handler.send(:resolution_for, error))
  end

  def test_resolution_for_with_known_gem_with_bundler
    def @handler.using_bundler? ; true ; end
    error = LoadError.new('no such file to load -- kramdown')
    assert_match(/^Make sure the gem is added to Gemfile/, @handler.send(:resolution_for, error))
  end

  def test_resolution_for_with_not_load_error
    error = RuntimeError.new('nuclear meltdown detected')
    assert_nil @handler.send(:resolution_for, error)
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nanoc-3.6.7 test/cli/test_error_handler.rb
nanoc-3.6.6 test/cli/test_error_handler.rb
nanoc-3.6.5 test/cli/test_error_handler.rb
nanoc-3.6.4 test/cli/test_error_handler.rb
nanoc-3.6.3 test/cli/test_error_handler.rb
nanoc-3.6.2 test/cli/test_error_handler.rb