hi,
I have created a functional test, which when run using the command
ruby <myfunctionaltest>.rb
fails
the <myfunctionaltest>.rb includes a file name test_helper.rb. The
contents of the test_helper.rb file are
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) +
"/../config/environment")
require ''test_help''
class Test::Unit::TestCase
self.use_instantiated_fixtures = false
# Add more helper methods to be used by all tests here...
def assert_close(v1,v2)
assert((v1-v2).abs < 0.0001,"#{v1} is not within 0.0001 of
#{v2}")
end
def assert_close_percent(v1,v2)
assert(((v1-v2)/v1).abs < 0.0001,"#{v1} is not within 0.0001% of
#{v2}")
end
def login(name=''<<my
username>>'',password=''<<my
password>>'')
controller = @controller
@controller = LoginController.new
post :login,:user=>{:name=>name,:password=>password}
assert_redirected_to
:controller=>''login'',:action=>''home_page''
#assert_redirected_to @controller.url_for( :action =>
''login'' )
assert_not_nil(session[:user_id])
assert_kind_of Person, Person.find(session[:user_id])
@controller = controller
end
end
The error it gives me is:
FFFFFFFF
Finished in 0.344 seconds.
1) Failure:
test_create(OfficesControllerTest)
[functional/offices_controller_test.rb:56]:
response is not a redirection to all of the options supplied
(redirection is <{:action=>"login",
:controller=>"login"}>)
, difference: <{:action=>"list",
:controller=>"login"}>
2) Failure:
test_destroy(OfficesControllerTest)
[functional/offices_controller_test.rb:82]:
response is not a redirection to all of the options supplied
(redirection is <{:action=>"login",
:controller=>"login"}>)
, difference: <{:action=>"list",
:controller=>"login"}>
3) Failure:
test_edit(OfficesControllerTest)
[functional/offices_controller_test.rb:64]:
Expected response to be a <:success>, but was <302>
4) Failure:
test_index(OfficesControllerTest)
[functional/offices_controller_test.rb:18]:
Expected response to be a <:success>, but was <302>
5) Failure:
test_list(OfficesControllerTest)
[functional/offices_controller_test.rb:25]:
Expected response to be a <:success>, but was <302>
6) Failure:
test_new(OfficesControllerTest)
[functional/offices_controller_test.rb:44]:
Expected response to be a <:success>, but was <302>
7) Failure:
test_show(OfficesControllerTest)
[functional/offices_controller_test.rb:34]:
Expected response to be a <:success>, but was <302>
8) Failure:
test_update(OfficesControllerTest)
[functional/offices_controller_test.rb:74]:
response is not a redirection to all of the options supplied
(redirection is <{:action=>"login",
:controller=>"login"}>)
, difference: <{:action=>"show",
:controller=>"login", :id=>1}>
8 tests, 15 assertions, 8 failures, 0 errors
Please help me understand the error
Thanks in advance
Tushar
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---