added wiki page version func test
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
class WikiPageVersionsController < ApplicationController
|
class WikiPageVersionsController < ApplicationController
|
||||||
def index
|
def index
|
||||||
|
@search = WikiPageVersion.search(params[:search])
|
||||||
|
@wiki_page_versions = @search.paginate(:page => params[:page])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
0
app/views/wiki_page_versions/index.html.erb
Normal file
0
app/views/wiki_page_versions/index.html.erb
Normal file
@@ -1,5 +1,5 @@
|
|||||||
Factory.define(:wiki_page) do |f|
|
Factory.define(:wiki_page) do |f|
|
||||||
f.creator {|x| x.association(:user)}
|
f.creator {|x| x.association(:user)}
|
||||||
f.title {|x| Faker::Lorem.words}
|
f.title {|x| Faker::Lorem.words.join(" ")}
|
||||||
f.body {Faker::Lorem.sentences}
|
f.body {Faker::Lorem.sentences.join(" ")}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,8 +1,36 @@
|
|||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class WikiPageVersionsControllerTest < ActionController::TestCase
|
class WikiPageVersionsControllerTest < ActionController::TestCase
|
||||||
# Replace this with your real tests.
|
context "The wiki page versions controller" do
|
||||||
test "the truth" do
|
setup do
|
||||||
assert true
|
@user = Factory.create(:user)
|
||||||
|
CurrentUser.user = @user
|
||||||
|
CurrentUser.ip_addr = "127.0.0.1"
|
||||||
|
end
|
||||||
|
|
||||||
|
teardown do
|
||||||
|
CurrentUser.user = nil
|
||||||
|
CurrentUser.ip_addr = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
context "index action" do
|
||||||
|
setup do
|
||||||
|
@wiki_page = Factory.create(:wiki_page)
|
||||||
|
@wiki_page.update_attributes(:body => "1 2")
|
||||||
|
@wiki_page.update_attributes(:body => "2 3")
|
||||||
|
end
|
||||||
|
|
||||||
|
should "list all versions" do
|
||||||
|
get :index
|
||||||
|
assert_response :success
|
||||||
|
assert_not_nil(assigns(:wiki_page_versions))
|
||||||
|
end
|
||||||
|
|
||||||
|
should "list all versions that match the search criteria" do
|
||||||
|
get :index, {:search => {:wiki_page_id_equals => @wiki_page.id}}
|
||||||
|
assert_response :success
|
||||||
|
assert_not_nil(assigns(:wiki_page_versions))
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user