File: test_expectation_builder.rb

package info (click to toggle)
ruby-jnunemaker-matchy 0.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 312 kB
  • sloc: ruby: 2,939; makefile: 2
file content (28 lines) | stat: -rw-r--r-- 733 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
require File.dirname(__FILE__) + '/test_helper.rb'

class TestExpectationBuilder < Test::Unit::TestCase
  
  def setup
    @obj = Object.new
  end
  
  def test_should
    exp = Matchy::ExpectationBuilder.build_expectation(true, nil, @obj)
    exp.send(:==, @obj)
  end
  
  def test_should_fails
    expect_1 = Matchy::ExpectationBuilder.build_expectation(true, nil, 1)
    lambda {expect_1.send(:==, 2)}.should raise_error
  end
  
  def test_should_not
    exp = Matchy::ExpectationBuilder.build_expectation(false, nil, @obj)
    exp.send(:==, 1)
  end
  
  def test_should_not_fails
    expect_not_1 = Matchy::ExpectationBuilder.build_expectation(false, nil, 1)
    lambda {expect_not_1.send(:==, 1)}.should raise_error
  end
end