add a couple of tests for the tag limit feature

This commit is contained in:
David Gil
2015-08-11 23:56:16 +02:00
parent 06d8c96d54
commit 41e5496d2b

View File

@@ -130,4 +130,37 @@ feature 'Debates' do
expect(page).to have_content "Let's..."
end
describe 'Limiting tags shown' do
let(:all_tags) {
["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa", "Huelgas"]
}
let(:debate) {
create :debate, tag_list: all_tags
}
scenario 'Index page show up to 5 tags per debate' do
debate
visible_tags = ["Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa", "Huelgas"]
visit debates_path
expect(page).to have_selector('.debate', count: 1)
within('.debate') do
visible_tags.each do |tag|
expect(page).to have_content tag
end
expect(page).to have_content '2+'
end
end
scenario 'Debate#show shows the full tag list' do
visit debate_path(debate)
within("#debate-#{debate.id}") do
all_tags.each do |tag|
expect(page).to have_content tag
end
end
end
end
end