aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/about_routes_test.rb30
-rw-r--r--test/integration/arches_routes_test.rb25
-rw-r--r--test/integration/categories_routes_test.rb10
-rw-r--r--test/integration/feeds_test.rb29
-rw-r--r--test/integration/main_routes_test.rb15
-rw-r--r--test/integration/packages_routes_test.rb51
-rw-r--r--test/integration/useflag_routes_test.rb25
7 files changed, 185 insertions, 0 deletions
diff --git a/test/integration/about_routes_test.rb b/test/integration/about_routes_test.rb
new file mode 100644
index 0000000..56c36a3
--- /dev/null
+++ b/test/integration/about_routes_test.rb
@@ -0,0 +1,30 @@
+require 'test_helper'
+
+class AboutRoutesTest < ActionDispatch::IntegrationTest
+
+ test "can see the about page" do
+ get "/about"
+ assert_select "h1", "About packages.gentoo.org"
+ end
+
+ test "can see the feedback page" do
+ get "/about/feedback"
+ assert_select "h1", "Feedback"
+ end
+
+ test "can see the about feeds page" do
+ get "/about/feeds"
+ assert_select "h1", "Update Feeds"
+ end
+
+ test "can see the about help page" do
+ get "/about/help"
+ assert_select "h1", "Help"
+ end
+
+ test "can see the changelog page" do
+ get "/about/changelog"
+ assert_select "h1", "Changelog"
+ end
+
+end
diff --git a/test/integration/arches_routes_test.rb b/test/integration/arches_routes_test.rb
new file mode 100644
index 0000000..2e673e2
--- /dev/null
+++ b/test/integration/arches_routes_test.rb
@@ -0,0 +1,25 @@
+require 'test_helper'
+
+class ArchesRoutesTest < ActionDispatch::IntegrationTest
+ test "can see the arches page" do
+ get "/arches"
+ assert_select "h1", "Architectures"
+ end
+
+ test "view keyworded packages for arch" do
+ arches = %w(alpha amd64 arm arm64 hppa ia64 ppc ppc64 sparc x86)
+ arches.each { |arch|
+ get ("/arches/" + arch + "/keyworded")
+ assert_select "h1", ("Keyworded Packages (" + arch + ")")
+ }
+ end
+
+ test "view stable packages for arch" do
+ arches = %w(alpha amd64 arm arm64 hppa ia64 ppc ppc64 sparc x86)
+ arches.each { |arch|
+ get ("/arches/" + arch + "/stable")
+ assert_select "h1", ("Newly Stable Packages (" + arch + ")")
+ }
+ end
+
+end
diff --git a/test/integration/categories_routes_test.rb b/test/integration/categories_routes_test.rb
new file mode 100644
index 0000000..a9f46c2
--- /dev/null
+++ b/test/integration/categories_routes_test.rb
@@ -0,0 +1,10 @@
+require 'test_helper'
+
+class CategoriesRoutesTest < ActionDispatch::IntegrationTest
+
+ test "can see the categories page" do
+ get "/categories"
+ assert_select "h1", "Packages"
+ end
+
+end
diff --git a/test/integration/feeds_test.rb b/test/integration/feeds_test.rb
new file mode 100644
index 0000000..12a9c2f
--- /dev/null
+++ b/test/integration/feeds_test.rb
@@ -0,0 +1,29 @@
+require 'test_helper'
+
+class FeedsTest < ActionDispatch::IntegrationTest
+
+ test "can see the added packages feed" do
+ get '/packages/added.atom'
+ assert_response :success
+ assert_equal 'application/atom+xml; charset=utf-8', @response.content_type
+ end
+
+ test "can see the updates packages feed" do
+ get '/packages/updated.atom'
+ assert_response :success
+ assert_equal 'application/atom+xml; charset=utf-8', @response.content_type
+ end
+
+ test "can see the newly stable packages feed" do
+ get '/packages/stable.atom'
+ assert_response :success
+ assert_equal 'application/atom+xml; charset=utf-8', @response.content_type
+ end
+
+ test "can see the keyworded packages feed" do
+ get '/packages/keyworded.atom'
+ assert_response :success
+ assert_equal 'application/atom+xml; charset=utf-8', @response.content_type
+ end
+
+end
diff --git a/test/integration/main_routes_test.rb b/test/integration/main_routes_test.rb
new file mode 100644
index 0000000..71803aa
--- /dev/null
+++ b/test/integration/main_routes_test.rb
@@ -0,0 +1,15 @@
+require 'test_helper'
+
+class MainRoutesTest < ActionDispatch::IntegrationTest
+ test "view landing page" do
+ get "/"
+ assert_select "h2", "Welcome to the Home of 1 Gentoo Packages"
+ end
+
+ test "test route not present" do
+ assert_raises(ActionController::RoutingError) do
+ get '/larry'
+ end
+ end
+
+end
diff --git a/test/integration/packages_routes_test.rb b/test/integration/packages_routes_test.rb
new file mode 100644
index 0000000..465af4b
--- /dev/null
+++ b/test/integration/packages_routes_test.rb
@@ -0,0 +1,51 @@
+require 'test_helper'
+
+class PackagesRoutesTest < ActionDispatch::IntegrationTest
+
+ test "packages landing page" do
+ get "/packages"
+ assert_response :redirect
+ follow_redirect!
+ assert_response :success
+ assert_select "h1", "Packages"
+ end
+
+ test "view existing package" do
+ get "/packages/virtual/packages"
+ assert_select ".kk-package-name", "packages"
+ end
+
+ test "search for non existing package" do
+ get "/packages/search?q=larry"
+ assert_select "h2", "Nothing found. :( Try again?"
+ end
+
+ test "search for existing package" do
+ get "/packages/search?q=packages"
+ assert_response :redirect
+ follow_redirect!
+ assert_response :success
+ assert_select ".kk-package-name", "packages"
+ end
+
+ test "added package page" do
+ get "/packages/added"
+ assert_select "h1", "Added Packages"
+ end
+
+ test "updated package page" do
+ get "/packages/updated"
+ assert_select "h1", "Updated Packages"
+ end
+
+ test "newly stable packages page" do
+ get "/packages/stable"
+ assert_select "h1", "Newly Stable Packages"
+ end
+
+ test "keyworded packages page" do
+ get "/packages/keyworded"
+ assert_select "h1", "Keyworded Packages"
+ end
+
+end \ No newline at end of file
diff --git a/test/integration/useflag_routes_test.rb b/test/integration/useflag_routes_test.rb
new file mode 100644
index 0000000..3ed5718
--- /dev/null
+++ b/test/integration/useflag_routes_test.rb
@@ -0,0 +1,25 @@
+require 'test_helper'
+
+class UseflagRoutesTest < ActionDispatch::IntegrationTest
+
+ test "can see the useflags page" do
+ get "/useflags"
+ assert_select "h1", "USE flags"
+ end
+
+ test "search for multiple existing useflag" do
+ get "/useflags/search?q=systemd"
+ assert_select "h1", "USE Flag Search Results for systemd"
+ end
+
+ test "search for non existing useflag" do
+ get "/useflags/search?q=larry"
+ assert_select "h1", "USE Flag Search Results for larry"
+ end
+
+ test "view existing useflag" do
+ get "/useflags/systemd"
+ assert_select "h1", "systemd"
+ end
+
+end