Sha256: e8d45cab076797d6077a19dc410ebc4d99a7ab9acc1910dd72d04a409ed1bf83

Contents?: true

Size: 956 Bytes

Versions: 6

Compression:

Stored size: 956 Bytes

Contents

require "minitest/autorun"
require "cognition"

class PluginTest < Minitest::Test
  def setup
    require_relative "fixtures/hello"
    bot = Cognition::Bot.new
    @hello = Hello.new(bot)
  end

  def test_sets_matchers
    assert_equal 1, @hello.matchers.count
  end

  def test_renders_default_template
    assert_equal "Hi from a default template!\n", @hello.hi("foo")
  end

  def test_renders_passed_template
    assert_equal "<h1>Hola</h1>\n", @hello.hola("foo")
  end

  def test_renders_specified_type
    assert_equal "Bonjour is french!\n", @hello.bonjour("foo")
  end

  def test_renders_specified_extension
    assert_equal "<h1>Hey</h1>\n", @hello.hey("foo")
  end

  def test_renders_with_locals
    assert_equal "<p>Yo</p>\n<p>Yo</p>\n<p>Yo</p>\n", @hello.yo("foo")
  end

  def test_multiple_render_calls
    assert_equal "<p>Yo</p>\n<p>Yo</p>\n<p>Yo</p>\n", @hello.yo("foo")
    assert_equal "<h1>Hey</h1>\n", @hello.hey("foo")
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cognition-2.1.3 test/test_plugin.rb
cognition-2.1.2 test/test_plugin.rb
cognition-2.0.8 test/test_plugin.rb
cognition-2.0.7 test/test_plugin.rb
cognition-2.0.6 test/test_plugin.rb
cognition-2.0.5 test/test_plugin.rb