Skip to content

Commit

Permalink
Add message when there are no results
Browse files Browse the repository at this point in the history
  • Loading branch information
cllns committed Dec 5, 2015
1 parent dca5f66 commit 51c355e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/views/posts/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@
</div>
</li>
<% end %>
<% if @posts.empty? %>
Sorry, there were no results for your search :(
<% end %>
</ul>
</section>
7 changes: 7 additions & 0 deletions spec/features/post_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@
expect(page).to have_content post1.title
expect(page).to have_no_content post2.title
end

it "shows a message if there are no posts" do
visit root_url
click_button "Search"

expect(page).to have_content "Sorry"
end
end

describe "the post submission process" do
Expand Down

0 comments on commit 51c355e

Please sign in to comment.