add test case for note
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><%= link_to note_version.post_id, post_path(note_version.post_id) %></td>
|
||||
<td><%= link_to "#{note_version.note_id}", note_versions_path(:search => {:note_id => note_version.note_id}) %></td>
|
||||
<td><%= link_to "#{note_version.note_id}.#{note_version.id}", note_versions_path(:search => {:note_id => note_version.note_id}) %></td>
|
||||
<td><%= h(note_version.body) %> <% unless note_version.is_active? %>(deleted)<% end %></td>
|
||||
<td>
|
||||
<% if CurrentUser.is_janitor? %>
|
||||
|
||||
@@ -14,6 +14,24 @@ class NoteTest < ActiveSupport::TestCase
|
||||
CurrentUser.ip_addr = nil
|
||||
end
|
||||
|
||||
context "for a post that already has a note" do
|
||||
setup do
|
||||
@post = FactoryGirl.create(:post)
|
||||
@note = FactoryGirl.create(:note, :post => @post)
|
||||
end
|
||||
|
||||
context "when the note is deleted the post" do
|
||||
setup do
|
||||
@note.toggle!(:is_active)
|
||||
end
|
||||
|
||||
should "null out its last_noted_at_field" do
|
||||
@post.reload
|
||||
assert_nil(@post.last_noted_at)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "creating a note" do
|
||||
setup do
|
||||
@post = FactoryGirl.create(:post)
|
||||
|
||||
Reference in New Issue
Block a user