diff --git a/test/unit/application_helper_test.rb b/test/unit/application_helper_test.rb index aa2677d..8a56a3d 100644 --- a/test/unit/application_helper_test.rb +++ b/test/unit/application_helper_test.rb @@ -178,13 +178,9 @@ class ApplicationHelperTest < Test::Unit::TestCase assert_equal 'sampleuser', theme_owner end - should 'use default template when no profile' do + should 'use default template when there is no profile' do stubs(:profile).returns(nil) - - foo = mock - expects(:stylesheet_link_tag).with('/designs/templates/default/stylesheets/style.css').returns(foo) - - assert_same foo, template_stylesheet_tag + assert_equal "@import url(/designs/templates/default/stylesheets/style.css);", template_stylesheet_tag end should 'use template from profile' do @@ -193,7 +189,7 @@ class ApplicationHelperTest < Test::Unit::TestCase stubs(:profile).returns(profile) foo = mock - expects(:stylesheet_link_tag).with('/designs/templates/mytemplate/stylesheets/style.css').returns(foo) + expects(:stylesheet_import).with('/designs/templates/mytemplate/stylesheets/style.css').returns(foo) assert_same foo, template_stylesheet_tag end @@ -232,6 +228,8 @@ class ApplicationHelperTest < Test::Unit::TestCase end should 'create rss feed link to blog' do + @controller = mock + @controller.stubs(:controller_name).returns('content_viewer') p = create_user('testuser').person b = Blog.create!(:profile => p, :name => 'blog_feed_test') assert_tag_in_string meta_tags_for_article(b), :tag => 'link', :attributes => {:type => 'application/rss+xml', :title => 'feed'} @@ -464,7 +462,7 @@ class ApplicationHelperTest < Test::Unit::TestCase e = Environment.default e.icon_theme = 'something-very-unlikely' stubs(:environment).returns(e) - assert_equal "\n/designs/icons/default/style.css", icon_theme_stylesheet_tag + assert_equal "@import url(/designs/icons/default/style.css);", icon_theme_stylesheet_tag end protected diff --git a/test/unit/blog_helper_test.rb b/test/unit/blog_helper_test.rb index b994a39..d55e64f 100644 --- a/test/unit/blog_helper_test.rb +++ b/test/unit/blog_helper_test.rb @@ -20,7 +20,7 @@ class BlogHelperTest < Test::Unit::TestCase blog.children << published_post = TextileArticle.create!(:name => 'Post', :profile => profile, :parent => blog, :published => true) expects(:display_post).with(anything).returns('POST') - expects(:content_tag).with('div', 'POST', :class => 'blog-post', :id => "post-#{published_post.id}").returns('RESULT') + expects(:content_tag).with('div', 'POST', :class => 'blog-post position-1 first last', :id => "post-#{published_post.id}").returns('RESULT') assert_equal 'RESULT', list_posts(profile, blog.posts) end @@ -29,7 +29,7 @@ class BlogHelperTest < Test::Unit::TestCase blog.children << unpublished_post = TextileArticle.create!(:name => 'Post', :profile => profile, :parent => blog, :published => false) expects(:display_post).with(anything).returns('POST') - expects(:content_tag).with('div', 'POST', :class => 'blog-post-not-published', :id => "post-#{unpublished_post.id}").returns('RESULT') + expects(:content_tag).with('div', 'POST', :class => 'blog-post position-1 first last not-published', :id => "post-#{unpublished_post.id}").returns('RESULT') assert_equal 'RESULT', list_posts(profile, blog.posts) end @@ -40,8 +40,8 @@ class BlogHelperTest < Test::Unit::TestCase blog.children << published_post = TextileArticle.create!(:name => 'Second post', :profile => profile, :parent => blog, :published => true) expects(:display_post).with(anything).returns('POST') - expects(:content_tag).with('div', 'POST', :class => 'blog-post', :id => "post-#{published_post.id}").returns('RESULT') - expects(:content_tag).with('div', 'POST', :class => 'blog-post-not-published', :id => "post-#{unpublished_post.id}").never + expects(:content_tag).with('div', 'POST', :class => 'blog-post position-2 last', :id => "post-#{published_post.id}").returns('RESULT') + expects(:content_tag).with('div', 'POST', :class => 'blog-post position-1 first', :id => "post-#{unpublished_post.id}").never assert_equal 'RESULT', list_posts(nil, blog.posts) end diff --git a/test/unit/blog_test.rb b/test/unit/blog_test.rb index e5f8c28..1fd1bcf 100644 --- a/test/unit/blog_test.rb +++ b/test/unit/blog_test.rb @@ -51,9 +51,9 @@ class BlogTest < ActiveSupport::TestCase assert_equal 7, p.blog.feed.limit end - should 'list 20 posts per page by default' do + should 'list 5 posts per page by default' do blog = Blog.new - assert_equal 20, blog.posts_per_page + assert_equal 5, blog.posts_per_page end should 'update posts per page setting' do diff --git a/test/unit/communities_block_test.rb b/test/unit/communities_block_test.rb index 9d66865..24f0df0 100644 --- a/test/unit/communities_block_test.rb +++ b/test/unit/communities_block_test.rb @@ -7,6 +7,7 @@ class CommunitiesBlockTest < Test::Unit::TestCase end should 'declare its default title' do + CommunitiesBlock.any_instance.stubs(:profile_count).returns(0) assert_not_equal ProfileListBlock.new.default_title, CommunitiesBlock.new.default_title end diff --git a/test/unit/enterprises_block_test.rb b/test/unit/enterprises_block_test.rb index 9647b1c..fd9ea3b 100644 --- a/test/unit/enterprises_block_test.rb +++ b/test/unit/enterprises_block_test.rb @@ -7,6 +7,7 @@ class EnterprisesBlockTest < Test::Unit::TestCase end should 'declare its default title' do + EnterprisesBlock.any_instance.stubs(:profile_count).returns(0) assert_not_equal ProfileListBlock.new.default_title, EnterprisesBlock.new.default_title end diff --git a/test/unit/friends_block_test.rb b/test/unit/friends_block_test.rb index 4e4695b..50270ea 100644 --- a/test/unit/friends_block_test.rb +++ b/test/unit/friends_block_test.rb @@ -7,6 +7,7 @@ class FriendsBlockTest < ActiveSupport::TestCase end should 'declare its default title' do + FriendsBlock.any_instance.stubs(:profile_count).returns(0) assert_not_equal ProfileListBlock.new.default_title, FriendsBlock.new.default_title end diff --git a/test/unit/profile_image_block_test.rb b/test/unit/profile_image_block_test.rb index 0b248f3..deb11ea 100644 --- a/test/unit/profile_image_block_test.rb +++ b/test/unit/profile_image_block_test.rb @@ -9,12 +9,12 @@ class ProfileImageBlockTest < Test::Unit::TestCase should 'display profile image' do block = ProfileImageBlock.new - self.expects(:render).with(:file => 'blocks/profile_image', :locals => { :block => block}) + self.expects(:render).with(:file => 'blocks/profile_image', :locals => { :block => block, :show_name => false}) instance_eval(& block.content) end should 'not be editable' do - assert !ProfileImageBlock.new.editable? + assert ProfileImageBlock.new.editable? end end -- libgit2 0.21.2