Commit f2ad43c7f26a2c5491e7357ec1da32f5ed808f10
1 parent
7d11a564
Exists in
master
and in
29 other branches
ActionItem1049: fixing tests
Showing
7 changed files
with
17 additions
and
16 deletions
Show diff stats
test/unit/application_helper_test.rb
... | ... | @@ -178,13 +178,9 @@ class ApplicationHelperTest < Test::Unit::TestCase |
178 | 178 | assert_equal 'sampleuser', theme_owner |
179 | 179 | end |
180 | 180 | |
181 | - should 'use default template when no profile' do | |
181 | + should 'use default template when there is no profile' do | |
182 | 182 | stubs(:profile).returns(nil) |
183 | - | |
184 | - foo = mock | |
185 | - expects(:stylesheet_link_tag).with('/designs/templates/default/stylesheets/style.css').returns(foo) | |
186 | - | |
187 | - assert_same foo, template_stylesheet_tag | |
183 | + assert_equal "@import url(/designs/templates/default/stylesheets/style.css);", template_stylesheet_tag | |
188 | 184 | end |
189 | 185 | |
190 | 186 | should 'use template from profile' do |
... | ... | @@ -193,7 +189,7 @@ class ApplicationHelperTest < Test::Unit::TestCase |
193 | 189 | stubs(:profile).returns(profile) |
194 | 190 | |
195 | 191 | foo = mock |
196 | - expects(:stylesheet_link_tag).with('/designs/templates/mytemplate/stylesheets/style.css').returns(foo) | |
192 | + expects(:stylesheet_import).with('/designs/templates/mytemplate/stylesheets/style.css').returns(foo) | |
197 | 193 | |
198 | 194 | assert_same foo, template_stylesheet_tag |
199 | 195 | end |
... | ... | @@ -232,6 +228,8 @@ class ApplicationHelperTest < Test::Unit::TestCase |
232 | 228 | end |
233 | 229 | |
234 | 230 | should 'create rss feed link to blog' do |
231 | + @controller = mock | |
232 | + @controller.stubs(:controller_name).returns('content_viewer') | |
235 | 233 | p = create_user('testuser').person |
236 | 234 | b = Blog.create!(:profile => p, :name => 'blog_feed_test') |
237 | 235 | 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 |
464 | 462 | e = Environment.default |
465 | 463 | e.icon_theme = 'something-very-unlikely' |
466 | 464 | stubs(:environment).returns(e) |
467 | - assert_equal "<!-- Not included: /designs/icons/something-very-unlikely/style.css -->\n/designs/icons/default/style.css", icon_theme_stylesheet_tag | |
465 | + assert_equal "@import url(/designs/icons/default/style.css);", icon_theme_stylesheet_tag | |
468 | 466 | end |
469 | 467 | |
470 | 468 | protected | ... | ... |
test/unit/blog_helper_test.rb
... | ... | @@ -20,7 +20,7 @@ class BlogHelperTest < Test::Unit::TestCase |
20 | 20 | blog.children << published_post = TextileArticle.create!(:name => 'Post', :profile => profile, :parent => blog, :published => true) |
21 | 21 | |
22 | 22 | expects(:display_post).with(anything).returns('POST') |
23 | - expects(:content_tag).with('div', 'POST', :class => 'blog-post', :id => "post-#{published_post.id}").returns('RESULT') | |
23 | + expects(:content_tag).with('div', 'POST', :class => 'blog-post position-1 first last', :id => "post-#{published_post.id}").returns('RESULT') | |
24 | 24 | |
25 | 25 | assert_equal 'RESULT', list_posts(profile, blog.posts) |
26 | 26 | end |
... | ... | @@ -29,7 +29,7 @@ class BlogHelperTest < Test::Unit::TestCase |
29 | 29 | blog.children << unpublished_post = TextileArticle.create!(:name => 'Post', :profile => profile, :parent => blog, :published => false) |
30 | 30 | |
31 | 31 | expects(:display_post).with(anything).returns('POST') |
32 | - expects(:content_tag).with('div', 'POST', :class => 'blog-post-not-published', :id => "post-#{unpublished_post.id}").returns('RESULT') | |
32 | + expects(:content_tag).with('div', 'POST', :class => 'blog-post position-1 first last not-published', :id => "post-#{unpublished_post.id}").returns('RESULT') | |
33 | 33 | |
34 | 34 | assert_equal 'RESULT', list_posts(profile, blog.posts) |
35 | 35 | end |
... | ... | @@ -40,8 +40,8 @@ class BlogHelperTest < Test::Unit::TestCase |
40 | 40 | blog.children << published_post = TextileArticle.create!(:name => 'Second post', :profile => profile, :parent => blog, :published => true) |
41 | 41 | |
42 | 42 | expects(:display_post).with(anything).returns('POST') |
43 | - expects(:content_tag).with('div', 'POST', :class => 'blog-post', :id => "post-#{published_post.id}").returns('RESULT') | |
44 | - expects(:content_tag).with('div', 'POST', :class => 'blog-post-not-published', :id => "post-#{unpublished_post.id}").never | |
43 | + expects(:content_tag).with('div', 'POST', :class => 'blog-post position-2 last', :id => "post-#{published_post.id}").returns('RESULT') | |
44 | + expects(:content_tag).with('div', 'POST', :class => 'blog-post position-1 first', :id => "post-#{unpublished_post.id}").never | |
45 | 45 | |
46 | 46 | assert_equal 'RESULT', list_posts(nil, blog.posts) |
47 | 47 | end | ... | ... |
test/unit/blog_test.rb
... | ... | @@ -51,9 +51,9 @@ class BlogTest < ActiveSupport::TestCase |
51 | 51 | assert_equal 7, p.blog.feed.limit |
52 | 52 | end |
53 | 53 | |
54 | - should 'list 20 posts per page by default' do | |
54 | + should 'list 5 posts per page by default' do | |
55 | 55 | blog = Blog.new |
56 | - assert_equal 20, blog.posts_per_page | |
56 | + assert_equal 5, blog.posts_per_page | |
57 | 57 | end |
58 | 58 | |
59 | 59 | should 'update posts per page setting' do | ... | ... |
test/unit/communities_block_test.rb
... | ... | @@ -7,6 +7,7 @@ class CommunitiesBlockTest < Test::Unit::TestCase |
7 | 7 | end |
8 | 8 | |
9 | 9 | should 'declare its default title' do |
10 | + CommunitiesBlock.any_instance.stubs(:profile_count).returns(0) | |
10 | 11 | assert_not_equal ProfileListBlock.new.default_title, CommunitiesBlock.new.default_title |
11 | 12 | end |
12 | 13 | ... | ... |
test/unit/enterprises_block_test.rb
... | ... | @@ -7,6 +7,7 @@ class EnterprisesBlockTest < Test::Unit::TestCase |
7 | 7 | end |
8 | 8 | |
9 | 9 | should 'declare its default title' do |
10 | + EnterprisesBlock.any_instance.stubs(:profile_count).returns(0) | |
10 | 11 | assert_not_equal ProfileListBlock.new.default_title, EnterprisesBlock.new.default_title |
11 | 12 | end |
12 | 13 | ... | ... |
test/unit/friends_block_test.rb
... | ... | @@ -7,6 +7,7 @@ class FriendsBlockTest < ActiveSupport::TestCase |
7 | 7 | end |
8 | 8 | |
9 | 9 | should 'declare its default title' do |
10 | + FriendsBlock.any_instance.stubs(:profile_count).returns(0) | |
10 | 11 | assert_not_equal ProfileListBlock.new.default_title, FriendsBlock.new.default_title |
11 | 12 | end |
12 | 13 | ... | ... |
test/unit/profile_image_block_test.rb
... | ... | @@ -9,12 +9,12 @@ class ProfileImageBlockTest < Test::Unit::TestCase |
9 | 9 | should 'display profile image' do |
10 | 10 | block = ProfileImageBlock.new |
11 | 11 | |
12 | - self.expects(:render).with(:file => 'blocks/profile_image', :locals => { :block => block}) | |
12 | + self.expects(:render).with(:file => 'blocks/profile_image', :locals => { :block => block, :show_name => false}) | |
13 | 13 | instance_eval(& block.content) |
14 | 14 | end |
15 | 15 | |
16 | 16 | should 'not be editable' do |
17 | - assert !ProfileImageBlock.new.editable? | |
17 | + assert ProfileImageBlock.new.editable? | |
18 | 18 | end |
19 | 19 | |
20 | 20 | end | ... | ... |