Commit 64e03235c905ddec85dd3dbf135b94b8085510cc

Authored by AntonioTerceiro
1 parent 21c0927b

ActionItem642: fixing tests (fuck, Aurélio!)

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2461 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing 1 changed file with 10 additions and 6 deletions   Show diff stats
test/unit/lightbox_helper_test.rb
@@ -4,6 +4,10 @@ class LightboxHelperTest < Test::Unit::TestCase @@ -4,6 +4,10 @@ class LightboxHelperTest < Test::Unit::TestCase
4 4
5 include LightboxHelper 5 include LightboxHelper
6 6
  7 + def setup
  8 + stubs(:_).with(anything).returns('TEXT')
  9 + end
  10 +
7 should 'include lightbox properly' do 11 should 'include lightbox properly' do
8 expects(:stylesheet_link_tag).with('lightbox').returns('[lightbox.css]') 12 expects(:stylesheet_link_tag).with('lightbox').returns('[lightbox.css]')
9 expects(:javascript_include_tag).with('lightbox').returns('[lightbox.js]') 13 expects(:javascript_include_tag).with('lightbox').returns('[lightbox.js]')
@@ -16,36 +20,36 @@ class LightboxHelperTest < Test::Unit::TestCase @@ -16,36 +20,36 @@ class LightboxHelperTest < Test::Unit::TestCase
16 end 20 end
17 21
18 should 'provide lightbox_link_to helper' do 22 should 'provide lightbox_link_to helper' do
19 - expects(:link_to).with('text', { :action => 'view', :id => '1' }, { :class => 'lbOn', :id => 'my-link' }).returns('[link]') 23 + expects(:link_to).with('text', { :action => 'view', :id => '1' }, has_entries({ :class => 'lbOn', :id => 'my-link' })).returns('[link]')
20 assert_equal '[link]', lightbox_link_to('text', { :action => 'view', :id => '1'}, { :id => 'my-link' }) 24 assert_equal '[link]', lightbox_link_to('text', { :action => 'view', :id => '1'}, { :id => 'my-link' })
21 end 25 end
22 26
23 should 'merge existing :class option in lightbox_link_to' do 27 should 'merge existing :class option in lightbox_link_to' do
24 - expects(:link_to).with('text', { :action => 'view', :id => '1' }, { :class => 'lbOn my-button', :id => 'my-link' }).returns('[link]') 28 + expects(:link_to).with('text', { :action => 'view', :id => '1' }, has_entries({ :class => 'lbOn my-button', :id => 'my-link' })).returns('[link]')
25 assert_equal '[link]', lightbox_link_to('text', { :action => 'view', :id => '1'}, { :class => 'my-button', :id => 'my-link' }) 29 assert_equal '[link]', lightbox_link_to('text', { :action => 'view', :id => '1'}, { :class => 'my-button', :id => 'my-link' })
26 30
27 end 31 end
28 32
29 should 'provide link to close lightbox' do 33 should 'provide link to close lightbox' do
30 - expects(:button).with(:close, 'text', '#', { :class => 'lbAction', :rel => 'deactivate', :id => 'my-id' }).returns('[close-lightbox]') 34 + expects(:button).with(:close, 'text', '#', has_entries({ :class => 'lbAction', :rel => 'deactivate', :id => 'my-id' })).returns('[close-lightbox]')
31 35
32 assert_equal '[close-lightbox]', lightbox_close_button('text', :id => 'my-id') 36 assert_equal '[close-lightbox]', lightbox_close_button('text', :id => 'my-id')
33 end 37 end
34 38
35 should 'merge existing :class option in lightbox_close_button' do 39 should 'merge existing :class option in lightbox_close_button' do
36 - expects(:button).with(:close, 'text', '#', { :class => 'lbAction my-class', :rel => 'deactivate', :id => 'my-id' }).returns('[close-lightbox]') 40 + expects(:button).with(:close, 'text', '#', has_entries({ :class => 'lbAction my-class', :rel => 'deactivate', :id => 'my-id' })).returns('[close-lightbox]')
37 41
38 assert_equal '[close-lightbox]', lightbox_close_button('text', :class => 'my-class', :id => 'my-id' ) 42 assert_equal '[close-lightbox]', lightbox_close_button('text', :class => 'my-class', :id => 'my-id' )
39 end 43 end
40 44
41 should 'provide lightbox_button' do 45 should 'provide lightbox_button' do
42 - expects(:button).with('type', 'label', { :action => 'popup'}, { :class => 'lbOn' }).returns('[button]') 46 + expects(:button).with('type', 'label', { :action => 'popup'}, has_entries({ :class => 'lbOn' })).returns('[button]')
43 47
44 assert_equal '[button]', lightbox_button('type', 'label', { :action => 'popup'}) 48 assert_equal '[button]', lightbox_button('type', 'label', { :action => 'popup'})
45 end 49 end
46 50
47 should 'provide lightbox_icon_button' do 51 should 'provide lightbox_icon_button' do
48 - expects(:icon_button).with('type', 'label', { :action => 'popup'}, { :class => 'lbOn' }).returns('[button]') 52 + expects(:icon_button).with('type', 'label', { :action => 'popup'}, has_entries({ :class => 'lbOn' })).returns('[button]')
49 53
50 assert_equal '[button]', lightbox_icon_button('type', 'label', { :action => 'popup'}) 54 assert_equal '[button]', lightbox_icon_button('type', 'label', { :action => 'popup'})
51 end 55 end