Commit 6888d8e93e4cc85fed86bb4b0fdf8c347006ec45

Authored by Rodrigo Souto
1 parent 1d0e84f4

Renaming blocks integration test

test/integration/blocks_integration_test.rb
... ... @@ -1,56 +0,0 @@
1   -require "#{File.dirname(__FILE__)}/../test_helper"
2   -
3   -class BlocksIntegrationTest < ActionController::IntegrationTest
4   - def blog_on_article_block_bootstrap
5   - profile = fast_create(Profile)
6   - blog = fast_create(Blog, :name => 'Blog', :profile_id => profile.id)
7   - fast_create(TinyMceArticle, :name => "First Post", :profile_id => profile.id, :parent_id => blog.id, :body => '<p> Wasserstoffbombe </p>')
8   - 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>')
9   - block = ArticleBlock.new
10   - block.article = blog
11   - profile.boxes << Box.new
12   - profile.boxes.first.blocks << block
13   - return block
14   - end
15   -
16   - should 'allow blog as article block content' do
17   - block = blog_on_article_block_bootstrap
18   - get "/profile/#{block.owner.identifier}"
19   - assert_match(/Lorem ipsum dolor sit amet/, @response.body)
20   - end
21   -
22   - should 'display short version for block posts on article block' do
23   - block = blog_on_article_block_bootstrap
24   - get "/profile/#{block.owner.identifier}"
25   - assert_no_match(/Second paragraph/, @response.body)
26   - end
27   -
28   - should 'display full version for block posts on article block' do
29   - block = blog_on_article_block_bootstrap
30   - block.visualization_format = 'full'
31   - block.save!
32   - get "/profile/#{block.owner.identifier}"
33   - assert_match(/Second paragraph/, @response.body)
34   - end
35   -
36   - should 'display configured number of blog posts on article block' do
37   - block = blog_on_article_block_bootstrap
38   - block.posts_per_page = 2
39   - block.save!
40   - get "/profile/#{block.owner.identifier}"
41   - assert_match(/Lorem ipsum dolor sit amet/, @response.body)
42   - assert_match(/Wasserstoffbombe/, @response.body)
43   - end
44   -
45   - should 'link correctly in pagination' do
46   - block = blog_on_article_block_bootstrap
47   - p = block.owner
48   - b = block.article
49   - f = fast_create(Folder, :name => 'Folder1', :profile_id => p.id)
50   - b.parent = f
51   - b.save!
52   - get "/profile/#{block.owner.identifier}"
53   - assert_tag :tag => 'a', :attributes => { :href => "/#{p.identifier}/#{f.slug}/#{b.slug}?npage=2" }
54   - end
55   -
56   -end
test/integration/blocks_test.rb 0 → 100644
... ... @@ -0,0 +1,56 @@
  1 +require "#{File.dirname(__FILE__)}/../test_helper"
  2 +
  3 +class BlocksTest < ActionController::IntegrationTest
  4 + def blog_on_article_block_bootstrap
  5 + profile = fast_create(Profile)
  6 + blog = fast_create(Blog, :name => 'Blog', :profile_id => profile.id)
  7 + fast_create(TinyMceArticle, :name => "First Post", :profile_id => profile.id, :parent_id => blog.id, :body => '<p> Wasserstoffbombe </p>')
  8 + 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>')
  9 + block = ArticleBlock.new
  10 + block.article = blog
  11 + profile.boxes << Box.new
  12 + profile.boxes.first.blocks << block
  13 + return block
  14 + end
  15 +
  16 + should 'allow blog as article block content' do
  17 + block = blog_on_article_block_bootstrap
  18 + get "/profile/#{block.owner.identifier}"
  19 + assert_match(/Lorem ipsum dolor sit amet/, @response.body)
  20 + end
  21 +
  22 + should 'display short version for block posts on article block' do
  23 + block = blog_on_article_block_bootstrap
  24 + get "/profile/#{block.owner.identifier}"
  25 + assert_no_match(/Second paragraph/, @response.body)
  26 + end
  27 +
  28 + should 'display full version for block posts on article block' do
  29 + block = blog_on_article_block_bootstrap
  30 + block.visualization_format = 'full'
  31 + block.save!
  32 + get "/profile/#{block.owner.identifier}"
  33 + assert_match(/Second paragraph/, @response.body)
  34 + end
  35 +
  36 + should 'display configured number of blog posts on article block' do
  37 + block = blog_on_article_block_bootstrap
  38 + block.posts_per_page = 2
  39 + block.save!
  40 + get "/profile/#{block.owner.identifier}"
  41 + assert_match(/Lorem ipsum dolor sit amet/, @response.body)
  42 + assert_match(/Wasserstoffbombe/, @response.body)
  43 + end
  44 +
  45 + should 'link correctly in pagination' do
  46 + block = blog_on_article_block_bootstrap
  47 + p = block.owner
  48 + b = block.article
  49 + f = fast_create(Folder, :name => 'Folder1', :profile_id => p.id)
  50 + b.parent = f
  51 + b.save!
  52 + get "/profile/#{block.owner.identifier}"
  53 + assert_tag :tag => 'a', :attributes => { :href => "/#{p.identifier}/#{f.slug}/#{b.slug}?npage=2" }
  54 + end
  55 +
  56 +end
... ...