Commit f0955bafc9c0524fe1f5bf492697cbc23e400f11
Committed by
Rafael Reggiani Manzo
1 parent
610763c4
Exists in
colab
and in
2 other branches
Fix cache creation on homepage
As we are using multiple cache fragments for one action, we need to specify action_suffixes so rails create different keys for each fragment. Signed-off-by: Rafael Reggiani Manzo <rr.manzo@protonmail.com>
Showing
3 changed files
with
11 additions
and
4 deletions
Show diff stats
app/views/home/index.html.erb
| ... | ... | @@ -12,7 +12,7 @@ |
| 12 | 12 | <h2><%= t('latest_projects') %></h2> |
| 13 | 13 | |
| 14 | 14 | <ul> |
| 15 | - <% cache do %> | |
| 15 | + <% cache action_suffix: 'latest_projects' do %> | |
| 16 | 16 | <% @latest_projects.each do |project| %> |
| 17 | 17 | <li><%= link_to(project.name, project_path(project.id)) %></li> |
| 18 | 18 | <% end %> |
| ... | ... | @@ -23,7 +23,7 @@ |
| 23 | 23 | <h2><%= t('latest_repositories') %></h2> |
| 24 | 24 | |
| 25 | 25 | <ul> |
| 26 | - <% cache do %> | |
| 26 | + <% cache action_suffix: 'latest_repositories' do %> | |
| 27 | 27 | <% @latest_repositories.each do |repository| %> |
| 28 | 28 | <li><%= link_to(repository.name, repository_path(repository.id)) %></li> |
| 29 | 29 | <% end %> |
| ... | ... | @@ -34,7 +34,7 @@ |
| 34 | 34 | <h2><%= t('latest_configurations') %></h2> |
| 35 | 35 | |
| 36 | 36 | <ul> |
| 37 | - <% cache do %> | |
| 37 | + <% cache action_suffix: 'latest_configurations' do %> | |
| 38 | 38 | <% @latest_configurations.each do |configuration| %> |
| 39 | 39 | <li><%= link_to(configuration.name, kalibro_configuration_path(configuration.id)) %></li> |
| 40 | 40 | <% end %> | ... | ... |
features/homepage.feature
| ... | ... | @@ -3,7 +3,9 @@ Feature: Homepage |
| 3 | 3 | As a regular user |
| 4 | 4 | I want to have in one page useful links to manage my account and session |
| 5 | 5 | |
| 6 | + @kalibro_processor_restart | |
| 6 | 7 | Scenario: Before signing in |
| 8 | + Given I have a project named "GCC" | |
| 7 | 9 | Then I am at the homepage |
| 8 | 10 | And I should see "Home" |
| 9 | 11 | And I should see "Project" |
| ... | ... | @@ -16,6 +18,7 @@ Feature: Homepage |
| 16 | 18 | And I should see "Latest projects" |
| 17 | 19 | And I should see "Latest repositories" |
| 18 | 20 | And I should see "Latest configurations" |
| 21 | + Then I should see "GCC" only "1" times | |
| 19 | 22 | |
| 20 | 23 | Scenario: Signed in |
| 21 | 24 | Given I am a regular user | ... | ... |
features/step_definitions/homepage_steps.rb
| ... | ... | @@ -12,4 +12,8 @@ end |
| 12 | 12 | |
| 13 | 13 | Then(/^I should see "(.+)"$/) do |text| |
| 14 | 14 | expect(page).to have_content(text) |
| 15 | -end | |
| 16 | 15 | \ No newline at end of file |
| 16 | +end | |
| 17 | + | |
| 18 | +Then(/^I should see "(.*?)" only "(.*?)" times$/) do |text, times| | |
| 19 | + expect(page).to have_content(text, count: times.to_i) | |
| 20 | +end | ... | ... |