Permalink
Browse files

spec acceptance: explore page is passing

  • Loading branch information...
1 parent f490c0a commit b397c72c122ea503b026bd6a05a3daa8154bdd23 @josemarluedke josemarluedke committed May 9, 2012
Showing with 223 additions and 230 deletions.
  1. +41 −41 acceptance/explore_spec.rb
  2. +2 −0 config/locales/en.yml
  3. +180 −189 config/locales/pt.yml
View
@@ -9,7 +9,7 @@
#Categories
category_1 = Factory(:category)
category_2 = Factory(:category)
-
+
# Recommended projects (some of them expired)
10.times do
Factory(:project, created_at: 30.days.ago, expires_at: 30.days.from_now, visible: true, recommended: true, category: category_1)
@@ -27,15 +27,15 @@
for days in 1..10 do
Factory(:project, created_at: days.days.ago, expires_at: 30.days.from_now, visible: true, recommended: false, category: category_2)
end
-
+
# Successful projects
for days in 1..10 do
- project = Factory(:project, created_at: 30.days.ago, expires_at: days.days.ago, visible: true, recommended: false, category: category_2)
+ project = Factory(:project, created_at: 30.days.ago, expires_at: days.days.ago, visible: true, recommended: false, category: category_2, successful: true)
Factory(:backer, project: project, value: project.goal, confirmed: true)
end
-
+
end
-
+
scenario "When I visit explore projects, it should show the correct projects" do
categories = Category.with_projects.order(:name).all
@@ -44,26 +44,26 @@
recent = Project.visible.recent.not_expired.limit(16).order('created_at DESC').all
successful = Project.visible.successful.order('expires_at DESC').all
search = Project.visible.where("name ILIKE '%eird%'").order('created_at DESC').all
-
+
visit homepage
verify_translations
-
- click_on "Explore os projetos"
+
+ click_on "explore"
verify_translations
-
+
within 'head title' do
page.should have_content("Explore os projetos · #{I18n.t('site.name')}")
end
quick_list = find("#explore_quick").all("li")
- quick_list[0].text.should == "Recomendados".upcase
- quick_list[1].text.should == "Na reta final".upcase
- quick_list[2].text.should == "Recentes".upcase
- quick_list[3].text.should == "Bem-sucedidos".upcase
-
+ quick_list[0].text.should == "Recomendados"
+ quick_list[1].text.should == "Na reta final"
+ quick_list[2].text.should == "Recentes"
+ quick_list[3].text.should == "Bem-sucedidos"
+
categories_list = find("#explore_categories").all("li")
categories_list.each_index do |index|
- categories_list[index].text.should == categories[index].name.upcase
+ categories_list[index].text.should == categories[index].name
end
# It should be already on recommended projects
@@ -73,10 +73,10 @@
list[index].find("a")[:href].should match(/\/projects\/#{recommended[index].to_param}/)
end
end
- find('#explore_menu .selected').text.should == "Recomendados".upcase
-
+ find('.sidebar .content .selected').text.should == "Recomendados"
+
# Now I go to expiring projects
- within "#explore_menu" do
+ within ".sidebar .content" do
click_on "Na reta final"
end
verify_translations
@@ -86,10 +86,10 @@
list[index].find("a")[:href].should match(/\/projects\/#{expiring[index].to_param}/)
end
end
- find('#explore_menu .selected').text.should == "Na reta final".upcase
-
+ find('.sidebar .content .selected').text.should == "Na reta final"
+
# Now I go to recent projects
- within "#explore_menu" do
+ within ".sidebar .content" do
click_on "Recentes"
end
verify_translations
@@ -99,10 +99,10 @@
list[index].find("a")[:href].should match(/\/projects\/#{recent[index].to_param}/)
end
end
- find('#explore_menu .selected').text.should == "Recentes".upcase
-
+ find('.sidebar .content .selected').text.should == "Recentes"
+
# Now I go to successful projects
- within "#explore_menu" do
+ within ".sidebar .content" do
click_on "Bem-sucedidos"
end
verify_translations
@@ -112,10 +112,10 @@
list[index].find("a")[:href].should match(/\/projects\/#{successful[index].to_param}/)
end
end
- find('#explore_menu .selected').text.should == "Bem-sucedidos".upcase
-
+ find('.sidebar .content .selected').text.should == "Bem-sucedidos"
+
# Now I go to recommended projects again
- within "#explore_menu" do
+ within ".sidebar .content" do
click_on "Recomendados"
end
verify_translations
@@ -125,10 +125,10 @@
list[index].find("a")[:href].should match(/\/projects\/#{recommended[index].to_param}/)
end
end
- find('#explore_menu .selected').text.should == "Recomendados".upcase
+ find('.sidebar .content .selected').text.should == "Recomendados"
# Now I search for "eird"
- within "#explore_menu" do
+ within "#header .search" do
fill_in "search", with: "eird"
end
sleep 2
@@ -139,10 +139,10 @@
list[index].find("a")[:href].should match(/\/projects\/#{search[index].to_param}/)
end
end
- page.should have_no_css('#explore_menu .selected')
+ page.should have_no_css('.sidebar .content .selected')
# Now I search for "empty search"
- within "#explore_menu" do
+ within "#header .search" do
fill_in "search", with: "empty search"
end
sleep 2
@@ -151,12 +151,12 @@
all(".project_box").empty?.should == true
page.should have_content("Ei, não encontramos nenhum projeto com o texto que você procurou. Que tal experimentar com outras palavras? =D")
end
- page.should have_no_css('#explore_menu .selected')
+ page.should have_no_css('.sidebar .content .selected')
# Now I go through every category
categories.each do |category|
projects = Project.visible.where(category_id: category.id).order('created_at DESC').all
- within "#explore_menu" do
+ within ".sidebar .content" do
click_on category.name
end
within "#explore_results" do
@@ -165,9 +165,9 @@
list[index].find("a")[:href].should match(/\/projects\/#{projects[index].to_param}/)
end
end
- find('#explore_menu .selected').text.should == category.name.upcase
+ find('.sidebar .content .selected').text.should == category.name
end
-
+
visit "/pt/explore#recommended"
verify_translations
@@ -178,7 +178,7 @@
list[index].find("a")[:href].should match(/\/projects\/#{projects[index].to_param}/)
end
end
- find('#explore_menu .selected').text.should == "Recomendados".upcase
+ find('.sidebar .content .selected').text.should == "Recomendados"
visit "/pt/explore#expiring"
verify_translations
@@ -190,8 +190,8 @@
list[index].find("a")[:href].should match(/\/projects\/#{projects[index].to_param}/)
end
end
- find('#explore_menu .selected').text.should == "Na reta final".upcase
-
+ find('.sidebar .content .selected').text.should == "Na reta final"
+
visit "/pt/explore#recent"
verify_translations
@@ -202,8 +202,8 @@
list[index].find("a")[:href].should match(/\/projects\/#{projects[index].to_param}/)
end
end
- find('#explore_menu .selected').text.should == "Recentes".upcase
-
+ find('.sidebar .content .selected').text.should == "Recentes"
+
visit "/pt/explore#successful"
verify_translations
@@ -214,7 +214,7 @@
list[index].find("a")[:href].should match(/\/projects\/#{projects[index].to_param}/)
end
end
- find('#explore_menu .selected').text.should == "Bem-sucedidos".upcase
+ find('.sidebar .content .selected').text.should == "Bem-sucedidos"
end
View
@@ -296,6 +296,8 @@ en:
successful: Successful
title: "Discover amazing projects"
title: "Explore the projects"
+ project:
+ empty: "Hey, we didn't find any project with the text you searched. Wanna try some new words? =D"
formtastic:
hints:
backer:
Oops, something went wrong.

0 comments on commit b397c72

Please sign in to comment.