Commit 67b9265bba0986ff14c680615c1da2bdbad27135
1 parent
3f8c863c
Exists in
staging
and in
29 other branches
Rename blocks integration test file to avoid ambiguity with tests in api
Showing
2 changed files
with
46 additions
and
46 deletions
Show diff stats
test/integration/blocks_test.rb
@@ -1,46 +0,0 @@ | @@ -1,46 +0,0 @@ | ||
1 | -require_relative "../test_helper" | ||
2 | - | ||
3 | -class BlocksTest < ActionDispatch::IntegrationTest | ||
4 | - | ||
5 | - def blog_on_article_block_bootstrap | ||
6 | - profile = fast_create(Profile) | ||
7 | - blog = fast_create(Blog, :name => 'Blog', :profile_id => profile.id) | ||
8 | - fast_create(TinyMceArticle, :name => "First Post", :profile_id => profile.id, :parent_id => blog.id, :body => '<p> Wasserstoffbombe </p>') | ||
9 | - fast_create(TinyMceArticle, :name => "A Post", :profile_id => profile.id, :parent_id => blog.id, :body => '<p>Lorem ipsum dolor sit amet</p> <p>Second paragraph</p>') | ||
10 | - block = ArticleBlock.new | ||
11 | - block.article = blog | ||
12 | - profile.boxes << Box.new | ||
13 | - profile.boxes.first.blocks << block | ||
14 | - return block | ||
15 | - end | ||
16 | - | ||
17 | - should 'allow blog as article block content' do | ||
18 | - block = blog_on_article_block_bootstrap | ||
19 | - get "/profile/#{block.owner.identifier}" | ||
20 | - assert_match(/Lorem ipsum dolor sit amet/, @response.body) | ||
21 | - end | ||
22 | - | ||
23 | - should 'display short version for block posts on article block' do | ||
24 | - block = blog_on_article_block_bootstrap | ||
25 | - get "/profile/#{block.owner.identifier}" | ||
26 | - assert_no_match(/Second paragraph/, @response.body) | ||
27 | - end | ||
28 | - | ||
29 | - should 'display full version for block posts on article block' do | ||
30 | - block = blog_on_article_block_bootstrap | ||
31 | - block.visualization_format = 'full' | ||
32 | - block.save! | ||
33 | - get "/profile/#{block.owner.identifier}" | ||
34 | - assert_match(/Second paragraph/, @response.body) | ||
35 | - end | ||
36 | - | ||
37 | - should 'display configured number of blog posts on article block' do | ||
38 | - block = blog_on_article_block_bootstrap | ||
39 | - block.posts_per_page = 2 | ||
40 | - block.save! | ||
41 | - get "/profile/#{block.owner.identifier}" | ||
42 | - assert_match(/Lorem ipsum dolor sit amet/, @response.body) | ||
43 | - assert_match(/Wasserstoffbombe/, @response.body) | ||
44 | - end | ||
45 | - | ||
46 | -end |
@@ -0,0 +1,46 @@ | @@ -0,0 +1,46 @@ | ||
1 | +require_relative "../test_helper" | ||
2 | + | ||
3 | +class ProfileBlocksTest < ActionDispatch::IntegrationTest | ||
4 | + | ||
5 | + def blog_on_article_block_bootstrap | ||
6 | + profile = fast_create(Profile) | ||
7 | + blog = fast_create(Blog, :name => 'Blog', :profile_id => profile.id) | ||
8 | + fast_create(TinyMceArticle, :name => "First Post", :profile_id => profile.id, :parent_id => blog.id, :body => '<p> Wasserstoffbombe </p>') | ||
9 | + fast_create(TinyMceArticle, :name => "A Post", :profile_id => profile.id, :parent_id => blog.id, :body => '<p>Lorem ipsum dolor sit amet</p> <p>Second paragraph</p>') | ||
10 | + block = ArticleBlock.new | ||
11 | + block.article = blog | ||
12 | + profile.boxes << Box.new | ||
13 | + profile.boxes.first.blocks << block | ||
14 | + return block | ||
15 | + end | ||
16 | + | ||
17 | + should 'allow blog as article block content' do | ||
18 | + block = blog_on_article_block_bootstrap | ||
19 | + get "/profile/#{block.owner.identifier}" | ||
20 | + assert_match(/Lorem ipsum dolor sit amet/, @response.body) | ||
21 | + end | ||
22 | + | ||
23 | + should 'display short version for block posts on article block' do | ||
24 | + block = blog_on_article_block_bootstrap | ||
25 | + get "/profile/#{block.owner.identifier}" | ||
26 | + assert_no_match(/Second paragraph/, @response.body) | ||
27 | + end | ||
28 | + | ||
29 | + should 'display full version for block posts on article block' do | ||
30 | + block = blog_on_article_block_bootstrap | ||
31 | + block.visualization_format = 'full' | ||
32 | + block.save! | ||
33 | + get "/profile/#{block.owner.identifier}" | ||
34 | + assert_match(/Second paragraph/, @response.body) | ||
35 | + end | ||
36 | + | ||
37 | + should 'display configured number of blog posts on article block' do | ||
38 | + block = blog_on_article_block_bootstrap | ||
39 | + block.posts_per_page = 2 | ||
40 | + block.save! | ||
41 | + get "/profile/#{block.owner.identifier}" | ||
42 | + assert_match(/Lorem ipsum dolor sit amet/, @response.body) | ||
43 | + assert_match(/Wasserstoffbombe/, @response.body) | ||
44 | + end | ||
45 | + | ||
46 | +end |