Commit 7d64d3ea authored by Antonio Terceiro's avatar Antonio Terceiro

Block, Article: test per-language fragment caching in unit tests

The cucumber tests would depend on having the translations compiled,
which takes quite a while (more than 1 minute on my tests). You don't
want an extra full minute on every CI run.
parent 5bf7a6e2
Feature: caching
As a user
I want to see the contents according with my language
Even with the contents being cached
Background:
Given the cache is turned on
And the following user
| login | name |
| mario | Mario |
And I am logged in as "mario"
Scenario: blog view page
Given the following blogs
| owner | name | display_posts_in_current_language | visualization_format |
| mario | Sample Blog | false | short |
And the following articles
| owner | name | parent |
| mario | Post1 | Sample Blog |
| mario | Post2 | Sample Blog |
When I go to article "Sample Blog"
Then I should see "no comments yet"
When I follow "Português"
Then I should see "sem comentários ainda"
Scenario: blocks
Given I am on Mario's homepage
Then I should see "Recent content"
When I follow "Português"
Then I should see "Conteúdo recente"
......@@ -759,6 +759,11 @@ class ArticleTest < ActiveSupport::TestCase
assert_match(/-version-2/,a.cache_key(:version => 2))
end
should 'use language in cache key' do
a = Article.new
assert_not_equal a.cache_key({}, nil, ''), a.cache_key({}, nil, 'pt')
end
should 'not be highlighted by default' do
a = Article.new
refute a.highlighted
......
......@@ -303,6 +303,11 @@ class BlockTest < ActiveSupport::TestCase
assert_equal block.cache_key('en'), block.cache_key('en', person)
end
should 'use language in cache key' do
block = Block.new
assert_not_equal block.cache_key('en'), block.cache_key('pt')
end
should 'display block to members of community for display_user = members' do
community = fast_create(Community)
user = create_user('testinguser')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment