post versions: add ability to search post versions by tags.
* Add ability to search /post_versions by added tags, removed tags, or changed tags (added or removed). * Add 'History' link to the sidebar of the /posts index. This is a shortcut for a /post_versions search of the current tag.
This commit is contained in:
@@ -7,7 +7,7 @@ class PostVersionsControllerTest < ActionDispatch::IntegrationTest
|
||||
|
||||
context "The post versions controller" do
|
||||
context "index action" do
|
||||
setup do
|
||||
setup do
|
||||
@user.as_current do
|
||||
@post = create(:post)
|
||||
travel(2.hours) do
|
||||
@@ -34,6 +34,17 @@ class PostVersionsControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_response :success
|
||||
assert_select "#post-version-#{@post2.versions[0].id}", false
|
||||
end
|
||||
|
||||
should "list all versions for search[changed_tags]" do
|
||||
get post_versions_path, as: :json, params: { search: { changed_tags: "1" }}
|
||||
assert_response :success
|
||||
assert_equal @versions[1].id, response.parsed_body[1]["id"].to_i
|
||||
assert_equal @versions[2].id, response.parsed_body[0]["id"].to_i
|
||||
|
||||
get post_versions_path, as: :json, params: { search: { changed_tags: "1 2" }}
|
||||
assert_response :success
|
||||
assert_equal @versions[1].id, response.parsed_body[0]["id"].to_i
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user