Compare commits

..

53 Commits

Author SHA1 Message Date
Cesy
812a6f5ec2 Merge pull request #1328 from Growstuff/dev
release 24
2017-04-28 07:31:21 +01:00
Shiny
f1b42ec699 Merge branch 'master' into dev 2017-04-25 13:14:40 +12:00
Brenda Wallace
26c17ea19c Plantings Thumbnails, fit to box 2017-04-25 10:58:17 +12:00
Brenda Wallace
acc75f80bf include harvests when retrieving data for plantings#index 2017-04-25 10:58:17 +12:00
Daniel O'Connor
a79a65363f Merge pull request #1326 from Br3nda/plantings-validators
Plantings validators
2017-04-24 17:47:41 +09:30
Shiny
dfeb4804e7 Merge branch 'dev' into plantings-validators 2017-04-23 19:35:37 +12:00
deppbot
9d20fafd06 Bundle Update on 2017-04-23 2017-04-23 19:35:23 +12:00
Shiny
e9a5ef0058 Merge branch 'dev' into plantings-validators 2017-04-22 20:50:29 +12:00
Brenda Wallace
d2378376e4 Plantings validators
Adding garden presence true.
Checks crop presence before crop approved
2017-04-22 20:48:48 +12:00
Daniel O'Connor
4b1b5d8a18 Merge pull request #1323 from Growstuff/bundle-update-2017-04-20-122131
Bundle Update on 2017-04-20
2017-04-20 15:27:04 +09:30
deppbot
a0770e80e7 Bundle Update on 2017-04-20 2017-04-20 12:21:32 +08:00
Brenda Wallace
f08e740ac6 Removed owner_matches?
it's not used anymore
2017-04-19 08:22:03 +00:00
Brenda Wallace
5f23bcfad6 Photo#show for signed in and not signed in, and other members 2017-04-19 08:22:03 +00:00
Brenda Wallace
3cd7b86c99 Photos#show links to items 2017-04-19 08:22:03 +00:00
Brenda Wallace
bd53d4a271 updating view spec - link to delete photo has changed 2017-04-19 08:22:03 +00:00
Brenda Wallace
16d88730ec controller specs for PhotoAssociations 2017-04-19 08:22:03 +00:00
Brenda Wallace
5ad88eb6bd Responsive image on photos#show 2017-04-19 08:22:03 +00:00
Brenda Wallace
b617eb3140 Deleting photo's association with another item 2017-04-19 08:22:03 +00:00
Brenda Wallace
acc4d3ad84 Only delete own associations 2017-04-19 08:22:03 +00:00
Brenda Wallace
beb3f7e2b8 Don't overwrite edited photo titles 2017-04-19 08:22:03 +00:00
Brenda Wallace
ab46a8dd96 UI for removing photos from plantings 2017-04-19 08:22:03 +00:00
Brenda Wallace
b6b578d7e6 Layout change on photos 2017-04-19 08:22:03 +00:00
Brenda Wallace
4d07cf80fa Editing title of photos 2017-04-19 08:22:03 +00:00
Brenda Wallace
93f6b65d8d bugfix: Only show harvests if we have some 2017-04-19 08:22:03 +00:00
Brenda Wallace
b40a6723e1 gardens#show Include crop, owner, harvesss and garden in query 2017-04-19 08:22:03 +00:00
Brenda Wallace
2058d28b37 Include owner in query, because we need it later 2017-04-19 08:22:03 +00:00
Brenda Wallace
682c6d6f5e Reduced query count by .includes() on plantings 2017-04-19 08:22:03 +00:00
Brenda Wallace
2be55acc92 Route for flickr auth callback -- Fixes #1106 2017-04-19 08:22:03 +00:00
Brenda Wallace
a9a040182c Rubocop compliance for members controller 2017-04-19 08:22:03 +00:00
Shiny
f39fe94173 Merge branch 'master' into dev 2017-04-18 18:27:43 +00:00
Brenda Wallace
976bdbbd96 Removed owner_matches?
it's not used anymore
2017-04-18 07:09:47 +00:00
Brenda Wallace
cff1d8bfb9 Photo#show for signed in and not signed in, and other members 2017-04-18 07:09:47 +00:00
Brenda Wallace
bbdc54cb69 Photos#show links to items 2017-04-18 07:09:47 +00:00
Brenda Wallace
36f1f7b71a updating view spec - link to delete photo has changed 2017-04-18 07:09:47 +00:00
Brenda Wallace
e1731793dd controller specs for PhotoAssociations 2017-04-18 07:09:47 +00:00
Brenda Wallace
8ea3b27612 Responsive image on photos#show 2017-04-18 07:09:47 +00:00
Brenda Wallace
9469a69078 Deleting photo's association with another item 2017-04-18 07:09:47 +00:00
Brenda Wallace
cc46fe3336 Only delete own associations 2017-04-18 07:09:47 +00:00
Brenda Wallace
52b4064a2d Don't overwrite edited photo titles 2017-04-18 07:09:47 +00:00
Brenda Wallace
d367b9ef21 UI for removing photos from plantings 2017-04-18 07:09:47 +00:00
Brenda Wallace
4711e4669f Layout change on photos 2017-04-18 07:09:47 +00:00
Brenda Wallace
3e55024f98 Editing title of photos 2017-04-18 07:09:47 +00:00
Daniel O'Connor
ccf56bf944 Merge pull request #1321 from Br3nda/harvests-display
bugfix: Only show harvests if we have some
2017-04-18 12:24:01 +09:30
Shiny
42e51a9cf6 Merge branch 'dev' into harvests-display 2017-04-17 10:00:20 +00:00
Brenda Wallace
667e0cc0e3 bugfix: Only show harvests if we have some 2017-04-17 21:59:31 +12:00
Brenda Wallace
339830b3bb gardens#show Include crop, owner, harvesss and garden in query 2017-04-17 08:59:34 +00:00
Brenda Wallace
7770164672 Include owner in query, because we need it later 2017-04-17 08:59:34 +00:00
Brenda Wallace
f333607572 Reduced query count by .includes() on plantings 2017-04-17 08:59:34 +00:00
Brenda Wallace
87d3764eeb Route for flickr auth callback -- Fixes #1106 2017-04-17 08:28:52 +00:00
Cesy
faf487b719 Merge pull request #1314 from Br3nda/members-controller
Rubocop compliance for members controller
2017-04-17 09:13:26 +01:00
Shiny
3dbf0df19e Merge branch 'dev' into members-controller 2017-04-17 03:49:54 +00:00
Shiny
cd272a6443 Merge branch 'dev' into members-controller 2017-04-16 09:44:32 +00:00
Brenda Wallace
936a8778ed Rubocop compliance for members controller 2017-04-16 12:03:48 +12:00
21 changed files with 248 additions and 103 deletions

