Class: Jabber::UserTune::TuneTest

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/vendor/xmpp4r/test/tune/tc_tune.rb

Instance Method Summary collapse

Instance Method Details

#artistObject



52
53
54
# File 'lib/vendor/xmpp4r/test/tune/tc_tune.rb', line 52

def artist
  'Mike Flowers Pops'
end

#lengthObject



60
61
62
# File 'lib/vendor/xmpp4r/test/tune/tc_tune.rb', line 60

def length
  175
end

#ratingObject



76
77
78
# File 'lib/vendor/xmpp4r/test/tune/tc_tune.rb', line 76

def rating
  10
end

#sourceObject



68
69
70
# File 'lib/vendor/xmpp4r/test/tune/tc_tune.rb', line 68

def source
  'A Groovy Place'
end

#test_createObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/vendor/xmpp4r/test/tune/tc_tune.rb', line 9

def test_create
  artist='Mike Flowers Pops'
  title='Light My Fire'
  length=175
  track='4'
  source='A Groovy Place'
  uri='http://musicbrainz.org/track/d44110e6-4b20-4d16-9e69-74bf0e4f7106.html'
  rating=10

  t=Jabber::UserTune::Tune.new(artist,title,length,track,source,uri,rating)

  assert_kind_of Jabber::UserTune::Tune,t
  assert_equal 7,t.elements.size
  assert_equal true,t.playing?
  assert_equal artist,t.artist
  assert_equal track,t.track
  assert_equal length,t.length
  assert_equal track,t.track
  assert_equal source,t.source
  assert_equal uri,t.uri
  assert_equal rating,t.rating
end

#test_rating_edgecasesObject



46
47
48
49
50
# File 'lib/vendor/xmpp4r/test/tune/tc_tune.rb', line 46

def test_rating_edgecases
  assert_equal(0, Jabber::UserTune::Tune.new(artist,title,length,track,source,uri,-1.5).rating)
  assert_equal(10, Jabber::UserTune::Tune.new(artist,title,length,track,source,uri,11.5).rating)
  assert_equal(nil, Jabber::UserTune::Tune.new(artist,title,length,track,source,uri,'fantastic').rating)
end

#test_stop_playingObject



32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/vendor/xmpp4r/test/tune/tc_tune.rb', line 32

def test_stop_playing
  t=Jabber::UserTune::Tune.new

  assert_kind_of Jabber::UserTune::Tune,t
  assert_equal 0,t.elements.size
  assert_equal false, t.playing?
  assert_equal nil,t.artist
  assert_equal nil,t.track
  assert_equal nil,t.length
  assert_equal nil,t.track
  assert_equal nil,t.source
  assert_equal nil,t.uri
end

#titleObject



56
57
58
# File 'lib/vendor/xmpp4r/test/tune/tc_tune.rb', line 56

def title
  'Light My Fire'
end

#trackObject



64
65
66
# File 'lib/vendor/xmpp4r/test/tune/tc_tune.rb', line 64

def track
  '4'
end

#uriObject



72
73
74
# File 'lib/vendor/xmpp4r/test/tune/tc_tune.rb', line 72

def uri
  'http://musicbrainz.org/track/d44110e6-4b20-4d16-9e69-74bf0e4f7106.html'
end