mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-14 11:15:48 -04:00
rearranged crop page headings and added tests
This commit is contained in:
@@ -16,9 +16,7 @@
|
||||
|
||||
= render :partial => 'photos', :locals => { :crop => @crop }
|
||||
|
||||
%h2 Who's planted this crop?
|
||||
|
||||
%p
|
||||
%h2
|
||||
- if @crop.plantings.size > 0
|
||||
= @crop.name.titleize
|
||||
has been planted
|
||||
@@ -27,9 +25,18 @@
|
||||
- else
|
||||
Nobody is growing this yet. You could be the first!
|
||||
|
||||
%p
|
||||
Only plantings by members who have set their locations are shown on this map.
|
||||
- if current_member && current_member.location.blank?
|
||||
= link_to "Set your location.", edit_member_registration_path
|
||||
|
||||
|
||||
%div#map
|
||||
|
||||
- if @crop.plantings.size > 0
|
||||
|
||||
%h2 All plantings
|
||||
|
||||
- @crop.plantings.each do |p|
|
||||
= render :partial => "plantings/thumbnail", :locals => { :planting => p, :title => 'owner' }
|
||||
|
||||
|
||||
@@ -33,6 +33,35 @@ describe "crops/show" do
|
||||
end
|
||||
end
|
||||
|
||||
context "map" do
|
||||
it "has a map" do
|
||||
render
|
||||
assert_select("div#map")
|
||||
end
|
||||
|
||||
it "explains what's shown on the map" do
|
||||
render
|
||||
rendered.should contain "Only plantings by members who have set their locations are shown on this map"
|
||||
end
|
||||
|
||||
it "shows a 'set your location' link to people who need to" do
|
||||
@nowhere = FactoryGirl.create(:member)
|
||||
sign_in @nowhere
|
||||
controller.stub(:current_user) { @nowhere }
|
||||
render
|
||||
rendered.should contain "Set your location"
|
||||
end
|
||||
|
||||
it "doesn't show 'set your location' to people who have one" do
|
||||
@somewhere = FactoryGirl.create(:london_member)
|
||||
sign_in @somewhere
|
||||
controller.stub(:current_user) { @somewhere }
|
||||
render
|
||||
rendered.should_not contain "Set your location"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
it "shows the wikipedia URL" do
|
||||
render
|
||||
assert_select("a[href=#{@crop.en_wikipedia_url}]", 'Wikipedia (English)')
|
||||
|
||||
Reference in New Issue
Block a user