View File

@@ -44,8 +44,6 @@ PreCommit:
command: ['npm', 'run', 'csslint']
HamlLint:
enabled: true
requires_files: true
on_warn: fail
command: ['bundle', 'exec', 'haml-lint', 'app/views']
JsonSyntax:
enabled: true

View File

@@ -109,7 +109,6 @@ Style/BarePercentLiterals:
# IgnoredMethods: lambda, proc, it
Style/BlockDelimiters:
Exclude:
- 'app/controllers/members_controller.rb'
- 'spec/controllers/order_items_controller_spec.rb'
- 'spec/features/notifications_spec.rb'
- 'spec/models/ability_spec.rb'
@@ -123,7 +122,6 @@ Style/BlockDelimiters:
# Cop supports --auto-correct.
Style/BlockEndNewline:
Exclude:
- 'app/controllers/members_controller.rb'
- 'spec/models/ability_spec.rb'
- 'spec/models/member_spec.rb'
- 'spec/models/planting_spec.rb'
@@ -223,7 +221,6 @@ Style/MultilineTernaryOperator:
# Cop supports --auto-correct.
Style/MutableConstant:
Exclude:
- 'app/controllers/members_controller.rb'
- 'app/models/planting.rb'
# Cop supports --auto-correct.

View File

@@ -25,7 +25,7 @@ GEM
addressable
active_merchant-paypal-bogus-gateway (0.1.0)
activemerchant
active_utils (3.3.3)
active_utils (3.3.4)
activesupport (>= 3.2, < 5.2.0)
i18n
activejob (4.2.8)
@@ -73,7 +73,7 @@ GEM
bootstrap-sass (3.3.7)
autoprefixer-rails (>= 5.2.1)
sass (>= 3.3.4)
bootstrap_form (2.6.0)
bootstrap_form (2.7.0)
builder (3.2.3)
bullet (5.5.1)
activesupport (>= 3.0.0)
@@ -266,7 +266,7 @@ GEM
js-routes (1.3.3)
railties (>= 3.2)
sprockets-rails
json (2.0.4)
json (2.1.0)
jwt (1.5.6)
kaminari (0.17.0)
actionpack (>= 3.0.0)
@@ -446,7 +446,7 @@ GEM
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
selenium-webdriver (3.3.0)
selenium-webdriver (3.4.0)
childprocess (~> 0.5)
rubyzip (~> 1.0)
websocket (~> 1.0)

