similar to: functional tests assert_difference with array

Displaying 20 results from an estimated 70000 matches similar to: "functional tests assert_difference with array"

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
2010 Dec 25
7
I sit possible to write it in one line ? Array init + Array loading
I am always writing it in 2 lines : ( Array init then loading the array ) @providers = [] @authentications.map {|authentification| @providers << authentification.provider } Is there any Ruby writing for writing just one line ? thanks fyh -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group,
2010 Aug 12
4
[Rails 3] How to test routes urls in console
I tried require ''url_writer'' but this is not the trick what should be required/included to test the routes urls ? thanks erwin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this
2012 Oct 16
8
<form> tag is self-closing before input fields .. (HAML generator used)
The form is inside a table, enclosing a <tr> = form_tag admins_backoffice_dashboards_path, :remote =>"true" do %tr.search %th= link_to t(:clear), "#", :id => :clearFilter %th= select_tag :role, options_from_collection_for_select(Role.global, :id, :name, :selected => @role_id ) %th= text_field_tag :email, nil, :value
2011 Oct 20
2
Rails 3.1.1 why public/system content is not transferred upon deployment
Testing locally I uploaded files into public/system/... folders ( default for Paperclip) Upon deployment ( capistrano) on the remote server, I can see a symlink from public/system to the shared/system/ but the content ( all images ) is not transferred.... I had to do it myself via ftp .. Is it a standard behavior ? or did I miss adding a task in the deployment ? thanks for your feedback --
2012 Mar 26
3
render :json not sending any data back ...
[rails 3.2.2] I perform an ajax call : ... $.ajax url: " /backoffice/expenses/rate" type: "GET" dataType: "json" data: project_id: $(''#project_id'').val() code: $(this).val() success: (result) -> alert result $(''#expense_price'').val(result) in
2011 May 17
2
Can't dump File ... when uploading files
I am getting this error on the redirect_to command ... I am using Rails 3 w Paperclip to upload files ( but I tried also CarrierWave .. same error) I tried to change the session store from cookie-based to database .. same error I tried to delete the params content ... I don''t know what to try next .. any clue ? thanks erwin -- You received this message because you are subscribed to
2012 Nov 09
8
method conditional option pattern
When I have this pattern sign_me(@user, :event => :authentication, :subdomain => subdomain) how can I write it to avoid sending the :subdomain option if subdomain.nil? ( if possible ..) sign_me(@user, :event => :authentication #?, :subdomain => subdomain unless subdomain.nil? ) -- You received this message because you are subscribed to the Google Groups
2011 Apr 23
3
Rails3 how to scope it, using a serialized array ?
giving a simple model, with a serialized Array attribute class Instructor < User .. serialize :languages, Array I am looking in defining scopes like this : >scope speaking_english, lambda { where("languages ... includes.... ?", :en) } which look for instructors in which the languages array include ":en" Is this kind of scope possible ? or not.... ( just using
2010 Aug 18
2
[Rails 3] remote_function ?
Is the remote_function still valid in Rails 3 as it seems many of the Prototype helpers have been replaced ? (link_to_remote, ...) where can I find any link on it ? not in the standard doc I guess .. thanks for you feedback -- 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
2011 Feb 27
10
How to store the same key multi times in a Hash ?
given an Arra tags[] I need to produce a resulting Hash as following .. { "$in" => [tags[0]], "$in" =>[tags[1], ...} in which the key should be always the same and the value being an Array I tried this : myHash = {} tags.each do |tag| h = {"$in" => [tag]} myHash.merge!(h) end but the merge! is only
2011 Nov 15
4
Need some guidance on running shell commands from my app..
During execution in my Rails web app, I need to create a virtual host config on my Linux server, but I don''t know what would be the best way to do it , here are the steps ( my_domain.com is fixed, only my_subdomain is changing dynamically 1- create: /var/www/vhosts/my_domain.com/subdomains/my_subdomain/conf/ vhost.conf ServerName mysubdomain.mydomain.com .. content is always the
2012 Dec 04
2
[Rails 3.2] validation on create not working
class Place < ActiveRecord::Base validates :description, :presence => true validates :description, :uniqueness => {:case_sensitive => true, :on => :create } # also tried # validates :description, :uniqueness => {:case_sensitive => true }, :on => :create On update ( in form fields, updated label, same description ) params
2006 Aug 06
2
assert_difference gives undefined method error in unit tests
Hi there Am hitting undefined method errors for ''assert_difference'' in my unit tests under Rails 1.1.4 What could I be missing? Richard Sandilands
2012 Jan 15
2
ruby-debug19 error undefined symbol: ruby_current_thread
I am trying to deploy a Rails app ( Rails 3.0.9 / Ruby 1.9.2 ) in production (Debian 6) it''s running fine in development mode on localhost ( OSX) I am getting this error from Passenger : undefined symbol: ruby_current_thread /var/www/vhosts/mydomain.com/rails/testsbga/shared/bundle/ruby/ 1.9.1/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.so: undefined symbol: ruby_current_thread -
2010 Mar 23
7
redirection in format.json ...
I have presently a render :json which modify the current page if @request.save format.html { redirect_to(@request) } format.json { render :json => { :result => ''success'', :request => request_path(@request) } } .... but I would like rather to redirect to an index page I wrote this but it doesn''t redirect ... format.json {
2010 Jul 08
1
[Rails3] Issue in modifying locale and redisplaying page
In a test app, I have a drop-down selection to change the language of the site. I use an Ajax request to an action in which the locale is changed, and the it''s redirected to the home page unfortunately, the locale seems to be changed but the home page doesn''t reflect the new language .. application_controller.rb .. before_filter :set_locale def set_locale I18n.locale =
2010 Apr 05
1
`test': wrong number of arguments (1 for 2) (ArgumentError)
Hi, Im trying to change the syntax of my tests to the test "some method" do ... end syntax from the existing def test_some_method ... end syntax. Im pasting my test code below. Im getting the error in the subject line if I try to run the test as a ruby script from the console. require File.dirname(__FILE__) + ''/../test_helper'' require
2011 Dec 05
2
How to bypass a create record after validation wo error ?
I have a specific signup process to handle, and I am turning around the solution wo finding a clear validation ... a visitor fill in a User Registration form ( email /pwd /pwd confirmation ) I wrote a UserValidator class to check the uniqueness of the email field # if no user registered w this email, then no error , can proceed to create User.where(:email => self.email).empty? # no
2011 May 16
2
Cannot get multipart => true , running well in my form when using remote => true
I have a simple form , with a file field = form_for (Clip.new), :html => {:multipart => true} , :remote => true , do |f| = f.hidden_field :user_id, {:value => current_user.id} = f.text_field :name = f.text_area :description = f.file_field :image = f.submit I18n.t(:add) generating the html code <form accept-charset="UTF-8"