diff options
author | Nihad Abbasov <narkoz.2008@gmail.com> | 2011-10-28 00:25:50 +0500 |
---|---|---|
committer | Nihad Abbasov <narkoz.2008@gmail.com> | 2011-10-28 00:25:50 +0500 |
commit | b6cdd1c819b4a43cd00dfdc9dbffc1490593a8b5 (patch) | |
tree | 7ad5366df84b8dfa1c4642c0fe20404929aa5df7 | |
parent | 01f72bfa83ef05817c2e9898a62ae09919a6d505 (diff) | |
download | gitlab-ce-b6cdd1c819b4a43cd00dfdc9dbffc1490593a8b5.tar.gz |
test expired snippets
-rw-r--r-- | app/models/snippet.rb | 1 | ||||
-rw-r--r-- | app/views/snippets/show.html.haml | 2 | ||||
-rw-r--r-- | spec/models/snippet_spec.rb | 1 | ||||
-rw-r--r-- | spec/requests/snippets_spec.rb | 8 |
4 files changed, 11 insertions, 1 deletions
diff --git a/app/models/snippet.rb b/app/models/snippet.rb index b67db60b78a..5c61cf1c543 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -53,5 +53,6 @@ end # created_at :datetime # updated_at :datetime # file_name :string(255) +# expires_at :datetime # diff --git a/app/views/snippets/show.html.haml b/app/views/snippets/show.html.haml index bfa1bf456e3..757cdb11e03 100644 --- a/app/views/snippets/show.html.haml +++ b/app/views/snippets/show.html.haml @@ -23,4 +23,4 @@ - else %h2 - Sorry, this snipped is no longer exists + Sorry, this snippet is no longer exists diff --git a/spec/models/snippet_spec.rb b/spec/models/snippet_spec.rb index 9dab72ca7dc..037287a9928 100644 --- a/spec/models/snippet_spec.rb +++ b/spec/models/snippet_spec.rb @@ -26,5 +26,6 @@ end # created_at :datetime # updated_at :datetime # file_name :string(255) +# expires_at :datetime # diff --git a/spec/requests/snippets_spec.rb b/spec/requests/snippets_spec.rb index d4811958db3..ee4f90e6028 100644 --- a/spec/requests/snippets_spec.rb +++ b/spec/requests/snippets_spec.rb @@ -23,6 +23,14 @@ describe "Snippets" do it { should have_content(@snippet.project.name) } it { should have_content(@snippet.author.name) } + it "doesn't show expired snippets" do + @snippet.update_attribute(:expires_at, 1.day.ago.to_time) + visit project_snippet_path(project, @snippet) + page.should have_content("Sorry, this snippet is no longer exists") + page.should_not have_content(@snippet.title) + page.should_not have_content(@snippet.content) + end + describe "Destroy" do before do # admin access to remove snippet |