moves highlights and default home page

This commit is contained in:
Juanjo Bazán
2015-09-14 19:49:09 +02:00
parent b199ad233c
commit e5531aba87
9 changed files with 40 additions and 28 deletions

View File

@@ -5,7 +5,7 @@ class WelcomeController < ApplicationController
def index def index
if current_user if current_user
redirect_to :highlights redirect_to :proposals
end end
end end

View File

@@ -27,7 +27,7 @@ es:
locale: "Idioma:" locale: "Idioma:"
administration: Administrar administration: Administrar
moderation: Moderar moderation: Moderar
highlights: "Destacados" highlights: "Portada"
more_information: "Más información" more_information: "Más información"
debates: Debates debates: Debates
proposals: Propuestas ciudadanas proposals: Propuestas ciudadanas

View File

@@ -16,7 +16,7 @@ feature 'Admin' do
visit admin_root_path visit admin_root_path
expect(current_path).not_to eq(admin_root_path) expect(current_path).not_to eq(admin_root_path)
expect(current_path).to eq(highlights_path) expect(current_path).to eq(proposals_path)
expect(page).to have_content "not authorized" expect(page).to have_content "not authorized"
end end
@@ -25,7 +25,7 @@ feature 'Admin' do
visit admin_root_path visit admin_root_path
expect(current_path).not_to eq(admin_root_path) expect(current_path).not_to eq(admin_root_path)
expect(current_path).to eq(highlights_path) expect(current_path).to eq(proposals_path)
expect(page).to have_content "not authorized" expect(page).to have_content "not authorized"
end end

View File

@@ -238,7 +238,7 @@ feature 'Debates' do
visit edit_debate_path(debate) visit edit_debate_path(debate)
expect(current_path).not_to eq(edit_debate_path(debate)) expect(current_path).not_to eq(edit_debate_path(debate))
expect(current_path).to eq(highlights_path) expect(current_path).to eq(proposals_path)
expect(page).to have_content 'not authorized' expect(page).to have_content 'not authorized'
end end
@@ -251,7 +251,7 @@ feature 'Debates' do
visit edit_debate_path(debate) visit edit_debate_path(debate)
expect(current_path).not_to eq(edit_debate_path(debate)) expect(current_path).not_to eq(edit_debate_path(debate))
expect(current_path).to eq(highlights_path) expect(current_path).to eq(proposals_path)
expect(page).to have_content 'not authorized' expect(page).to have_content 'not authorized'
end end

View File

@@ -0,0 +1,25 @@
require 'rails_helper'
feature "Highlights" do
scenario 'Debates and proposals order by hot_score' do
create(:debate, title: 'best debate 100').update_column(:hot_score, 100)
create(:debate, title: 'worst debate 50').update_column(:hot_score, 50)
create(:debate, title: 'medium debate 70').update_column(:hot_score, 70)
create(:proposal, title: 'best proposal 90').update_column(:hot_score, 90)
create(:proposal, title: 'worst proposal 60').update_column(:hot_score, 60)
create(:proposal, title: 'medium proposal 80').update_column(:hot_score, 80)
login_as(create(:user))
visit highlights_path
expect('best debate 100').to appear_before('best proposal 90')
expect('best proposal 90').to appear_before('medium proposal 80')
expect('medium proposal 80').to appear_before('medium debate 70')
expect('medium debate 70').to appear_before('worst proposal 60')
expect('worst proposal 60').to appear_before('worst debate 50')
end
end

View File

@@ -11,24 +11,11 @@ feature "Home" do
end end
feature "For signed in users" do feature "For signed in users" do
scenario 'Debates and proposals order by hot_score' do scenario 'Redirect to proposals' do
create(:debate, title: 'best debate 100').update_column(:hot_score, 100)
create(:debate, title: 'worst debate 50').update_column(:hot_score, 50)
create(:debate, title: 'medium debate 70').update_column(:hot_score, 70)
create(:proposal, title: 'best proposal 90').update_column(:hot_score, 90)
create(:proposal, title: 'worst proposal 60').update_column(:hot_score, 60)
create(:proposal, title: 'medium proposal 80').update_column(:hot_score, 80)
login_as(create(:user)) login_as(create(:user))
visit root_path visit root_path
expect('best debate 100').to appear_before('best proposal 90') expect(current_path).to eq proposals_path
expect('best proposal 90').to appear_before('medium proposal 80')
expect('medium proposal 80').to appear_before('medium debate 70')
expect('medium debate 70').to appear_before('worst proposal 60')
expect('worst proposal 60').to appear_before('worst debate 50')
end end
end end

View File

@@ -11,7 +11,7 @@ feature 'Admin' do
visit moderation_root_path visit moderation_root_path
expect(current_path).not_to eq(moderation_root_path) expect(current_path).not_to eq(moderation_root_path)
expect(current_path).to eq(highlights_path) expect(current_path).to eq(proposals_path)
expect(page).to have_content "not authorized" expect(page).to have_content "not authorized"
end end

View File

@@ -303,7 +303,7 @@ feature 'Proposals' do
visit edit_proposal_path(proposal) visit edit_proposal_path(proposal)
expect(current_path).not_to eq(edit_proposal_path(proposal)) expect(current_path).not_to eq(edit_proposal_path(proposal))
expect(current_path).to eq(highlights_path) expect(current_path).to eq(proposals_path)
expect(page).to have_content 'not authorized' expect(page).to have_content 'not authorized'
end end
@@ -318,7 +318,7 @@ feature 'Proposals' do
visit edit_proposal_path(proposal) visit edit_proposal_path(proposal)
expect(current_path).not_to eq(edit_proposal_path(proposal)) expect(current_path).not_to eq(edit_proposal_path(proposal))
expect(current_path).to eq(highlights_path) expect(current_path).to eq(proposals_path)
expect(page).to have_content 'not authorized' expect(page).to have_content 'not authorized'
end end

View File

@@ -15,7 +15,7 @@ feature "Welcome screen" do
login_through_form_as(user) login_through_form_as(user)
expect(current_path).to eq(highlights_path) expect(current_path).to eq(proposals_path)
end end
scenario 'is not shown to organizations' do scenario 'is not shown to organizations' do
@@ -23,7 +23,7 @@ feature "Welcome screen" do
login_through_form_as(organization.user) login_through_form_as(organization.user)
expect(current_path).to eq(highlights_path) expect(current_path).to eq(proposals_path)
end end
scenario 'it is not shown to level-2 users' do scenario 'it is not shown to level-2 users' do
@@ -31,7 +31,7 @@ feature "Welcome screen" do
login_through_form_as(user) login_through_form_as(user)
expect(current_path).to eq(highlights_path) expect(current_path).to eq(proposals_path)
end end
scenario 'it is not shown to level-3 users' do scenario 'it is not shown to level-3 users' do
@@ -39,7 +39,7 @@ feature "Welcome screen" do
login_through_form_as(user) login_through_form_as(user)
expect(current_path).to eq(highlights_path) expect(current_path).to eq(proposals_path)
end end
end end