Commit 1d62da97fb09ed720846f2fdf3ce2169da6a55a0

Authored by AntonioTerceiro
1 parent 602bff8e

ActionItem237: correcting the name of the test file


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1582 3f533792-8f58-4932-b0fe-aaf55b0a4547
test/unit/lightbox_helper_test.rb 0 → 100644
@@ -0,0 +1,55 @@ @@ -0,0 +1,55 @@
  1 +require File.dirname(__FILE__) + '/../test_helper'
  2 +
  3 +class LightboxHelperTest < Test::Unit::TestCase
  4 +
  5 + include LightboxHelper
  6 +
  7 + should 'include lightbox properly' do
  8 + expects(:stylesheet_link_tag).with('lightbox').returns('[lightbox.css]')
  9 + expects(:javascript_include_tag).with('lightbox').returns('[lightbox.js]')
  10 + assert_equal '[lightbox.css][lightbox.js]', include_lightbox_header
  11 + end
  12 +
  13 + should 'provide the needed files' do
  14 + assert File.exists?(File.join(RAILS_ROOT, 'public', 'stylesheets', 'lightbox.css')), 'lightbox.css expected to be in public/stylesheets, but not found'
  15 + assert File.exists?(File.join(RAILS_ROOT, 'public', 'javascripts', 'lightbox.js')), 'lightbox.js expected to be in public/javascripts, but not found'
  16 + end
  17 +
  18 + should 'provide lightbox_link_to helper' do
  19 + expects(:link_to).with('text', { :action => 'view', :id => '1' }, { :class => 'lbOn', :id => 'my-link' }).returns('[link]')
  20 + assert_equal '[link]', lightbox_link_to('text', { :action => 'view', :id => '1'}, { :id => 'my-link' })
  21 + end
  22 +
  23 + 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]')
  25 + assert_equal '[link]', lightbox_link_to('text', { :action => 'view', :id => '1'}, { :class => 'my-button', :id => 'my-link' })
  26 +
  27 + end
  28 +
  29 + should 'provide link to close lightbox' do
  30 + expects(:button).with(:close, 'text', '#', { :class => 'lbAction', :rel => 'deactivate', :id => 'my-id' }).returns('[close-lightbox]')
  31 +
  32 + assert_equal '[close-lightbox]', lightbox_close_button('text', :id => 'my-id')
  33 + end
  34 +
  35 + 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]')
  37 +
  38 + assert_equal '[close-lightbox]', lightbox_close_button('text', :class => 'my-class', :id => 'my-id' )
  39 + end
  40 +
  41 + should 'provide lightbox_button' do
  42 + expects(:button).with('type', 'label', { :action => 'popup'}, { :class => 'lbOn' }).returns('[button]')
  43 +
  44 + assert_equal '[button]', lightbox_button('type', 'label', { :action => 'popup'})
  45 + end
  46 +
  47 + should 'tell if rendering inside lightbox' do
  48 + request = mock
  49 + expects(:request).returns(request)
  50 + request.expects(:xhr?).returns(true)
  51 +
  52 + assert lightbox?
  53 + end
  54 +
  55 +end
test/unit/lightbox_helper_text.rb
@@ -1,55 +0,0 @@ @@ -1,55 +0,0 @@
1 -require File.dirname(__FILE__) + '/../test_helper'  
2 -  
3 -class LightboxHelperTest < Test::Unit::TestCase  
4 -  
5 - include LightboxHelper  
6 -  
7 - should 'include lightbox properly' do  
8 - expects(:stylesheet_link_tag).with('lightbox').returns('[lightbox.css]')  
9 - expects(:javascript_include_tag).with('lightbox').returns('[lightbox.js]')  
10 - assert_equal '[lightbox.css][lightbox.js]', include_lightbox_header  
11 - end  
12 -  
13 - should 'provide the needed files' do  
14 - assert File.exists?(File.join(RAILS_ROOT, 'public', 'stylesheets', 'lightbox.css')), 'lightbox.css expected to be in public/stylesheets, but not found'  
15 - assert File.exists?(File.join(RAILS_ROOT, 'public', 'javascripts', 'lightbox.js')), 'lightbox.js expected to be in public/javascripts, but not found'  
16 - end  
17 -  
18 - should 'provide lightbox_link_to helper' do  
19 - expects(:link_to).with('text', { :action => 'view', :id => '1' }, { :class => 'lbOn', :id => 'my-link' }).returns('[link]')  
20 - assert_equal '[link]', lightbox_link_to('text', { :action => 'view', :id => '1'}, { :id => 'my-link' })  
21 - end  
22 -  
23 - 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]')  
25 - assert_equal '[link]', lightbox_link_to('text', { :action => 'view', :id => '1'}, { :class => 'my-button', :id => 'my-link' })  
26 -  
27 - end  
28 -  
29 - should 'provide link to close lightbox' do  
30 - expects(:button).with(:close, 'text', '#', { :class => 'lbAction', :rel => 'deactivate', :id => 'my-id' }).returns('[close-lightbox]')  
31 -  
32 - assert_equal '[close-lightbox]', lightbox_close_button('text', :id => 'my-id')  
33 - end  
34 -  
35 - 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]')  
37 -  
38 - assert_equal '[close-lightbox]', lightbox_close_button('text', :class => 'my-class', :id => 'my-id' )  
39 - end  
40 -  
41 - should 'provide lightbox_button' do  
42 - expects(:button).with('type', 'label', { :action => 'popup'}, { :class => 'lbOn' }).returns('[button]')  
43 -  
44 - assert_equal '[button]', lightbox_button('type', 'label', { :action => 'popup'})  
45 - end  
46 -  
47 - should 'tell if rendering inside lightbox' do  
48 - request = mock  
49 - expects(:request).returns(request)  
50 - request.expects(:xhr?).returns(true)  
51 -  
52 - assert lightbox?  
53 - end  
54 -  
55 -end