Commit b6cdd1c819b4a43cd00dfdc9dbffc1490593a8b5
1 parent
01f72bfa
Exists in
master
and in
4 other branches
test expired snippets
Showing
4 changed files
with
11 additions
and
1 deletions
Show diff stats
app/models/snippet.rb
app/views/snippets/show.html.haml
spec/models/snippet_spec.rb
spec/requests/snippets_spec.rb
| @@ -23,6 +23,14 @@ describe "Snippets" do | @@ -23,6 +23,14 @@ describe "Snippets" do | ||
| 23 | it { should have_content(@snippet.project.name) } | 23 | it { should have_content(@snippet.project.name) } |
| 24 | it { should have_content(@snippet.author.name) } | 24 | it { should have_content(@snippet.author.name) } |
| 25 | 25 | ||
| 26 | + it "doesn't show expired snippets" do | ||
| 27 | + @snippet.update_attribute(:expires_at, 1.day.ago.to_time) | ||
| 28 | + visit project_snippet_path(project, @snippet) | ||
| 29 | + page.should have_content("Sorry, this snippet is no longer exists") | ||
| 30 | + page.should_not have_content(@snippet.title) | ||
| 31 | + page.should_not have_content(@snippet.content) | ||
| 32 | + end | ||
| 33 | + | ||
| 26 | describe "Destroy" do | 34 | describe "Destroy" do |
| 27 | before do | 35 | before do |
| 28 | # admin access to remove snippet | 36 | # admin access to remove snippet |