similar to: flash.now in functional tests

Displaying 20 results from an estimated 60000 matches similar to: "flash.now in functional tests"

2006 May 05
1
testing for flash.now values
Is there any way in a functional test to get the value of the flash hash if the value was set using flash.now? It doesn''t appear to be visible in flash in the test. Example: Controller: def index flash.now[''notice''] = ''this is the index'' end Functional Test: def test_index_flash get :index assert_equal ''this is the index'',
2006 May 10
0
Ezra''s acl_system2 and flash not getting populated in functional tests
Hi all, I am using the LoginGenerator and Ezra''s acl_system2 to protect certain actions in my controllers. I have written some functional tests to check for correct handling of redirects, flashes, etc. The flashes however only get populated on the first get action in any given test. Here is what I have so far: In the controller: class PageController < AC before_filter
2009 Jul 01
1
[PATCH server] fixed expected status messages that were failing unit/functional tests.
--- .../functional/cloud/instance_controller_test.rb | 2 +- src/test/unit/vm_service_test.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/functional/cloud/instance_controller_test.rb b/src/test/functional/cloud/instance_controller_test.rb index 71d132b..0d713d4 100644 --- a/src/test/functional/cloud/instance_controller_test.rb +++
2006 Jul 31
2
Testing the flash.now
What''s the best way to test the flash when you use flash#now ? For example, if I set the flash in my controller: flash.now[:notice] = ''This will only show up on this action.'' How do I test it? Normally I would do: assert_equal ''This will only show up on this action.'', flash[:notice] But this doesn''t seem to work with flash.now. Any
2009 May 18
0
[PATCH server] fixed functional tests after recent controller refactoring and managed node controller fixes.
Signed-off-by: Scott Seago <sseago at redhat.com> --- src/test/functional/host_controller_test.rb | 41 -------------------- .../functional/managed_node_configuration_test.rb | 14 ++++--- src/test/functional/nic_controller_test.rb | 8 ---- src/test/functional/permission_controller_test.rb | 15 ++++--- src/test/functional/quota_controller_test.rb | 2 +-
2006 Nov 04
0
Functional test issue for testing newbie
Hi there I''m having difficulty succesfully updating attributes via a post request in a functional test. Here''s some pastes: ###################################### # account_controller.rb def edit_details @user = User.find(self.current_user.id) return unless request.post? if @user.update_attributes(params[:user]) flash[:notice_good] = ''Your account details
2006 May 03
0
Accessing the params hash in a functional test not working
I am having problems reading params in a functional test (Rails 1.1.2). My test looks like this: fixtures :users def test_auth_bob @request.session[:return_to] = "/bogus/location" post :login, :user => { :email => "bob@example.com", :password => "test" } assert_session_has :user assert_equal @bob, @response.session[:user]
2006 Feb 08
1
functional test problem
I am trying to write a test for my delete method. I find a User in the db by its id, do the delete action, then I want to see 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
2005 Nov 16
3
controller before_filter issues
Hi, Some controller filters: before_filter :require_logged_in, :only => [:create, :new, :confirm] before_filter :init_players, :only => [:create, :new, :confirm] The first one, you guessed it, redirects a user if he''s not logged in. Now when I hit this page and I''m not logged in, the 2nd filter gets executed and throws an error, because it depends on the user
2007 Jan 21
0
Functional Test Fails with before filter in application.rb
Hi There, I am trying to write my first tests for a role bassed authentication taken from Rails Recipies. Whenever I add: assert_redirected_to :action => ''login'' I get the following error: NoMethodError: undefined method `first'' for :user:Symbol /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/assertions/response_assertions.rb:72:in
2006 Mar 11
1
how to test flash.now?
Hi gurus How to test that controller actions sets flash.now[:info] I cannot test it from standard functional TestCase since it is eradicated after action execution. Standard flash hash can be tested freely within TestCase... Eg. flash[:info] Thanks in advance Szczepiq
2006 Apr 17
0
Rails 1.1.2 Flash in Functional Tests
I am unable to get the value of flash[:message] in the test case, where as i am able to get the value of flash[:error] & flash[:notice]. The tests work properly in rails 1.0, is it a bug or a feature added to rails so as to restrict the use of flash. Regards Suraj
2006 Jun 07
1
Flash Problem In Functional Test
I''m having some trouble with functional tests for a Rails application. I recently upgraded to version 1.1.2 of Rails and I have since noticed that I have a problem with flash notices in my functional tests. I''m not saying that the upgrade is necessarily the cause but the tests were working before. When I run the tests now and I expect the flash to contain a particular
2012 Mar 14
0
How do I create a new object in testing to test a controller?
I''m using Test::Unit to do functional testing on one of my controllers. The action I want to test is create, from SessionsController. I have simplified it to the extreme: def create @user = User.find_by_email(params[:email]) if @user flash.now[:notice] = "ok, it exists" else flash.now[:notice] = "it does not exist" end render :new end This is my
2006 Apr 02
16
12 / 16 = 0
Hi, Just thought it was weird that Ruby doesn''t automatically cast ints to floats. Seems so un-rubyish irb(main):006:0> 12/16 => 0 irb(main):007:0> 12.to_f / 16.to_f => 0.75 Jeroen
2005 Oct 17
8
Using active record for SELECT MAX(column) FROM ...
Hi, Is there an easy way of querying an active record for a maximum column value? I need to do queries like: SELECT MAX(salary) FROM employees TIA, Jeroen
2007 Jan 11
0
Functional tests with actions that send files
I have a number of actions that use the spreadsheet/excel library to generate an Excel spreadsheet based on model data and send it to the user using the send_file method. For a while, I''ve been testing these methods with assert_response :success, and then checking the response headers to make sure the file at least looks like what I should be getting. But it occurred to me recently that
2006 Apr 03
0
Cookies and functional tests
Hi there Is there any way that my functional tests can check to see if the controller has set a cookie? I''ve got this in a controller action; def login cookies[:foo] = ''bar'' end Using a web browser, I can see that the cookie is being set when the action is invoked. But, a functional test like this; def test_cookie assert_equal nil,
2007 Mar 22
1
Functional test and flash with an error
I''m getting this error thats moaning about expected tag, but no tag found matching {:content=>"User James Apps was successfully created.", :attributes=>{:id=>"notice"}, :tag=>"div"} in the file application.rb. I tried using a regular expression - /#{user.first_name}/ , but that wouldn''t work either user_controller_test.rb 1) Failure:
2005 Oct 30
1
attaching the debugger to functional test.
People, I''m trying to run the ruby debugger against a Test::Unit::TestCase class which is a parent of a Rails class. I started my study with a simple script: # # bikle_test.rb # require ''test/unit'' class BikleTest < Test::Unit::TestCase def setup @string10 = "hello" end def test10 assert_equal @string10, "hello" end end The