Permalink
Browse files

A bunch of functional test fixes

  • Loading branch information...
1 parent 138644c commit c5d78f5196fcbd677956b48da5eac71d6c07b713 @frankieroberto frankieroberto committed Apr 8, 2012
View
0 app/views/plaques_latest/show.html.erb
No changes.
View
16 test/functional/plaques_latest_controller_test.rb
@@ -2,14 +2,14 @@
class PlaquesLatestControllerTest < ActionController::TestCase
- context "when viewing the latest plaques page" do
-
- setup { get :show }
-
- should respond_with :success
- should assign_to :plaques
- should render_template :show
-
+ test "viewing the latest plaques page" do
+
+ get :show
+
+ assert_response :success
+ assert_not_nil assigns(:plaques)
+ assert_template :show
+
end
end
View
12 test/functional/plaques_map_controller_test.rb
@@ -2,14 +2,10 @@
class PlaquesMapControllerTest < ActionController::TestCase
- context "when viewing the plaques map page" do
-
- setup { get :show }
-
- should respond_with :success
- should assign_to :plaques
- should render_template :show
-
+ test "viewing the plaques map page" do
+ get :show
+ assert_response :success
+ assert_template :show
end
View
13 test/functional/roles_by_index_controller_test.rb
@@ -9,13 +9,10 @@ class RolesByIndexControllerTest < ActionController::TestCase
should assign_to :roles
end
- context "when viewing the listing page for roles beginning with non-valid character" do
-
- should "raise a not-found error" do
- assert_raises(ActiveRecord::RecordNotFound) { get :show, :id => "|" }
- end
-
+ test "viewing the listing page for roles beginning with non-valid character" do
+ get :show, :id => "|"
+ assert_response :missing
end
-
-
+
+
end
View
17 test/functional/unphotographed_plaques_by_country_controller_test.rb
@@ -3,22 +3,19 @@
class UnphotographedPlaquesByCountryControllerTest < ActionController::TestCase
context "when viewing the page for unphotographed plaques in a particular country" do
-
+
setup { get :show, :country_id => countries(:gb).alpha2 }
-
+
should respond_with :success
should assign_to :plaques
should render_template :show
-
- end
- context "when viewing the page for unphotographed plaques in a non-existant country" do
-
- should "raise a not-found error" do
- assert_raises(ActiveRecord::RecordNotFound) { get :show, :country_id => "xxxxx" }
- end
+ end
- end
+ test "viewing the page for unphotographed plaques in a non-existant country" do
+ get :show, :country_id => "xxxxx"
+ assert_response :missing
+ end
end
View
22 test/functional/users_controller_test.rb
@@ -14,14 +14,16 @@ class UsersControllerTest < ActionController::TestCase
should assign_to :user
end
-
+
context "when viewing a non-existant user's page" do
- should "raise a not-found error" do
- assert_raises(ActiveRecord::RecordNotFound) { get :show, :id => "xxxxx" }
- end
+ setup { get :show, :id => "xxxxx" }
+
+ should "show a not found page" do
+ assert_response :missing
+ end
- end
+ end
context "when viewing the page listing users" do
@@ -30,8 +32,8 @@ class UsersControllerTest < ActionController::TestCase
should respond_with :success
should render_template :index
- should assign_to :users
-
+ should assign_to :users
+
end
context "when viewing the page listing ALL users" do
@@ -40,10 +42,10 @@ class UsersControllerTest < ActionController::TestCase
should respond_with :success
should render_template :index
- should assign_to :users
-
+ should assign_to :users
+
end
end
-
+
end
View
45 test/functional/verbs_controller_test.rb
@@ -4,7 +4,7 @@ class VerbsControllerTest < ActionController::TestCase
context "when viewing the verbs index page" do
setup { get :index }
-
+
should respond_with :success
should assign_to :verbs
should render_template :index
@@ -17,59 +17,56 @@ class VerbsControllerTest < ActionController::TestCase
should assign_to :verb
should render_template :show
end
-
- context "when requesting a verb page with a verb name that doesn't exist" do
- should "raise a not-found error" do
- assert_raises(ActiveRecord::RecordNotFound) { get :show, :id => "xxxxx" }
- end
-
- end
+ test "requesting a non-existant verb page" do
+ get :show, :id => "xxxxx"
+ assert_response :missing
+ end
context "when requesting a verb page via its id" do
setup { get :show, :id => verbs(:lived).id }
-
+
should redirect_to("verb page") { verb_path(verbs(:lived).name) }
-
- end
-
+
+ end
+
context "when logged in as a user" do
setup { sign_in users(:frankieroberto) }
-
+
context "when viewing the new verb page" do
setup { get :new }
-
+
should respond_with :success
should assign_to :verb
should render_template :new
-
+
end
-
+
context "when submitting a valid new verb" do
setup { post :create, :verb => {:name => "test"} }
-
+
should redirect_to("the page for the new verb") { verb_path("test") }
end
context "when submitting an invalid new verb" do
setup { post :create, :verb => {} }
-
+
should assign_to :verb
should render_template :new
end
-
+
end
-
+
context "when not logged in as a user" do
context "when viewing the new verb page" do
setup { get :new }
-
+
should redirect_to("login page") {new_user_session_path}
end
-
-
+
+
end
-
+
end

0 comments on commit c5d78f5

Please sign in to comment.