search for: assert_difference

Displaying 15 results from an estimated 15 matches for "assert_difference".

2007 May 08
3
assert_difference eval magic in [6693]
I just saw Marcel''s change to assert_difference that changes the method API to take a string param that is evaled in a lambda. http://dev.rubyonrails.org/changeset/6693 I much preferred the old API, since it''s simple enough to pass a lambda. Passing a string means the lambda is in the wrong scope and doesn''t have acces...
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
2007 Oct 17
1
Problem with assert_difference
Hello Friends, I have problem with assert_difference, I want its syntax and explantion in detail, Please help me, plz give me solution. Regards, Kiran Polawar --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, s...
2009 Apr 30
1
error with test:functionals
Hello there, I working on my tests but I getting this strange errror: I can see on the database that the object was created but I still got an failure on my test. this is my test code: test "should create artist" do assert_difference(''Artist.count'', difference = 1) do post :create, :artist => { } end assert_redirected_to artist_path(assigns(:artist)) end and this is my failure message: 1) Failure: test_should_create_artist(ArtistsControllerTest) [/Users/bonacode/Desktop/arteacesso-br/a...
2012 May 22
0
functional tests assert_difference with array
given a new partner instance and a new admin instance are created, what should be the difference number : +1 or +2 the doc is not so clear on it.... assert_difference [ ''Partner.count'', ''Admin.count'' ], +1 do... thanks for 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/E...
2006 Dec 04
5
should_be_different -- possible implementation
There is an assert_difference helper for Test::Unit (you can read about it at http://blog.caboo.se/articles/2006/06/13/a-better- assert_difference and to some it should look familiar -- you know who you are :), so I took a shot at one for rSpec on Rails. class Object def should_be_different(method = nil, difference...
2011 Aug 02
1
Rspec teting API.
Hi! Guys, I wanna test an API built in Rails 3.0.3. So, my question is... What''s the better way to test my own api? I guess that a requests specs like these: describe ''POST /client'' it ''works'' do assert_difference post ''/clients'', :client => {...} end end can be appropriate... Someone just tested an API? I mean... simulate the requests to API. Tks! -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments...
2008 May 13
0
assert_no_difference question
...def create_avatar(options = {}) Avatar.create(:description => "Foo Descr.").merge(options) end (Borrowed from the user test in acts_as_auth...) It seems to pass, as my avatar model has: validates_presence_of :description written. However, if say I try to force it to fail with assert_difference... it still passes. What did I miss? --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org...
2010 Apr 05
1
`test': wrong number of arguments (1 for 2) (ArgumentError)
...end class AccountsControllerTest < ActionController::TestCase fixtures :accounts def setup @controller = AccountsController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new end test "should allow signup" do assert_difference ''Account.count'' do create_account assert_response :redirect end end protected def create_account(options = {}) post :create, :account => { :name => ''who'', :email => ''who-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org'...
2013 Sep 23
1
redirect on browser success, but redirect on functional test is error
...roy respond_to do |format| format.html { redirect_to @cart } format.json { head :no_content } end end line_item_controller_test.rb: setup do @line_item = line_items(:one) end test "should destroy line_item" do @cart = @line_item.cart assert_difference(''LineItem.count'', -1) do delete :destroy, id: @line_item end assert_redirected_to @cart end ---------------------------------------------- rake test:functionals 1) Error: test_should_destroy_line_item(LineItemsControllerTest): ActionController::ActionControllerEr...
2014 Feb 11
0
Cucumber test question
...fo Scenario: notification for empty shirt size Given there is at least 1 staff info record When the shirt size field is empty And the shirt size check is run Then the system should send an email notification Steps: Given(/^there is at least (\d+) staff info record$/) do |arg1| assert_difference('StaffInfo.count', 1) do @staff_info = FactoryGirl.create :staff_info end end When(/^the shirt size field is empty$/) do assert @staff_info.update_attribute(:shirt_size, nil) end When(/^the shirt size check is run$/) do StaffInfo.check_empty_shirt_fields end Then(/^the system s...
2008 Feb 05
1
Functional Test has error when testing controller updates_attribute of its parrent.
I am working in Rails 2.0 and I have the following functional test. class VotesControllerTest < ActionController::TestCase def test_should_create_vote assert_difference(''Vote.count'') do post :create, {:vote => {:vote_value => 5, :user_id => users(:nick).id, :entry_id => entries(:BmxEntry).id}}, :user_id => users(:nick).id end assert_redire...
2007 May 29
12
questions rspec on rails
...mailer specs? - Do you have recommendations for using authentication? should i load a users.yml fixture or setup users some other way? (my controllers and views may check for current_user, logged_in?, etc) (I use restful_authentication) - this may not be rspec at all, I''m calling assert_difference (defined in /lib/authenticated_test_helper.rb) with 3 args but get an error that it expects 2. Is there another version of this method somewhere? I cant find it. If i rename the one i know and call that (eg assert_difference3) its ok. - do any of you also use topfunky_power_tools (ref pee...
2007 Mar 22
1
Functional test and flash with an error
...9:in `clean_backtrace'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/assertions/tag_assertions.rb:99:in `assert_tag'' test/functional/admin/user_controller_test.rb:49:in `test_create'' test/functional/admin/user_controller_test.rb:40:in `assert_difference'' test/functional/admin/user_controller_test.rb:40:in `test_create'']: expected tag, but no tag found matching {:content=>"User James Apps was successfully created.", :attributes=>{:id=>"notice"}, :tag=>"div"} in: "<!DOCTYPE htm...
2012 Jan 18
3
Cannot redirect to nil!
I need some help please.. when I created web application about books market, i create a cart and using test the message error appear like this on rake test:functionals LineItemsControllerTest > test_should_create_line_item > ERROR > Cannot redirect to nil! and also appear on web side, thats error told that "Cannot redirect to nil!" Then i was checking the code,