Files
growstuff/spec/helpers/buttons_helper_spec.rb
T

30 lines
1.0 KiB
Ruby

# frozen_string_literal: true
require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the ButtonsHelper. For example:
#
# describe ButtonsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
RSpec.describe ButtonsHelper do
before { allow(self).to receive(:can?).and_return(true) }
let(:garden) { create(:garden) }
let(:planting) { create(:planting) }
let(:harvest) { create(:harvest) }
let(:seed) { create(:seed) }
describe 'add_photo_button' do
it { expect(add_photo_button(garden)).to include "/photos/new?id=#{garden.id}&type=garden" }
it { expect(add_photo_button(planting)).to include "/photos/new?id=#{planting.id}&type=planting" }
it { expect(add_photo_button(harvest)).to include "/photos/new?id=#{harvest.id}&type=harvest" }
it { expect(add_photo_button(seed)).to include "/photos/new?id=#{seed.id}&type=seed" }
end
end