search for: assert_not_nil

Displaying 20 results from an estimated 46 matches for "assert_not_nil".

2006 Jun 27
2
testing - how to get access to an instance variable
inside controller def foo @city = City.find(@params[:id]) @city.bar = 1234 end While writing functional tests how do I ensure that the @city.bar is 1234? def test_edit get :edit, :id => 1 assert_not_nil assigns(:city) #?? how to assert that city.bar is 1234 end Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060627/d4861773/attachment.html
2006 May 17
0
teardown not cleaning the BD?
...my DB should be deleted... Well, when I run my test, I get a faillure on a test that is supposed to make sure that a specific record is deleted. When I look at the DB, the record is still there. The test goes like this: def test_delete_concept #make sure the concept record is present assert_not_nil Concept.find(concepts(:entreprise).id) #make sure the variations record is present assert_not_nil Variation.find_by_concept_id (concepts(:entreprise).id) #find a client_variation first_variation = Variation.find_by_concept_id (concepts(:entreprise).id, :limit => 1) #make su...
2011 Dec 08
0
[hivex] [PATCH 7/8] ruby: Add unit test for new RLenValue type
...t;..", "lib")) +$:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "hivex")) +require 'hivex' + +class TestRLenValue < Test::Unit::TestCase + def test_RLenValue + h = Hivex::open("../images/rlenvalue_test_hive", {}) + assert_not_nil (h) + + root = h.root () + assert_not_nil (root) + + moderate_value_node = h.node_get_child (root, "ModerateValueParent") + assert_not_nil (moderate_value_node) + + moderate_value_value = h.node_get_value (moderate_value_node, "33Bytes") + + r = h.value_data_ce...
2013 Dec 27
0
[PATCH] ruby: Fix .new method (RHBZ#1046509).
...20_create.rb b/ruby/t/tc_020_create.rb index 2b57ba1..4a04e97 100644 --- a/ruby/t/tc_020_create.rb +++ b/ruby/t/tc_020_create.rb @@ -22,7 +22,7 @@ require 'guestfs' class TestLoad < Test::Unit::TestCase def test_create - g = Guestfs::create() + g = Guestfs::Guestfs.new() assert_not_nil (g) end end diff --git a/ruby/t/tc_030_create_flags.rb b/ruby/t/tc_030_create_flags.rb new file mode 100644 index 0000000..7ec2ce9 --- /dev/null +++ b/ruby/t/tc_030_create_flags.rb @@ -0,0 +1,29 @@ +# libguestfs Ruby bindings -*- ruby -*- +# Copyright (C) 2013 Red Hat Inc. +# +# This program is...
2006 Jan 03
3
Rails Noob Question
...my fixture variable was nil: require File.dirname(__FILE__) + ''/../test_helper'' class MessageTest < Test::Unit::TestCase fixtures :messages, :tags, :messages_tags def setup @message = Message.find(1) end def test_create assert_kind_of Message, @message assert_not_nil @messages # assert_equal @messages["peace_message"].title, @message.title end end The three fixtures exist (messages, tags, messages_tags) and have data. Brute force tests (assert_equal "my message title", @message.title) pass. But the @messages["peace_message"][...
2014 Jan 13
3
[PATCH 1/3] ruby: Fix tests for out-of-tree build, simplify test scripts
...;)) require 'hivex' class TestRLenValue < Test::Unit::TestCase def test_RLenValue - h = Hivex::open("../images/rlenvalue_test_hive", {}) + h = Hivex::open(File::join(ENV['abs_srcdir'], '..', 'images', 'rlenvalue_test_hive'), {}) assert_not_nil(h) root = h.root() diff --git a/ruby/tests/tc_200_write.rb b/ruby/tests/tc_200_write.rb index b46dc7b..6ae239e 100644 --- a/ruby/tests/tc_200_write.rb +++ b/ruby/tests/tc_200_write.rb @@ -16,8 +16,6 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. require 'test/unit'...
2009 May 18
0
[PATCH server] fixed functional tests after recent controller refactoring and managed node controller fixes.
...esponse :redirect - assert_redirected_to :controller => 'dashboard' - - assert_equal num_hosts, Host.count - end - - def test_edit - get :edit, :id => @host_id - - assert_response :redirect - assert_redirected_to :action => 'show', :id => @host_id - - assert_not_nil assigns(:host) - assert assigns(:host).valid? - end - - def test_update - post :update, :id => @host_id - assert_response :redirect - assert_redirected_to :action => 'show', :id => @host_id - end - - def test_destroy - #FIXME: this controller method does nothing,...
2006 Jul 17
5
Functional Tests misbehaving with Globalize
Howdy all Apologies to the folks subscribed to the globalize list for dual posting this message... I''ve got a project running globalize and rails 1.1.4, and I''ve only recently adopted a strong love for testing. Now my models are 100% tested (I must note that I do not make use of any translations in the database yet), and I''ve now started with functional tests before
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 =&...
2005 Sep 12
0
WIN32OLE file context during unit test
...rb ============================== require ''test/unit'' require ''lib/illustratorminimal'' class IllustratorMinimalTest < Test::Unit::TestCase def testFullPath cs = IllustratorMinimal.new("D:/svn-sandboxFSFS/ruby/salesmapper/lib/../Test1 .ai") assert_not_nil cs.doc end def testFileName cs = IllustratorMinimal.new("..\Test1.ai") assert_not_nil cs.doc end End ======================================================================== ============ ======================= Test results =======================================...
2008 Jul 24
0
Re: Simple functional test fails
...tory.name, @rand_story.link > %></p> > - And finally this is the test: > class StoriesControllerTest < ActionController::TestCase > def test_should_show_index > get :index > assert_response :success > assert_template ''index'' > assert_not_nil assigns(:story) > end > end > > When running "rake test:functionals" it shows an error: "The error > occurred while evaluating nil.link on line #2 of stories/ > index.html.erb". This error belongs to "assert_not_nil > assigns(:story)" at the tes...
2014 Jan 13
0
[PATCH 3/3] ruby: Add test for "special" keys and values
...,0 +1,30 @@ +# -*- coding: utf-8 -*- +# -*- ruby -*- + +require 'test/unit' +require 'hivex' + +class TestRLenValue < Test::Unit::TestCase + def test_RLenValue + h = Hivex::open(File::join(ENV['abs_srcdir'], '..', 'images', 'special'), {}) + assert_not_nil(h) + + root = h.root() + assert_not_nil(root) + + nodes = h.node_children (root) + node = nodes.find { |n| h.node_name(n) == "abcd_äöüß" } + assert node != nil + value = h.node_values(node).find { |v| h.value_key(v) == "abcd_äöüß" } + assert value != nil +...
2006 May 16
3
Testing How To Question
I''m using the functional test for a method like this: def test_create post :create, :phase => ''copynew'', :id => 1 assert_response :success assert_template ''create'' assert_tag :content => ''New Item'' assert_not_nil @item end This posts a request to the create method in the controller. Is there any way to look at the variables and objects that were created in the controller by this post? It looks like you are only able to examine the resulting html output. Is that more of a unit test thing rather tha...
2008 Feb 08
2
update_Attributes stale Object error
Hi, IN one of my unit tests I get an ActiveRecord::StaleObjectError: Attempted to update a stale object object.save! in object I have apart from other stuff an after_save method, which calls object.assosication.update_attributes(...) If I remove that line from my code my tests succeeds. Unfortunetly, I do not understand why an update_attributes call can generate an StaleObjectError. Maybe
2006 Feb 01
3
Test data life cycle confusion
...erator created for me. Here''s a couple snippets: articles.yml: first: id: 1 published: 1 publish_on: 2006-01-24 14:50:30 articles_controller_test.rb: <snip> def test_edit get :edit, :id => 1, :version_id => 1 assert_response :success assert_template ''edit'' assert_not_nil assigns(:article) assert assigns(:article).valid? end def test_destroy assert_not_nil Article.find(1) post :destroy, :id => 1 assert_response :redirect assert_redirected_to :action => ''list'' assert_raise(ActiveRecord::RecordNotFound) { Article.find(1) } end And finally, t...
2006 Oct 19
1
Question about variable assignments/scoping after render call
I''ve got a question about how variables are made available to templates. We have a test that looks something like this: def test_variable_assigned xhr :get, :do_stuff, :id => 1 assert_not_nil assigns(:thing) end And our app code looks like this: class SuperClass < ActionController def do_stuff @parent_model = ParentModel.find(params[:id]) render :template => ''superclass/do_stuff'' end end class SubClass < SuperClass def do_stuff super...
2009 Jul 08
1
[PATCH: host-browser replacement 0/3] replacement of host-browser on ovirt-server
The purpose of this patch is to replace the identify function in host-browser.rb with a new script, host-register.rb. host-register.rb is a qmf ruby console that interfaces with the newly added matahari qmf agent on the ovirt node. While it stores node data in the database with the same behavior as the original host-browser implementation, it acquires the data using the amqp protocol (and
2006 May 20
3
Navigation between DB Items with active Record
Hi, I am having troubles to figure out how to move from one record to the other without using <find_by_sql> or other ugly tricks. So far, I have managed to do a lot of stuff without it but I decided that I need to learn how it works this weekend! So I need your help to figure that out... I have the following 4 models: class Client < ActiveRecord::Base has_many :client_variations
2007 Jan 04
10
Intermittent "can''t convert Float into Hash" and results.rb
Hi, I''m using backgroundrb 0.2.1 in a production environment and for most parts I''m very happy. We are using it to do some heavy video editing on the server side and it works great except that under, what seems heavy load the below problem happens intermittently. The problem has only happened 5 times out of over 500 runs by our backgroundrb worker. This is the code in our
2012 Mar 22
1
Rspec not loading fixtures
...= Factory.create(:step_5_registrant) stub(@registrant).merge_pdf { `touch #{@registrant.pdf_file_path}` } @registrant.generate_pdf @registrant.save! end it "provides a link to download the PDF" do get :show, :registrant_id => @registrant.to_param assert_not_nil assigns[:registrant] assert_response :success assert_template "show" assert_select "span.button a[target=_blank]" assert_select "span.button a[onclick]" end after(:each) do `rm #{@registrant.pdf_file_path}` end end **** And...