similar to: long jumping out of code in specs

Displaying 20 results from an estimated 1000 matches similar to: "long jumping out of code in specs"

2007 Jan 08
2
thoughts on mocks and specs
I spent the last couple of days getting my sea legs with Rails and RSpec. I''d been waiting til things seemed calmer before jumping in, and I''m overall very happy with my experience so far. My only real annoyance so far has been forgetting to call "do_post" or "do_create" from my specify blocks. My mocks don''t get the calls they want, and it usually
2007 Jun 23
4
inverse examples? (should fail)
The new "pending" example feature reminds me of a feature I''ve been bouncing around in my head, to aid in refactoring. Often, when I''m changing existing behaviour, I know that certain aspects of the old behaviour should change. Imagine changing the "it" method to perhaps "not" or "old" or "removed"... The behaviour would be to
2007 Feb 11
1
Specing Rails Views
Hello - I''m currently trying to write some specs for my rails views. My views depend upon the restful authentication plugin method logged_in? Like so, <% if logged_in? %> <ul id="product-admin-nav"> <dd><%= link_to "create a new product", new_product_url %></dd> </ul> <% end %> However, when I have the following
2006 Nov 25
2
Comparison between RSpec and test/unit
I''m curious, Christian Neukirchen has released test/unit[1] that seems to mirror much of RSpec, but built on Test::Unit, so in some ways less brittle from a Rails-integration perspective, and also allowing you to mix the two together as appropriate. So, has anyone made an informed comparison? I''m new enough that I don''t really know the finer points yet. The syntax is
2007 May 31
16
Could anyone please help with rspec/nested resource behavior checking?
My problem has been listed here: http://railsforum.com/viewtopic.php?pid=25439#p25439 Don''t think it would be required to completely re-type it here :) Thanks! -- -Daniel Fischer http://danielfischer.com - Geek Blog http://abigfisch.com - Portfolio http://writersbeat.com - Writing Community
2006 Nov 22
3
Controller Isolation
Hi, I have a project that I had running under rspec 0.6.x and recently upgraded to 0.7.2. I am trying to isolate my controllers from the database as I go through and change all the specs to run under 0.7.2. I am having a problem where I need to make the create! method return the mocked object as well as raise RecordInvalid exception. Is this at all possible? I use the rescue statement in my
2006 Dec 13
4
RSpec and simply_helpful
Hi All I''m having some problems running my view specs when using simply_helpful. I have it semi-working via the following: module SimplyHelpfulHelper def self.included(base) base.send :include, SimplyHelpful::RecordIdentificationHelper base.send :include, SimplyHelpful::RecordTagHelper end end context "The index template" do setup do @shift =
2006 Apr 10
3
form_remote_tag can only have one submit button?
I setup a form_remote_tag with several submit buttons, all of them share the same name ( ''do_action'' ) and their values differ. eg. button1 named do_action with value ACTION1 button2 named do_action with value ACTION2, etc No matter which button I press the value passed is always the one defined for the first of these buttons ( the correct value associated with the pressed
2007 Jun 23
6
Autotest bug with rerunning passing tests?
Am I correct in remembering that autotest (with Test::Unit) would rerun all the tests if a subset of the tests passed? If so, shouldn''t this behaviour also be present in rspec''s autotest library? Scott
2009 Jul 21
2
Machinist - having problems stubbing an after_create filter
Hi all I''m moving to using Machinist in my rspec tests and am having a problem with an after_create callback method that i need to stub out. It seems like calling ClassName.make will trigger this callback before i''ve had the chance to stub it. Can i stub it in my blueprint for that class? Or, can i stub the method for all instances of the class before i call ClassName.make?
2009 May 25
4
after_create and has_one association bug?
Hello, I''ve come across an issue that I''m sure is a bug when using after_create with a has_one association, but I''m not 100% certain if I''m missing something. This is pretty much exactly the code I''m using. Two simple classes (Account and Contact) and I create the contact after I create an account (via after_create). I''m not passing in a
2006 Oct 28
5
RSpec, REST and different formats
Is anyone using RSpec with RESTful rails apps? In my rails controllers I check request.respond_to? and render different views accordingly. I noticed that the get method in the rails plugin doesn''t accept headers: controller_mixin.rb line 92 def get(action, parameters = nil) @request.env[''REQUEST_METHOD''] = ''GET'' process action,
2009 Mar 29
2
after_create and after_save
Hi, AFAIK after_create is called after_save if the entry does not exist in the DB. Is there a way to tell if a specific model is new or not in after_save? I have to do something like: def after_save add_to_history ''save'' end def after_create add_to_history ''create'' end However after_save is called when creating too. -- cheers, M.
2011 Dec 02
2
problem setting expectation for test with delayed::job
I''ve got something like this: # post_observer.rb after_create # ...stuff Delayed::Job.enqueue(PostSharer.new(post, post.user)) end ... # post_sharer.rb class PostSharer < Struct.new(:post, user) def perform # Delayed::Job calls .perform on the object passed into enqueue end end # post_controller_spec.rb it "shares the post" do
2007 Mar 28
14
Autotest
Is anyone using rspec with autotest? Scott
2006 Jul 18
7
Observer not working
Help please. I''m trying to observe a User class, but I can''t get this to work, the after_create method never gets called... (the breakpoint never gets called) app/models/user_observer.rb: class UserObserver < ActiveRecord::Observer def after_create(user) breakpoint setting =
2006 Oct 11
1
Retiring test2spec?
Hi all, We''re thinking about retiring the test2spec translation tool because it''s becoming a maintenance problem. Is anyone using it? Would anyone miss it if it went away? Aslak
2006 Aug 14
2
after_create is not being called
Hi all I have the following model: class PhotoGallery < ActiveRecord::Base attr_accessible :title, :description, :file_path, :title_photo_id has_many :photos, :dependent => :destroy belongs_to :title_photo, :class_name => ''Photo'', :foreign_key => ''title_photo_id'' validates_presence_of :title, :description, :file_path
2006 Dec 08
0
RSpec impressions
After a long week agonizing over a scheduling library, and then specing it out rather quickly, I''ve got some work I''m pretty happy with. As a contrast to Test::Unit, I like the way RSpec spreads my attention around the codebase while I concentrate on implementing specific behaviours. In Test::Unit, I tend to write tests around the private methods of the object under test. I
2006 Aug 17
4
Automatically creating associated records with after_create
Hi all. I am actually using ActiveRecord outside of Rails but I don''t see that it matters for this question. I want to automatically create a registration entry when I add a new user to my application. This works fine, but it''s not automatic: class User < ActiveRecord :: Base has_many :registrations end class Test user = User.new user.registrations.create end