Skip to content

Commit

Permalink
test: add expectations to view specs
Browse files Browse the repository at this point in the history
  • Loading branch information
salzig committed Oct 13, 2024
1 parent b535ada commit 6f2d7ac
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions spec/views/events/index.html_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
allow(view).to receive_messages(events: paged(event))

render

expect(rendered).to include(event.name)
end
end
2 changes: 2 additions & 0 deletions spec/views/events/index.xml_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@
it 'renders successfully' do
allow(view).to receive_messages(events:)
render

expect(rendered).to include(events.first.name)
end
end
2 changes: 2 additions & 0 deletions spec/views/home/index.html_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@
allow(view).to receive_messages(zoom:)

render

expect(rendered).to include(event.name)
end
end
2 changes: 2 additions & 0 deletions spec/views/labels/index.html_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
Whitelabel.reset!

render

expect(rendered).to include(Whitelabel.labels.select(&:enabled?).first.name)
end
end
2 changes: 2 additions & 0 deletions spec/views/locations/index.html_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
allow(view).to receive_messages(locations:)

render

expect(rendered).to include(locations.first.name)
end
end
2 changes: 2 additions & 0 deletions spec/views/locations/none.html_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
I18n.with_locale(locale) do
allow(view).to receive_messages(organizers:, stats:)
render

expect(rendered).to include(organizers.first.nickname)
end
end
end
Expand Down
2 changes: 2 additions & 0 deletions spec/views/locations/show.html_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
view.lookup_context.prefixes = %w[locations application]

render

expect(rendered).to include(location.name)
end
end
2 changes: 2 additions & 0 deletions spec/views/sitemaps/show.xml_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
allow(view).to receive_messages(urls: example_urls)

render

expect(rendered).to include(example_urls.first)
end
end
2 changes: 2 additions & 0 deletions spec/views/topics/edit.html_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
allow(view).to receive_messages(current_user: user, topic:, undone_topics: [topic])

render

expect(rendered).to include(topic.name)
end
end
2 changes: 2 additions & 0 deletions spec/views/topics/index.html_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
allow(view).to receive_messages(events: paged(event))

render

expect(rendered).to include(event.name)
end
end
2 changes: 2 additions & 0 deletions spec/views/topics/new.html_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
allow(view).to receive_messages(signed_in?: true, topic:, undone_topics: [topic])

render

expect(rendered).to include(topic.name.to_s)
end
end
4 changes: 4 additions & 0 deletions spec/views/topics/show.html_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
allow(view).to receive_messages(topic:, signed_in?: false)

render

expect(rendered).to include(topic.name)
end

context 'materials' do
let(:materials) { [build(:material)] }

it 'renders without an error' do
render partial: 'materials', locals: { materials: }

expect(rendered).to include(materials.first.name)
end
end
end
2 changes: 2 additions & 0 deletions spec/views/users/edit.html_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
allow(view).to receive_messages(current_user: user, user:)

render

expect(rendered).to include(user.name)
end
end
2 changes: 2 additions & 0 deletions spec/views/users/show.html_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
allow(view).to receive_messages(current_user: user, user:)

render

expect(rendered).to include(user.nickname)
end
end

0 comments on commit 6f2d7ac

Please sign in to comment.