Commit 88921ec91d8ea9135a48cce246be6de3f098c92f
1 parent
8abe1cc5
Exists in
master
and in
22 other branches
Fixing tests
Showing
4 changed files
with
13 additions
and
13 deletions
Show diff stats
test/unit/application_helper_test.rb
| ... | ... | @@ -14,9 +14,8 @@ class ApplicationHelperTest < Test::Unit::TestCase |
| 14 | 14 | 'addthis'=>{'pub'=>'mylogin', 'options'=>'favorites, email'}, |
| 15 | 15 | 'gravatar'=>{'default'=>'wavatar'} |
| 16 | 16 | } |
| 17 | - # does not work! | |
| 18 | - File.stubs(:exists?).with(yml).returns(true) | |
| 19 | - YAML.stubs(:load_file).with(yml).returns(conf) | |
| 17 | + File.expects(:exists?).with(yml).returns(true) | |
| 18 | + YAML.expects(:load_file).with(yml).returns(conf) | |
| 20 | 19 | assert_equal conf, web2_conf |
| 21 | 20 | end |
| 22 | 21 | |
| ... | ... | @@ -531,6 +530,7 @@ class ApplicationHelperTest < Test::Unit::TestCase |
| 531 | 530 | end |
| 532 | 531 | |
| 533 | 532 | should 'generate a gravatar url' do |
| 533 | + stubs(:web2_conf).returns({"gravatar" => {"default" => "wavatar"}}) | |
| 534 | 534 | url = str_gravatar_url_for( 'rms@gnu.org', :size => 50 ) |
| 535 | 535 | assert_match(/^http:\/\/www\.gravatar\.com\/avatar\.php\?/, url) |
| 536 | 536 | assert_match(/(\?|&)gravatar_id=ed5214d4b49154ba0dc397a28ee90eb7(&|$)/, url) | ... | ... |
test/unit/communities_block_test.rb
| ... | ... | @@ -2,6 +2,8 @@ require File.dirname(__FILE__) + '/../test_helper' |
| 2 | 2 | |
| 3 | 3 | class CommunitiesBlockTest < Test::Unit::TestCase |
| 4 | 4 | |
| 5 | + include GetText | |
| 6 | + | |
| 5 | 7 | should 'inherit from ProfileListBlock' do |
| 6 | 8 | assert_kind_of ProfileListBlock, CommunitiesBlock.new |
| 7 | 9 | end |
| ... | ... | @@ -50,8 +52,7 @@ class CommunitiesBlockTest < Test::Unit::TestCase |
| 50 | 52 | block = CommunitiesBlock.new |
| 51 | 53 | block.expects(:owner).returns(profile) |
| 52 | 54 | |
| 53 | - expects(:__).with('View all').returns('All communities') | |
| 54 | - expects(:link_to).with('All communities', :controller => 'profile', :profile => 'theprofile', :action => 'communities') | |
| 55 | + expects(:link_to).with('View all', :controller => 'profile', :profile => 'theprofile', :action => 'communities') | |
| 55 | 56 | instance_eval(&block.footer) |
| 56 | 57 | end |
| 57 | 58 | |
| ... | ... | @@ -60,8 +61,7 @@ class CommunitiesBlockTest < Test::Unit::TestCase |
| 60 | 61 | block = CommunitiesBlock.new |
| 61 | 62 | block.expects(:owner).returns(env) |
| 62 | 63 | |
| 63 | - expects(:__).with('View all').returns('All communities') | |
| 64 | - expects(:link_to).with('All communities', :controller => 'search', :action => 'assets', :asset => 'communities') | |
| 64 | + expects(:link_to).with('View all', :controller => 'search', :action => 'assets', :asset => 'communities') | |
| 65 | 65 | |
| 66 | 66 | instance_eval(&block.footer) |
| 67 | 67 | end | ... | ... |
test/unit/enterprises_block_test.rb
| ... | ... | @@ -2,6 +2,8 @@ require File.dirname(__FILE__) + '/../test_helper' |
| 2 | 2 | |
| 3 | 3 | class EnterprisesBlockTest < Test::Unit::TestCase |
| 4 | 4 | |
| 5 | + include GetText | |
| 6 | + | |
| 5 | 7 | should 'inherit from ProfileListBlock' do |
| 6 | 8 | assert_kind_of ProfileListBlock, EnterprisesBlock.new |
| 7 | 9 | end |
| ... | ... | @@ -75,8 +77,7 @@ class EnterprisesBlockTest < Test::Unit::TestCase |
| 75 | 77 | block = EnterprisesBlock.new |
| 76 | 78 | block.expects(:owner).returns(profile) |
| 77 | 79 | |
| 78 | - expects(:__).with('View all').returns('All enterprises') | |
| 79 | - expects(:link_to).with('All enterprises', :controller => 'profile', :profile => 'theprofile', :action => 'enterprises') | |
| 80 | + expects(:link_to).with('View all', :controller => 'profile', :profile => 'theprofile', :action => 'enterprises') | |
| 80 | 81 | |
| 81 | 82 | instance_eval(&block.footer) |
| 82 | 83 | end |
| ... | ... | @@ -86,8 +87,7 @@ class EnterprisesBlockTest < Test::Unit::TestCase |
| 86 | 87 | block = EnterprisesBlock.new |
| 87 | 88 | block.expects(:owner).returns(env) |
| 88 | 89 | |
| 89 | - expects(:__).with('View all').returns('All enterprises') | |
| 90 | - expects(:link_to).with('All enterprises', :controller => 'search', :action => 'assets', :asset => 'enterprises') | |
| 90 | + expects(:link_to).with('View all', :controller => 'search', :action => 'assets', :asset => 'enterprises') | |
| 91 | 91 | instance_eval(&block.footer) |
| 92 | 92 | end |
| 93 | 93 | ... | ... |
test/unit/friends_block_test.rb
| ... | ... | @@ -2,6 +2,8 @@ require File.dirname(__FILE__) + '/../test_helper' |
| 2 | 2 | |
| 3 | 3 | class FriendsBlockTest < ActiveSupport::TestCase |
| 4 | 4 | |
| 5 | + include GetText | |
| 6 | + | |
| 5 | 7 | should 'describe itself' do |
| 6 | 8 | assert_not_equal ProfileListBlock.description, FriendsBlock.description |
| 7 | 9 | end |
| ... | ... | @@ -39,8 +41,6 @@ class FriendsBlockTest < ActiveSupport::TestCase |
| 39 | 41 | user.expects(:identifier).returns('theuser') |
| 40 | 42 | block.expects(:owner).returns(user) |
| 41 | 43 | |
| 42 | - def self._(s); s; end | |
| 43 | - def self.gettext(s); s; end | |
| 44 | 44 | expects(:link_to).with('View all', :profile => 'theuser', :controller => 'profile', :action => 'friends') |
| 45 | 45 | |
| 46 | 46 | instance_eval(&block.footer) | ... | ... |