Skip to content

Commit

Permalink
Add specs for home_partial_path
Browse files Browse the repository at this point in the history
  • Loading branch information
mercyoseni committed Jul 29, 2019
1 parent 76f3270 commit 11aab03
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions spec/helpers/mushrooms_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,42 @@
end
end
end

describe '#home_partial_path' do
context 'when mushrooms is present' do
it "returns 'mushrooms'" do
mushrooms = double('mushrooms')
params = { }

expect(home_partial_path(mushrooms, params)).to eq('mushrooms')
end
end

context 'when filter params is present' do
it "returns 'no_results'" do
mushrooms = ''
params = { filter: 'mushroom_class' }

expect(home_partial_path(mushrooms, params)).to eq('no_results')
end
end

context 'when search params is present' do
it "returns 'no_results'" do
mushrooms = ''
params = { search: 'edible' }

expect(home_partial_path(mushrooms, params)).to eq('no_results')
end
end

context 'when mushrooms and params are NOT present' do
it "returns 'default'" do
mushrooms = ''
params = { }

expect(home_partial_path(mushrooms, params)).to eq('default')
end
end
end
end

0 comments on commit 11aab03

Please sign in to comment.