match "/user/:display_name/diary" => "diary_entry#list", :via => :get
match "/diary/:language" => "diary_entry#list", :via => :get
match "/diary" => "diary_entry#list", :via => :get
- match "/user/:display_name/diary/:id" => "diary_entry#view", :via => :get, :id => /\d+/
+ match "/user/:display_name/diary/:id" => "diary_entry#view", :via => :get, :id => /\d+/, :as => :diary_entry
match "/user/:display_name/diary/:id/newcomment" => "diary_entry#comment", :via => :post, :id => /\d+/
match "/user/:display_name/diary/:id/edit" => "diary_entry#edit", :via => [:get, :post], :id => /\d+/
match "/user/:display_name/diary/:id/hide" => "diary_entry#hide", :via => :post, :id => /\d+/, :as => :hide_diary_entry
--- /dev/null
+require "test_helper"
+
+class CanAccessHomeTest < Capybara::Rails::TestCase
+ def setup
+ stub_hostip_requests
+ end
+
+ def test_it_works
+ visit root_path
+ assert page.has_content? "BOpenStreetMap"
+ end
+end
--- /dev/null
+require "test_helper"
+
+class ReportDiaryEntryTest < Capybara::Rails::TestCase
+ def setup
+ create(:language, :code => "en")
+ @diary_entry = create(:diary_entry)
+ end
+
+ def test_it_works
+ sign_in_as(create(:user))
+ visit diary_entry_path(@diary_entry.user.display_name, @diary_entry)
+ assert page.has_content? @diary_entry.title
+
+ click_on "\u2690"
+ assert page.has_content? "Report"
+ assert page.has_content? I18n.t("issues.new.disclaimer.intro")
+
+ choose "report_type__SPAM" # FIXME: use label text when the radio button labels are working
+ fill_in "report_details", :with => "This is advertising"
+ click_on "Save changes"
+
+ assert page.has_content? "Your report has been registered sucessfully"
+ end
+end
require File.expand_path("../../config/environment", __FILE__)
require "rails/test_help"
require "webmock/minitest"
+require "minitest/rails/capybara"
module ActiveSupport
class TestCase
end
end
end
+
+ def sign_in_as(user)
+ stub_hostip_requests
+ visit login_path
+ fill_in "username", :with => user.email
+ fill_in "password", :with => "test"
+ click_on "Login", :match => :first
+ end
end
end