Files
growstuff/spec/controllers/places_controller_spec.rb
Joseph Caudle a43d3a1ce7 Add places pages
This commit builds off of @Skud's spike on locations and largely takes
off from the `nearby_members` feature which previously existed on
members.

One thing to note is that we needed to add a search route and action to
`PlacesController` to account for requests of new places as they could
not be redirected to properly from within `PlacesController#show`.

[Story #53848631]
2013-08-02 00:15:51 -04:00

32 lines
931 B
Ruby

require 'spec_helper'
describe PlacesController do
before :each do
controller.stub(:current_member) { nil }
end
describe "GET show" do
before(:each) do
@member_london = FactoryGirl.create(:london_member)
@member_south_pole = FactoryGirl.create(:south_pole_member)
end
it "assigns nearby members if a location is set" do
get :show, { :place => @member_london.location }
assigns(:nearby_members).should include @member_london
end
it "does not assign far members if a location is set" do
get :show, { :place => @member_london.location }
assigns(:nearby_members).should_not include @member_south_pole
end
end
describe "GET search" do
it "redirects to the new place" do
get :search, { :new_place => "foo", :distance => 1000, :units => "mi" }
response.should redirect_to place_path("foo", :distance => 1000, :units => "mi")
end
end
end