Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danpalmer committed Feb 16, 2014
1 parent 5af4edc commit 63175d6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions test/controllers/menus_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@ class MenusControllerTest < ActionController::TestCase
test "should not create menu without auth" do
as_nobody
assert_raise(CanCan::AccessDenied) {
post :create, menu: { }
post :create, menu: { place_id: @menu.place_id }
}
end

test "should not create menu without permission" do
as_user
assert_raise(CanCan::AccessDenied) {
post :create, menu: { }
post :create, menu: { place_id: @menu.place_id }
}
end

test "should create menu" do
as_admin
assert_difference('Menu.count') do
post :create, menu: { }
post :create, menu: { place_id: @menu.place_id }
end

assert_redirected_to menu_path(assigns(:menu))
Expand Down Expand Up @@ -82,20 +82,20 @@ class MenusControllerTest < ActionController::TestCase
test "should not update menu without auth" do
as_nobody
assert_raise(CanCan::AccessDenied) {
patch :update, id: @menu, menu: { }
patch :update, id: @menu, menu: { place_id: @menu.place_id }
}
end

test "should not update menu without permission" do
as_user
assert_raise(CanCan::AccessDenied) {
patch :update, id: @menu, menu: { }
patch :update, id: @menu, menu: { place_id: @menu.place_id }
}
end

test "should update menu" do
as_admin
patch :update, id: @menu, menu: { }
patch :update, id: @menu, menu: { place_id: @menu.place_id }
assert_redirected_to menu_path(assigns(:menu))
end

Expand Down
12 changes: 6 additions & 6 deletions test/controllers/services_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@ class ServicesControllerTest < ActionController::TestCase
test "should not create service without auth" do
as_nobody
assert_raise(CanCan::AccessDenied) {
post :create, service: { }
post :create, service: { name: @service.name, description: @service.description, location: @service.location }
}
end

test "should not create service without permission" do
as_user
assert_raise(CanCan::AccessDenied) {
post :create, service: { }
post :create, service: { name: @service.name, description: @service.description, location: @service.location }
}
end

test "should create service" do
as_admin
assert_difference('Service.count') do
post :create, service: { }
post :create, service: { name: @service.name, description: @service.description, location: @service.location }
end

assert_redirected_to service_path(assigns(:service))
Expand Down Expand Up @@ -82,20 +82,20 @@ class ServicesControllerTest < ActionController::TestCase
test "should not update service without auth" do
as_nobody
assert_raise(CanCan::AccessDenied) {
patch :update, id: @service, service: { }
patch :update, id: @service, service: { name: @service.name, description: @service.description, location: @service.location }
}
end

test "should not update service without permission" do
as_user
assert_raise(CanCan::AccessDenied) {
patch :update, id: @service, service: { }
patch :update, id: @service, service: { name: @service.name, description: @service.description, location: @service.location }
}
end

test "should update service" do
as_admin
patch :update, id: @service, service: { }
patch :update, id: @service, service: { name: @service.name, description: @service.description, location: @service.location }
assert_redirected_to service_path(assigns(:service))
end

Expand Down

0 comments on commit 63175d6

Please sign in to comment.