BikeBikeBike/test/controllers/locations_controller_test.rb

50 lines
1.2 KiB
Ruby
Raw Normal View History

2014-03-09 14:43:33 -06:00
require 'test_helper'
class LocationsControllerTest < ActionController::TestCase
setup do
@location = locations(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:locations)
end
test "should get new" do
get :new
assert_response :success
end
test "should create location" do
assert_difference('Location.count') do
post :create, location: { address: @location.address, latitude: @location.latitude, longitude: @location.longitude, title: @location.title }
end
assert_redirected_to location_path(assigns(:location))
end
test "should show location" do
get :show, id: @location
assert_response :success
end
test "should get edit" do
get :edit, id: @location
assert_response :success
end
test "should update location" do
patch :update, id: @location, location: { address: @location.address, latitude: @location.latitude, longitude: @location.longitude, title: @location.title }
assert_redirected_to location_path(assigns(:location))
end
test "should destroy location" do
assert_difference('Location.count', -1) do
delete :destroy, id: @location
end
assert_redirected_to locations_path
end
end