View File

@@ -108,8 +108,6 @@ p.stats
.planting
dl.planting-attributes
font-size: 85%
dt
text-align: left
dd
@@ -118,14 +116,13 @@ p.stats
@media (min-width: $screen-md-min)
.planting-thumbnail
dl.planting-attributes
font-size: 85%
width: 100%
dt
text-align: left
width: 80px
width: 120px
dd
padding-left: 80px
padding-left: 120px
margin-left: auto
.navbar .navbar-form
@@ -336,3 +333,7 @@ $state-success-bg: lighten($green, 50%)
ul.plantings
list-style-type: none
ul.thumbnail-buttons
list-style-type: none
text-align: right

View File

@@ -14,13 +14,13 @@ class MembersController < ApplicationController
respond_to do |format|
format.html # index.html.haml
format.json {
format.json do
render json: @members.to_json(only: [
:id, :login_name,
:slug, :bio, :created_at,
:location, :latitude, :longitude
])
}
end
end
end
@@ -38,18 +38,19 @@ class MembersController < ApplicationController
respond_to do |format|
format.html # show.html.haml
format.json {
format.json do
render json: @member.to_json(only: [
:id, :login_name, :bio,
:created_at, :slug, :location,
:latitude, :longitude
])
}
format.rss {
end
format.rss do
render(
layout: false,
locals: { member: @member }
)}
)
end
end
end
@@ -66,7 +67,7 @@ class MembersController < ApplicationController
EMAIL_TYPE_STRING = {
send_notification_email: "direct message notifications",
send_planting_reminder: "planting reminders"
}
}.freeze
def unsubscribe
verifier = ActiveSupport::MessageVerifier.new(ENV['RAILS_SECRET_TOKEN'])

View File

@@ -0,0 +1,13 @@
class PhotoAssociationsController < ApplicationController
before_action :authenticate_member!
respond_to :json, :html
def destroy
@photo = Photo.find_by!(id: params[:photo_id], owner: current_member)
collection = Growstuff::Constants::PhotoModels.get_relation(@photo, params[:type])
item_class = Growstuff::Constants::PhotoModels.get_item(params[:type])
@item = item_class.find_by!(id: params[:id], owner_id: current_member.id)
collection.delete(@item)
respond_with(@photo)
end
end

View File

@@ -62,7 +62,7 @@ class Garden < ActiveRecord::Base
unique_plantings = []
seen_crops = []
plantings.each do |p|
plantings.includes(:garden, :crop, :owner, :harvests).each do |p|
unless seen_crops.include?(p.crop)
unique_plantings.push(p)
seen_crops.push(p.crop)

View File

@@ -10,6 +10,10 @@ class Photo < ActiveRecord::Base
default_scope { order("created_at desc") }
def associations?
plantings.any? || harvests.any? || gardens.any? || seeds.any?
end
def all_associations
associations = []
Growstuff::Constants::PhotoModels.relations.each do |association_name|
@@ -30,7 +34,7 @@ class Photo < ActiveRecord::Base
licenses = flickr.photos.licenses.getInfo
license = licenses.find { |l| l.id == info.license }
{
title: info.title || "Untitled",
title: calculate_title(info),
license_name: license.name,
license_url: license.url,
thumbnail_url: FlickRaw.url_q(info),
@@ -39,6 +43,16 @@ class Photo < ActiveRecord::Base
}
end
def calculate_title(info)
if id && title # already has a title saved
title
elsif info.title # use title from flickr
info.title
else
'untitled'
end
end
def set_flickr_metadata
update_attributes(flickr_metadata)
end

View File

