Sha256: 8464456463d514b97f6257fb2328474b9287e96a2fa32b228a0a97708ddf77a7

Contents?: true

Size: 907 Bytes

Versions: 6

Compression:

Stored size: 907 Bytes

Contents

require 'helper'

class TestSubtrigger < Test::Unit::TestCase
  context 'with a clean slate' do
    setup do
      Subtrigger::Trigger.reset
    end

    should 'output the version number' do
      assert_match(/\d+\.\d+\.\d+/, Subtrigger.version)
    end

    should 'Create new Repository object' do
      Subtrigger::Repository.expects(:new).with('foo', '1')
      Subtrigger.run('foo', '1')
    end

    should 'Run all triggers' do
      Subtrigger::Repository.stubs(:new).returns('foo')
      Subtrigger::Trigger.expects(:run).with('foo')
      Subtrigger.run('foo', '1')
    end

    should 'create a new trigger' do
      assert_equal(0, Subtrigger::Trigger.triggers.size)
      Subtrigger.on(/foo/) { |m,r| }
      assert_equal(1, Subtrigger::Trigger.triggers.size)
    end

    should 'chain creation of triggers' do
      assert_equal(Subtrigger, Subtrigger.on(/foo/) { |m,r| })
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
subtrigger-0.2.5 test/test_subtrigger.rb
subtrigger-0.2.4 test/test_subtrigger.rb
subtrigger-0.2.3 test/test_subtrigger.rb
subtrigger-0.2.2 test/test_subtrigger.rb
subtrigger-0.2.1 test/test_subtrigger.rb
subtrigger-0.2.0 test/test_subtrigger.rb