Permalink
Browse files

Fixed places test, closes #8

  • Loading branch information...
1 parent 0342290 commit bf29e2769f7b5825a8b5dedab7985ab4a6caf8cb @juanignaciosl juanignaciosl committed May 1, 2012
@@ -1,4 +1,5 @@
class Backend::PlacesController < BackendController
+
# GET /places
# GET /places.json
def index
View
@@ -1,5 +1,4 @@
class Place < ActiveRecord::Base
- attr_accessible :address, :map, :name, :url, :city_id
belongs_to :city
View
@@ -17,13 +17,13 @@ development: &config
encoding: unicode
pool: 5
username: postgres
- password:
+ password: postgres
database: ntd_development
# Connect on a TCP socket. Omitted by default since the client uses a
# domain socket that doesn't need configuration. Windows does not have
# domain sockets, so uncomment these lines.
- #host: localhost
+ host: localhost
#port: 5432
# Schema search path. The server defaults to $user,public
View
@@ -6,5 +6,7 @@
address "MyString"
url "MyString"
map "MyString"
+
+ city
end
end
@@ -1,9 +1,11 @@
require 'test_helper'
+require File.join(File.dirname(__FILE__), 'backend_test_case')
-class PlacesControllerTest < ActionController::TestCase
- setup do
- @place = places(:one)
- end
+class Backend::PlacesControllerTest < ActionController::TestCase
+ include BackendTestCase
+
+ setup { @place = FactoryGirl.create(:place) }
+ teardown { Place.delete_all }
test "should get index" do
get :index
@@ -18,10 +20,10 @@ class PlacesControllerTest < ActionController::TestCase
test "should create place" do
assert_difference('Place.count') do
- post :create, place: { }
+ post :create, place: @place.attributes
end
- assert_redirected_to place_path(assigns(:place))
+ assert_redirected_to backend_place_path(assigns(:place))
end
test "should show place" do
@@ -36,14 +38,14 @@ class PlacesControllerTest < ActionController::TestCase
test "should update place" do
put :update, id: @place, place: { }
- assert_redirected_to place_path(assigns(:place))
+ assert_redirected_to backend_place_path(assigns(:place))
end
test "should destroy place" do
assert_difference('Place.count', -1) do
delete :destroy, id: @place
end
- assert_redirected_to places_path
+ assert_redirected_to backend_places_path
end
end

0 comments on commit bf29e27

Please sign in to comment.