mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-10-25 08:18:24 -04:00
specs for event_helper
This commit is contained in:
1 parent
acad29dab0
commit
4acf165f24
1 file changed
+43
-11
@@ -1,15 +1,47 @@
|
||||
require 'rails_helper'
|
||||
|
||||
# Specs in this file have access to a helper object that includes
|
||||
# the EventHelper. For example:
|
||||
#
|
||||
# describe EventHelper 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 EventHelper, type: :helper do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
let(:planting) { FactoryBot.create :planting }
|
||||
let(:harvest) { FactoryBot.create :harvest }
|
||||
let(:seed) { FactoryBot.create :seed }
|
||||
let(:post) { FactoryBot.create :post }
|
||||
let(:comment) { FactoryBot.create :comment }
|
||||
let(:photo) { FactoryBot.create :photo }
|
||||
|
||||
subject { resolve_model(event) }
|
||||
describe 'plantings' do
|
||||
let(:event) { OpenStruct.new(id: planting.id, event_type: 'planting') }
|
||||
it { expect(subject).to eq planting }
|
||||
it { expect(event_description(event)).to have_text "planted #{planting.crop.name}" }
|
||||
end
|
||||
|
||||
describe 'harvests' do
|
||||
let(:event) { OpenStruct.new(id: harvest.id, event_type: 'harvest') }
|
||||
it { expect(subject).to eq harvest }
|
||||
it { expect(event_description(event)).to have_text "harvested" }
|
||||
end
|
||||
|
||||
describe 'seeds' do
|
||||
let(:event) { OpenStruct.new(id: seed.id, event_type: 'seed') }
|
||||
it { expect(subject).to eq seed }
|
||||
it { expect(event_description(event)).to have_text "saved #{seed.crop.name} seeds" }
|
||||
end
|
||||
|
||||
describe 'posts' do
|
||||
let(:event) { OpenStruct.new(id: post.id, event_type: 'post') }
|
||||
it { expect(subject).to eq post }
|
||||
it { expect(event_description(event)).to have_text 'wrote a post' }
|
||||
end
|
||||
|
||||
describe 'comments' do
|
||||
let(:event) { OpenStruct.new(id: comment.id, event_type: 'comment') }
|
||||
it { expect(subject).to eq comment }
|
||||
it { expect(event_description(event)).to have_text 'commented on' }
|
||||
end
|
||||
|
||||
describe 'photos' do
|
||||
let(:event) { OpenStruct.new(id: photo.id, event_type: 'photo') }
|
||||
it { expect(subject).to eq photo }
|
||||
it { expect(event_description(event)).to have_text "took a photo" }
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user