similar to: What does assign method do in testing ?

Displaying 20 results from an estimated 1200 matches similar to: "What does assign method do in testing ?"

2013 Sep 23
1
redirect on browser success, but redirect on functional test is error
line_items.yml: one: product_id: 1 cart_id: 1 quantity: 1 carts.yml: one: {} product.rb: has_many :line_items cart.rb: has_many :line_items, dependent: :destroy line_item.rb: belongs_to :product belongs_to :cart line_item_controller.rb: def destroy @line_item = LineItem.find(params[:id]) @cart = @line_item.cart @line_item.destroy respond_to do |format| format.html
2006 Jul 08
4
Hidden fields in forms
Please can someone show me the correct syntax for a hidden field in forms, this is my code <%= start_form_tag :action => ''create'' %> <div class="form1"> <table width="auto" boader="8" cellspacing="5" cellpadding="5"> <% hidden_field ''line_item'', ''client_id'', :value
2007 Nov 20
3
How to test views with Nested Resources and Partials
Hi everyone, I am relatively new to rspec and I am running into a wall in testing my views. I have a RESTful resource Contracts with a nested resource of Line_items. I am trying to figure out how to test the "edit" form of the Line_items. What complicates this is the nested routing and how to account for it, and that there is a partial form (_form.haml) that both the edit.haml and
2006 Jul 11
0
assert_redirected_to not recognizing routes
I''m getting a weird error in a call to assert_redirected_to in one of my functional tests. Here is the test: def test_signin admin = users(:adminuser) post :signin, {:login => admin.email, :realpass => @password} assert_redirected_to :action => ''list'' # failure happens on this line assert_equal admin.id, session[:user].id end The error
2010 Feb 19
2
Problem with assert_redirected_to
I have taken over some old Rails code and am trying to get the tests to run. In the functional test every time the assertion ''assert_redirected_to'' is called I get the following error: test_should_update_venue(VenuesControllerTest): NoMethodError: undefined method `[]'' for #<Enumerable::Enumerator:0x102f747e0>
2005 Oct 14
0
Adding extra field in form using ajax causes extra field to be overwritten, any way around that.
I''m having trouble when I try to add another field in the form using ajax. I''m trying to add another line_item object into the invoice and i''m using the link_to_remote function to implement this. When I do that though and submit to the form, the line_item entries all have the same field name so they get overwritten. I''m not sure how to get around that. Here is
2005 Apr 10
2
Browsing Problems
Hello. I've got a Samba server and I'd like it to be master browser and everything else except domain controller (the customers wants a workgroup, not a domain). Lately a Windows 2003 server was added to the net and then I guess it was removed. I keep getting messages like the following in the logs: > Apr 10 03:07:51 apocalypse nmbd[57552]: [2005/04/10 03:07:51, 0]
2007 Oct 17
9
@session['user'] vs session[:user]
This might seem really simple to some but just wanted to ask: what is the difference between @session[''user''] and session[:user] ? and how would you use each? And another question, I have the following code: def get_customer if @session[''customer''] @c = Customer.find(@session[''customer'']) end end private def
2006 Jul 01
3
best approach to add form elements dynamically
I am struggling with how to add dynamically add form elements to a form based on user action. Now here is my situation: I have model Project that has_many line_items On the form to create a project I initially display form elements (some drop downs and text boxes) for adding just one line_item. There is also a button or a link on the page (not sure if this should be in the main form or
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 Jun 17
3
What is this failure trying to tell me?
Here is my unit test code. post :login, :user=>{ :login => "bob", :password => "test"} assert_response :redirect assert_session_has :user assert_redirected_to :action => ''welcome'' Here is the failure I''m getting when I run my tests. 2) Failure: test_login_required(UserControllerTest)
2006 Mar 22
0
assert_redirected_to behaviour
Consider following situation: you''ve got controller Foo that has following routing rules related: map.connect ''/foo'', :controller => ''foo'', :action => ''index'' map.foo ''/foo/:x/:y/:z/:action'', :controller => ''foo'' You want all Foo actions to make use of partial url rewriting, so instead
2007 Dec 24
1
Uninitialized constant in integration test
I am seeing weird issues when trying to create integration tests. Here is a very simple example of something that is failing. The assert_redirected_to, and other methods, fail with this or similar exceptions. I have tried requiring both ''application'' and ''listings_controller'', but neither solves this problem, although the exception changes. Anybody know
2005 Mar 06
3
question about testing
Ok, so now I''m learning about testing. After a few initial hiccups, I''ve got my tests written nicely and all the assertions are passing. But I just have one question about doing tests in a loop. In my setup, I''m using the login generator to protect ''sensitive'' actions, while some actions are public. So I''ve got this line in my setup method:
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 +-
2011 Aug 02
1
NoMethodError in Store#index
Thanks in advance I want to know how to solve No method errors Agile Rails 4th ed Great book But second time I get this type of error I would like to know how to troubleshoot and resolve Please see below thanks once again NoMethodError in Store#index Showing C:/rails/shop9/app/views/line_items/_line_item.html.erb where line #9 raised: undefined method `title'' for nil:NilClass
2006 Feb 16
9
association not inserted automatically.
Hello, I am trying to write a sample application. I have class LineItem< ActiveRecord::Base belongs_to : order end && class Order < ActiveRecord::Base has_one :line_item end Now in the controller i am trying : def add @ord = Order.new(params[:ord]) @ord.line_item = LineItem.new(params[:lineitem]) if @ord.save redirect_to :action => ''list'' else render
2006 Dec 11
1
assert_redirected_to error
I''m new to TDD in rails, I''m getting this weird error with assert_redirected_to. Here''s my test: def test_friendship_request_accept @request.session[:user] = users(:nathan).id get :accept, { :id => 1 } assert_redirected_to :controller => "/users/profile", :action => "index", :id => users(:nathan).id end When I run this I
2006 Aug 03
2
Failing test with assert_redirected_to
I''m having a strange problem with an assert_redirected_to in my controller test which hopefully someone can point out my failings with! ;) Controller method - def new if request.post? #Not important here. else flash[:notice] = ''Please join a tree from this page.'' redirect_to :controller => ''trees'', :action =>
2010 Aug 16
0
assert_redirected_to partial assertion does not work?
Hi, From the docs I see: http://api.rubyonrails.org/classes/ActionController/Assertions/ResponseAssertions.html This match can be partial, such that assert_redirected_to(:controller => "weblog") will also match the redirection of redirect_to(:controller => "weblog", :action => "show") and so on But it my case it does not work. As