Commit b6cdd1c819b4a43cd00dfdc9dbffc1490593a8b5

Authored by Nihad Abbasov
1 parent 01f72bfa

test expired snippets

app/models/snippet.rb
... ... @@ -53,5 +53,6 @@ end
53 53 # created_at :datetime
54 54 # updated_at :datetime
55 55 # file_name :string(255)
  56 +# expires_at :datetime
56 57 #
57 58  
... ...
app/views/snippets/show.html.haml
... ... @@ -23,4 +23,4 @@
23 23  
24 24 - else
25 25 %h2
26   - Sorry, this snipped is no longer exists
  26 + Sorry, this snippet is no longer exists
... ...
spec/models/snippet_spec.rb
... ... @@ -26,5 +26,6 @@ end
26 26 # created_at :datetime
27 27 # updated_at :datetime
28 28 # file_name :string(255)
  29 +# expires_at :datetime
29 30 #
30 31  
... ...
spec/requests/snippets_spec.rb
... ... @@ -23,6 +23,14 @@ describe "Snippets" do
23 23 it { should have_content(@snippet.project.name) }
24 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 34 describe "Destroy" do
27 35 before do
28 36 # admin access to remove snippet
... ...