test fxies

This commit is contained in:
albert
2011-07-22 18:26:55 -04:00
parent c74fa18898
commit 9649e7f40a
5 changed files with 14 additions and 11 deletions

View File

@@ -11,7 +11,7 @@ class BansController < ApplicationController
def index def index
@search = Ban.search(params[:search]) @search = Ban.search(params[:search])
@bans = @search.paginate(:page => params[:page]) @bans = @search.paginate(params[:page])
end end
def show def show

View File

@@ -15,7 +15,7 @@ class DmailsController < ApplicationController
def index def index
@search = Dmail.search(params[:search]) @search = Dmail.search(params[:search])
@dmails = @search.paginate(:page => params[:page]) @dmails = @search.paginate(params[:page])
@dmails.each {|x| check_privilege(x)} @dmails.each {|x| check_privilege(x)}
respond_with(@dmails) respond_with(@dmails)
end end

View File

@@ -12,7 +12,7 @@ class IpBansController < ApplicationController
def index def index
@search = IpBan.search(params[:search]) @search = IpBan.search(params[:search])
@ip_bans = @search.paginate(:page => params[:page]) @ip_bans = @search.paginate(params[:page])
end end
def destroy def destroy

View File

@@ -13,7 +13,7 @@ class JanitorTrialsController < ApplicationController
def index def index
@search = JanitorTrial.search(params[:search]) @search = JanitorTrial.search(params[:search])
@janitor_trials = @search.paginate(:page => params[:page]) @janitor_trials = @search.paginate(params[:page])
respond_with(@janitor_trials) respond_with(@janitor_trials)
end end

View File

@@ -16,12 +16,15 @@ class NoteVersionsControllerTest < ActionController::TestCase
context "index action" do context "index action" do
setup do setup do
@note = Factory.create(:note) @note = Factory.create(:note)
CurrentUser.id = 20 @user_2 = Factory.create(:user)
@note.body = "1 2"
@note.create_version CurrentUser.scoped(@user_2, "1.2.3.4") do
CurrentUser.id = 30 @note.update_attributes(:body => "1 2")
@note.body = "1 2 3" end
@note.create_version
CurrentUser.scoped(@user, "1.2.3.4") do
@note.update_attributes(:body => "1 2 3")
end
end end
should "list all versions" do should "list all versions" do
@@ -32,7 +35,7 @@ class NoteVersionsControllerTest < ActionController::TestCase
end end
should "list all versions that match the search criteria" do should "list all versions that match the search criteria" do
get :index, {:search => {:updater_id_equals => "20"}} get :index, {:search => {:updater_id_equals => @user_2.id}}
assert_response :success assert_response :success
assert_not_nil(assigns(:note_versions)) assert_not_nil(assigns(:note_versions))
assert_equal(1, assigns(:note_versions).size) assert_equal(1, assigns(:note_versions).size)