Displaying 14 results from an estimated 14 matches for "assert_nil".
Did you mean:
assert_ne
2008 Jan 12
0
Can't test application controller methods in functional tests?
...ds, :message_boards, :forums
def setup
@controller = ForumController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
end
...
# test logout (all cases)
def test_logout
get :logout, nil, nil
assert_response :success
assert_nil session[:username]
assert_nil session[:admin]
get :logout, nil, {:username => ''bogus''}
assert_response :success
assert_nil session[:username]
assert_nil session[:admin]
get :logout, nil, {:username => ''Admin'', :admin => 1}
a...
2006 Jan 10
0
problem with cookies in tests (TDD)
...login => ''ben'', :password => ''password''
}, :remember => 1 }
assert_equal(User.hash_password(''password''), cookies["password"][0])
assert_equal(''ben'', cookies["login"][0])
get :logout
assert_nil cookies["password"][0]
assert_nil cookies["login"][0]
end
account_controller.rb
def logout
session[''user''] = nil
cookies.delete :login if cookies[:login]
cookies.delete :password if cookies[:password]
end
rake test failure (assert_nil c...
2006 Sep 22
2
foo.expects(:blah).returns(10).then(11) syntax
..._return_values_in_order
+ expectation = Expectation.new(:expected_method).returns(9).then(10)
+ assert_equal 9, expectation.invoke
+ assert_equal 10, expectation.invoke
+ end
+
def test_should_return_nil_if_no_value_specified
expectation = Expectation.new(:expected_method)
assert_nil expectation.invoke
Index: lib/mocha/expectation.rb
===================================================================
--- lib/mocha/expectation.rb (revision 854)
+++ lib/mocha/expectation.rb (working copy)
@@ -21,7 +21,7 @@
@method_name = method_name
@count = 1
@param...
2006 Feb 08
1
functional test problem
...e if it is still in the db.
How do I check that the User IS Deleted without causing errors?
** My Test ********************************
def test_delete_user
login
user = User.find(2)
post :delete_user, {:id => user.id}
assert_equal "User deleted", flash[:notice]
assert_nil User.find(2)
assert_redirected_to :action => ''manage_users''
end
** The Error *******************************
1) Error:
test_delete_user(AdminControllerTest):
ActiveRecord::RecordNotFound: Couldn''t find User with ID=2
c:/ruby/lib/ruby/gems/1.8/gems/active...
2005 Aug 09
12
Eclipse with RDT
Has anyone used Eclipse with RDT
(http://wiki.rubyonrails.com/rails/show/RubyDevelopmentTools)? I have
never used Eclipse. Would it be worth my time to setup Eclipse with RDT
to create my first rails project?
2006 Jun 29
0
@response.body accumulating in functional tests?
I have two functional tests for my user controller:
def test_bad_registration
post :register, :email => "tester1@foo.com"
assert_response :success
assert_not_nil @response.body =~ /^\<error/
assert_nil assigns[''user'']
end
def test_good_registration
@response.body = nil
post :register, :username => "tester",
:name => "Tester",
:password => "test",
:email => "tester@foo.com"
assert_not_n...
2005 Oct 27
0
has_one with Single Table Inheritance - NameError : uninitialized constant
...shlist = Wishlist.new(''title''=>''Default Wish List'')
wishlist.user = self
self.wishlist = wishlist
end
self.wishlist.items<<album
self.wishlist.save
end
What''s strange is this works perfectly in my Wishlist unit test.
def test_add_to_wishlist
assert_nil @normal_user.wishlist
album = Album.find(1)
@normal_user.add_to_wishlist(album)
assert_not_nil @normal_user.wishlist
assert_equal 1, @normal_user.wishlist.items.length
assert_equal album, @normal_user.wishlist.items[0]
end
no errors. passes all assertions. any ideas?
____________________________...
2008 Mar 27
0
handling post-remove URL / uninstall of application
..."fb_sig_expires" => nil,
"fb_sig_api_key" => "<something>",
"fb_sig_added" => nil,
"fb_sig" => "something" }
assert_nil WebUser.find_by_id( 1 ), "the web_user is still
there, but should have been deleted"
end
1) Error:test_post_remove
(FacebookControllerTest):Facebooker::Session::ConfigurationMissing:
Could not find configuration information for api vendor/plugins/
facebooker/lib/facebooke...
2006 Dec 01
0
[766] trunk/wxruby2: Added item_data aliases for client_data functions, update doc & tests;
...def test_treectrl_itemdata
</span><span class="cx"> f = CtrlContainerFrame.new(Wx::TreeCtrl)
</span><del>- root = f.control.add_root(''foo'')
</del><ins>+ tree = f.control
+ root = tree.add_root(''foo'')
+ assert_nil(tree.get_item_data( tree.get_root_item))
</ins><span class="cx">
</span><del>- id = f.control.append_item(root, ''a hash'', -1, -1, { :a => 7 })
- assert_equal({:a => 7 },
- f.control.get_item_data(id) )
</del>&l...
2013 Nov 05
4
Handling closed clients
...redirect_test_io do
+ @server = HttpServer.new(app, :listeners => [ "127.0.0.1:#@port"] )
+ @server.start
+ end
+ sock = TCPSocket.new(''127.0.0.1'', @port)
+ sock.syswrite("GET / HTTP/1.0\r\n\r\n")
+ assert_match %r{\AHTTP/1.[01] 500\b}, sock.sysread(4096)
+ assert_nil sock.close
+ lines = File.readlines("test_stderr.#$$.log")
+ assert lines.grep(/app error:/)
+ end
+
+ def test_file_streamed_request_close
+ teardown
+ # do a funky dance so that the socket is closed partway though the request
+ tmp = Tempfile.new(''test_file_streamed_request_clo...
2006 Feb 28
12
Examples for Money library ?
Can anybody share some examples of their Money implementation ?
I''m trying to setup a Model to use this library, but can''t seem to wrap my
head around how it is exactly supposed to work.
My Model (Foo) looks like:
===============
composed_of :commission, :class_name => "Money", :mapping => [
%w(commission_cents cents), %w(commission_currency currency) ]
Yet, in
2016 Feb 15
1
[PATCH] Start adding return values tests for bindings
...uot;test")
+
+ assert_raises(Guestfs::Error) {
+ g.internal_test_rconststringerr()
+ }
+ end
+
+ def test_rconstoptstring
+ g = Guestfs::Guestfs.new()
+
+ assert_equal "static string", g.internal_test_rconstoptstring("test")
+
+ # this never fails
+ assert_nil g.internal_test_rconstoptstringerr()
+ end
+
+ def test_rstring
+ g = Guestfs::Guestfs.new()
+
+ assert_equal "test", g.internal_test_rstring("test")
+
+ assert_raises(Guestfs::Error) {
+ g.internal_test_rstringerr()
+ }
+ end
+
+ def test_rstringlist
+ g...
2005 Nov 16
19
Concerns over Rails' handling of tests
Sorry if this comes across as a bunch of disjointed thoughts...I''m just
trying to put my thoughts down and I''d like to know what other people''s
opinions on the subject are.
I''ve been working with Rails for 3 or 4 months now and I''m constantly trying
to look at ways of improving my testing techniques, especially when it comes
to TDD. I have a few
2006 Nov 26
0
[758] trunk/wxruby2: i18n support: added Locale class, methods for get/set languages & encodings
...Wx::Locale.find_language_info(''pt_BR'')
+ assert_equal(''Portuguese (Brazilian)'', locale_info.description)
+
+ locale_info = Wx::Locale.find_language_info(''ja'')
+ assert_equal(''Japanese'', locale_info.description)
+
+ assert_nil( Wx::Locale.find_language_info(''xx'') )
+ end
+
+ def test_add_language_info
+ # FIXME - typemaps for wxString are not picked up when SWIG converts
+ # the struct definition; so maybe do an %extend for this method that
+ # accepts string canonical name and description...