my tests are running with no errors…
but how do i check whether the functional tests i wrote are working…i
need please…
require File.dirname(FILE) + ‘/…/test_helper’
class BooksControllerTest < ActionController::TestCase
def setup
@controller = BooksController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
login_as :sanj
end
fixtures :books
def test_should_get_index
login_as(:sanj)
get :index
assert_response :found
assert_nil assigns(:book)
end
def test_should_get_new
login_as(:sanj)
get :new
assert_response :found
end
def test_should_update_book_name
login_as(:sanj)
assert_difference(‘Book.count’,0) do
post :update, :book => {:name => “shkj”}
end
end
def test_should_get_details
login_as(:sanj)
assert_difference(‘Book.count’,0) do
get :book =>{}
end
end
def test_should_update_num_of_books
login_as(:sanj)
assert_difference(‘Book.count’,0) do
post :update, :book => {:num_books => 7}
end
end
def test_should_update_book_buyin
login_as(:sanj)
assert_difference(‘Book.count’,0) do
post :update, :book => {:buyin => 20}
end
end
def test_should_update_book_book_fee
login_as(:sanj)
assert_difference(‘Book.count’,0) do
post :update, :book => {:book_fee => 1200}
end
end
def test_should_create_book
login_as(:sanj)
assert_difference(‘Book.count’,0) do
post :create, :book => {:name => “ssss”,:num_books => 5,:buyin =>
1000,:book_fee => 1500}
end
end
def test_should_edit_book_name
login_as(:sanj)
assert_difference(‘Book.count’,0) do
post :edit, :book => {:name => “sshh”}
end
end
def test_should_update_book_details
login_as(:sanj)
assert_difference(‘Book.count’,0) do
post :update, :book => {:name => “sshf”,:num_books => 10, :buyin =>3000,
:book_fee => 4000}
end
end
def test_should_edit_no_of_books
login_as(:sanj)
assert_difference(‘Book.count’,0) do
post :edit, :book => {:num_books => “6”}
end
end
def test_should_edit_the_book_details
login_as(:sanj)
assert_difference(‘Book.count’,0) do
post :edit, :book => {:name => “sssss”,:num_books => 5, :buyin =>2000,
:book_fee => 2000}
end
end
def test_should_edit_book_fee
login_as(:sanj)
assert_difference(‘Book.count’,0) do
post :edit, :book => {:book_fee => “1600”}
end
end
def test_should_edit_book_buying
login_as(:sanj)
assert_difference(‘Book.count’,0) do
post :edit, :book => {:buyin => “1200”}
end
end
def test_should_show_book
login_as(:sanj)
get :show, :id => 1
assert_response :found
end
def test_should_edit_book
login_as(:sanj)
get :edit, :id => 1
assert_response :found
end
def test_should_update_the_book_name
login_as(:sanj)
put :update, :id => 2, :book => {}
end
def test_should_update_book
login_as(:sanj)
put :update, :id => 1, :book => { }
end
def test_should_destroy_book
login_as(:sanj)
assert_difference(‘Book.count’,0) do
delete :destroy, :id => 1, :admins_id => admins(:sanj).id
end
end
end
is this correct functional tests???..how do i check whether the tests i
wrote are correct??..
they are executing without errors…
Loaded suite test/functional/books_controller_test
Started
…
Finished in 0.379324 seconds.
24 tests, 25 assertions, 0 failures, 0 errors
but how do i check whether they are correct tests??..i need helppp
pleaseee
thank you