File: test_behavior.rb

package info (click to toggle)
ruby-god 0.12.1-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 752 kB
  • sloc: ruby: 5,913; ansic: 217; makefile: 3
file content (18 lines) | stat: -rw-r--r-- 526 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require File.dirname(__FILE__) + '/helper'

class TestBehavior < Test::Unit::TestCase
  def test_generate_should_return_an_object_corresponding_to_the_given_type
    assert_equal Behaviors::FakeBehavior, Behavior.generate(:fake_behavior, nil).class
  end

  def test_generate_should_raise_on_invalid_type
    assert_raise NoSuchBehaviorError do
      Behavior.generate(:foo, nil)
    end
  end

  def test_complain
    SysLogger.expects(:log).with(:error, 'foo')
    assert !Behavior.allocate.bypass.complain('foo')
  end
end