Class: ODDB::TestYusStub

Inherits:
Test::Unit::TestCase
  • Object
show all
Includes:
FlexMock::TestCase
Defined in:
test/test_model/user.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



37
38
39
40
# File 'test/test_model/user.rb', line 37

def setup
  @stub = YusStub.new 'test@mail.ch'
  @session = flexmock 'yus-session'
end

- (Object) test_equal



54
55
56
57
58
59
# File 'test/test_model/user.rb', line 54

def test_equal
  assert_equal false, @stub == YusStub.new('other@mail.ch')
  assert_equal true, @stub == YusStub.new('test@mail.ch')
  assert_equal false, @stub.eql?(YusStub.new('other@mail.ch'))
  assert_equal true, @stub.eql?(YusStub.new('test@mail.ch'))
end

- (Object) test_method_missing



44
45
46
47
48
49
50
51
52
53
# File 'test/test_model/user.rb', line 44

def test_method_missing
  YusStub::YUS_SERVER.should_receive(:autosession)\
    .times(1).and_return do |domain, block| block.call @session end
  @session.should_receive(:get_entity_preference)\
    .with('test@mail.ch', :something).and_return do
    assert true
    'a result'
  end
  assert_equal 'a result', @stub.something
end

- (Object) test_yus_name



41
42
43
# File 'test/test_model/user.rb', line 41

def test_yus_name
  assert_equal 'test@mail.ch', @stub.yus_name
end