@@ -27,9 +27,9 @@ class Planting < ActiveRecord::Base
to: :crop,
prefix: true
validates :crop, approved: true
validates :crop, presence: { message: "must be present and exist in our database" }
validates :garden, presence: true
validates :crop, presence: true
validates :crop, approved: { message: "must be present and exist in our database" }
validates :quantity,
numericality: {

View File

@@ -55,7 +55,7 @@
%p= localize_plural(@garden.photos, Photo)
.row-fluid
%ul.thumbnails
- @garden.photos.each do |p|
- @garden.photos.includes(:owner).each do |p|
.col-md-2.six-across
= render partial: 'photos/thumbnail', locals: { photo: p }
.row-fluid
@@ -68,7 +68,7 @@
- if @garden.plantings.current.empty?
%p Nothing is currently planted here.
- else
- @garden.plantings.current.each.with_index do |planting_current, _|
- @garden.plantings.current.includes(:crop, :owner, :harvests, :garden).each.with_index do |planting_current, _|
= render partial: "plantings/thumbnail", locals: { planting: planting_current }
.row-fluid

View File

@@ -36,7 +36,7 @@
%p= localize_plural(g.photos, Photo)
.row
%ul.thumbnails
- g.photos.each do |p|
- g.photos.includes(:owner).each do |p|
.col-md-2.six-across
= render partial: 'photos/thumbnail', locals: { photo: p }
.row

View File

@@ -0,0 +1,4 @@
- if can? :edit, photo
= link_to photo_associations_path(photo_id: photo.id, type: type, id: thing.id),
method: 'delete', class: 'btn btn-default btn-xs' do
%span.glyphicon.glyphicon-remove{ title: "Remove link" }

View File

@@ -0,0 +1,21 @@
%h4 This photo depicts:
%ul
- @photo.plantings.each do |planting|
%li
= link_to t('photos.show.planting', planting: planting.to_s, owner: planting.owner.to_s), planting_path(planting)
= render partial: "photo_association_delete", locals: { photo: @photo, type: 'planting', thing: planting }
- @photo.harvests.each do |harvest|
%li
= link_to t('photos.show.harvest', crop: harvest.crop.name, owner: harvest.owner.to_s), harvest_path(harvest)
= render partial: "photo_association_delete", locals: { photo: @photo, type: 'harvest', thing: harvest }
- @photo.gardens.each do |garden|
%li
= link_to t('photos.show.garden', garden: garden.to_s, owner: garden.owner.to_s), garden_path(garden)
= render partial: "photo_association_delete", locals: { photo: @photo, type: 'garden', thing: garden }
- @photo.seeds.each do |seed|
%li
= link_to t('photos.show.seed', seed: seed.to_s, owner: seed.owner.to_s), seed_path(seed)
= render partial: "photo_association_delete", locals: { photo: @photo, type: 'seed', thing: seed }

View File

@@ -1,2 +1,5 @@
- content_for :title, "Edit Photo"
= form_for(@photo) do |f|
= f.label :title
= f.text_field :title, placeholder: "title"
= f.submit

View File

@@ -36,5 +36,5 @@
- else
.alert
You must
= link_to "connect your account to Flickr", '/auth/flickr'
= link_to "connect your account to Flickr", '/members/auth/flickr'
to add photos.

View File

@@ -8,7 +8,19 @@
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
.row
.col-md-6
.col-md-8
%p= image_tag(@photo.fullsize_url, alt: @photo.title, class: 'img img-responsive')
.col-md-4
%p
- if can? :destroy, @photo
= link_to @photo, method: :delete,
data: { confirm: 'Are you sure?' }, class: 'btn btn-default btn-xs' do
%span.glyphicon.glyphicon-trash{ title: "Delete" }
- if can? :edit, @photo
= link_to edit_photo_path(@photo), class: 'btn btn-default btn-xs' do
%span.glyphicon.glyphicon-pencil{ title: "Edit" }
%p
%strong Posted by:
= link_to @photo.owner, @photo.owner
@@ -19,30 +31,7 @@
- else
= succeed "." do
= @photo.license_name
%p
= link_to "View on Flickr", @photo.link_url
- if can? :destroy, @photo
%p= link_to 'Delete Photo',
@photo,
method: :delete,
data: { confirm: 'Are you sure?' },
class: 'btn btn-default btn-xs'
.col-md-6
- unless @photo.plantings.empty? && @photo.harvests.empty? && @photo.gardens.empty? && @photo.seeds.empty?
%p This photo depicts:
%ul
- @photo.plantings.each do |p|
%li= link_to t('.planting', planting: p.to_s, owner: p.owner.to_s), planting_path(p)
- @photo.harvests.each do |h|
%li= link_to t('.harvest', crop: h.crop.name, owner: h.owner.to_s), harvest_path(h)
- @photo.gardens.each do |g|
%li= link_to t('.garden', garden: g.to_s, owner: g.owner.to_s), garden_path(g)
- @photo.seeds.each do |s|
%li= link_to t('.seed', seed: s.to_s, owner: s.owner.to_s), seed_path(s)
.row
.col-md-12
%p= image_tag(@photo.fullsize_url, alt: @photo.title, class: 'img')
%p= link_to "View on Flickr", @photo.link_url
- if @photo.associations?
= render "photo_associations", locals: { photo: @photo }

View File

@@ -1,4 +1,4 @@
- if planting.harvests
- unless planting.harvests.empty?
Harvests:
%ul
- planting.harvests.each do |harvest|

View File

@@ -7,7 +7,7 @@
= link_to image_tag((planting.default_photo ? planting.default_photo.thumbnail_url : 'placeholder_150.png'),
alt: planting.crop_id, class: 'img'),
planting
.col-xs-7.col-md-5
.col-xs-7.col-md-6
%dl.dl-horizontal.planting-attributes
%dt Owner:
%dd= link_to planting.owner.login_name, planting.owner
@@ -15,10 +15,12 @@
%dd= link_to planting.garden.name, planting.garden
%dt Planted on:
%dd= planting.planted_at
%dt Quantity:
%dd= display_planting_quantity(planting)
%dt Finished on:
%dd= display_finished(planting)
- if planting.quantity
%dt Quantity:
%dd= display_planting_quantity(planting)
- if planting.finished?
%dt Finished on:
%dd= display_finished(planting)
%dt Sun/shade?:
%dd
- sunniness = planting.sunniness.blank? ? "not specified" : planting.sunniness
@@ -26,32 +28,34 @@
= " (#{sunniness})"
%dt Planted from:
%dd= display_planted_from(planting)
.col-xs-1.col-md-3
%ul{ style: "list-style-type:none; text-align:right" }
%li= link_to 'Details', planting, class: 'btn btn-default btn-xs'
- if can? :edit, planting
%li= link_to 'Edit', edit_planting_path(planting), class: 'btn btn-default btn-xs'
- if can? :create, Harvest
%li= link_to 'Harvest', new_planting_harvest_path(planting), class: 'btn btn-default btn-xs'
- unless planting.finished
%li
= link_to "Mark as finished",
planting_path(planting, planting: { finished: 1 }),
method: :put,
class: 'btn btn-default btn-xs append-date'
- if can? :destroy, planting
%li
= link_to 'Delete',
planting, method: :delete,
data: { confirm: 'Are you sure?' },
class: 'btn btn-default btn-xs'
.row
.col-xs-12.col-md-4
%dl
%dt Days until maturity:
%dd= display_days_before_maturity(planting)
%dt Mature in:
%dd
= display_days_before_maturity(planting)
days
.col-xs-12.col-md-8
= render partial: 'plantings/planting_progress', locals: { planting: planting }
.col-xs-12.col-md-8
= render partial: 'plantings/planting_harvest', locals: { planting: planting }
= link_to 'Details', planting, class: 'btn btn-default btn-xs'
- if can? :edit, planting
= link_to edit_planting_path(planting), class: 'btn btn-default btn-xs' do
%span.glyphicon.glyphicon-pencil{ title: "Edit" }
- if can?(:edit, planting) && can?(:create, Harvest)
= link_to 'Harvest', new_planting_harvest_path(planting), class: 'btn btn-default btn-xs'
- if can?(:edit, planting) && !planting.finished
= link_to "Mark as finished",
planting_path(planting, planting: { finished: 1 }),
method: :put,
class: 'btn btn-default btn-xs append-date'
- if can? :destroy, planting
= link_to planting, method: :delete,
data: { confirm: 'Are you sure?' },
class: 'btn btn-default btn-xs' do
%span.glyphicon.glyphicon-trash{ title: "Delete" }
.row
.col-xs-12.col-md-12
%p= render partial: 'plantings/planting_progress', locals: { planting: planting }

View File

@@ -17,6 +17,7 @@ Growstuff::Application.routes.draw do
resources :members
resources :photos
delete 'photo_associations' => 'photo_associations#destroy'
resources :authentications, only: [:create, :destroy]
@@ -81,6 +82,7 @@ Growstuff::Application.routes.draw do
root to: 'home#index'
get 'auth/:provider/callback' => 'authentications#create'
get 'members/auth/:provider/callback' => 'authentications#create'
get '/shop' => 'shop#index'
get '/shop/:action' => 'shop#:action'

View File

@@ -0,0 +1,41 @@
require 'rails_helper'
describe PhotoAssociationsController do
login_member
describe "destroy" do
let(:valid_params) do
{
id: harvest.id,
type: 'harvest',
photo_id: photo.id
}
end
before { photo.harvests << harvest }
describe "my harvest my photo" do
let(:harvest) { FactoryGirl.create :harvest, owner: member }
let(:photo) { FactoryGirl.create :photo, owner: member }
it "removes link" do
expect { delete :destroy, valid_params }.to change { photo.harvests.count }.by(-1)
end
end
describe "another member's harvest from another member's photo" do
let(:harvest) { FactoryGirl.create :harvest }
let(:photo) { FactoryGirl.create :photo }
it do
expect do
begin
delete :destroy, valid_params
rescue
nil
end
end.not_to change { photo.harvests.count }
end
it { expect { delete :destroy, valid_params }.to raise_error(ActiveRecord::RecordNotFound) }
end
end
end

View File

@@ -13,17 +13,17 @@
require 'rails_helper'
describe "photos/show" do
before(:each) do
@member = FactoryGirl.create(:member)
controller.stub(:current_user) { @member }
end
let(:photo) { FactoryGirl.create :photo, owner: member }
before { @photo = photo }
context "CC-licensed photo" do
before(:each) do
@photo = assign(:photo, FactoryGirl.create(:photo, owner: @member))
render
end
let(:member) { FactoryGirl.create :member }
let(:harvest) { FactoryGirl.create :harvest, owner: member }
let(:planting) { FactoryGirl.create :planting, owner: member }
let(:seed) { FactoryGirl.create :seed, owner: member }
let(:garden) { FactoryGirl.create :garden, owner: member }
shared_examples "photo data renders" do
it "shows the image" do
assert_select "img[src='#{@photo.fullsize_url}']"
end
@@ -32,22 +32,79 @@ describe "photos/show" do
assert_select "a", href: @photo.owner
end
it "links to the CC license" do
assert_select "a", href: @photo.license_url,
text: @photo.license_name
end
it "shows a link to the original image" do
assert_select "a", href: @photo.link_url, text: "View on Flickr"
end
it "links to harvest" do
assert_select "a", href: harvest_path(harvest)
end
it "links to planting" do
assert_select "a", href: planting_path(planting)
end
it "links to garden" do
assert_select "a", href: garden_path(garden)
end
it "links to seeds" do
assert_select "a", href: seed_path(seed)
end
end
shared_examples "No links to change data" do
it "does not have a delete button" do
assert_select "a[href='#{photo_path(@photo)}']", false
end
end
context "signed in as owner" do
before(:each) do
controller.stub(:current_user) { member }
render
end
include_examples "photo data renders"
it "has a delete button" do
assert_select "a[href='#{photo_path(@photo)}']", 'Delete Photo'
assert_select "a[href='#{photo_path(@photo)}']"
end
end
context "signed in as another member" do
before(:each) do
controller.stub(:current_user) { FactoryGirl.create :member }
render
end
include_examples "photo data renders"
include_examples "No links to change data"
end
context "not signed in" do
before(:each) do
controller.stub(:current_user) { nil }
render
end
include_examples "photo data renders"
include_examples "No links to change data"
end
context "CC-licensed photo" do
before(:each) do
controller.stub(:current_user) { nil }
# @photo = assign(:photo, FactoryGirl.create(:photo, owner: @member))
@photo.harvests << harvest
@photo.plantings << planting
@photo.seeds << seed
@photo.gardens << garden
render
end
it "links to the CC license" do
assert_select "a", href: @photo.license_url,
text: @photo.license_name
end
end
context "unlicensed photo" do
before(:each) do
controller.stub(:current_user) { nil }
@photo = assign(:photo, FactoryGirl.create(:unlicensed_photo))
render
end