Files
growstuff/spec/controllers/seeds_controller_spec.rb
Brenda Wallace f9d4e1d6ae Ancestry of food. Seeds -> Planting -> Seeds -> Planting (#1550)
* Add seed ancestry, and seeds.finished_at
* Plantings and seeds produce each other
* Permissions for seeds actions
* View update, for seed actions, and planting ancestry
* Routes for seeds
* Scopes for harvests
* Spec updates for seeds
* Removed in-line style
* Add seed ancestry, and seeds.finished_at
* Plantings and seeds produce each other
* Permissions for seeds actions
* View update, for seed actions, and planting ancestry
* Routes for seeds
* Scopes for harvests
* Spec updates for seeds
* Moved finishable to a concern
* Seeds.finished_at
* rubocop fixes
* Made seeds sown migration the most recent
* Specs for home page
* Only show current seeds on home page
* Seeds appear for logged in or not
* Buttons to mark seeds finished
* JS for marking seeds finished
* Some actions only appear if seed or planting is active
* Fixed up display of home page
* Fixed typo in admin members#index
* Tidying up actions on all the things
* Harvest description in #index
* Truncate garden description if long
* Updated link label in view spec
* Show planted_from always, becuase it might be a parent seed
* find correct link in spec adding photos to garden
* fixed spec finding link to edit garden
* Better harvest description truncation
* Helping spec find the edit button
* specs for the home page
* Re-instate crops js, but in the correct file now
* Fixed link to garden in actions
* Tweaking mobile view
2018-03-12 08:39:32 +13:00

29 lines
667 B
Ruby

require 'rails_helper'
describe SeedsController do
let(:owner) { FactoryBot.create(:member) }
describe "GET index" do
before { get :index, owner: owner.slug }
it "picks up owner from params" do
assigns(:owner).should eq(owner)
end
end
describe 'GET new' do
before { sign_in owner }
it { expect(response).to be_success }
context 'no parent planting' do
before { get :new }
end
context 'with parent planting' do
let(:planting) { FactoryBot.create :planting, owner: owner }
before { get :new, planting_id: planting.to_param }
it { expect(assigns(:planting)).to eq(planting) }
end
end
end