Displaying 20 results from an estimated 900 matches similar to: "Testing transactional updates in story runner"
2007 Nov 13
2
Spec slowdown
Is there something currently going on on the rspec trunk that causes
a massive slowdown when running rake spec and autotest (without
spec_server)? I updated to the latest trunk yesterday and the time
needed to run the specs of my app jumped from ~20 seconds to more
than a minute. The weird thing is that if I run the rake spec tasks
separately (controllers, models, views, helpers), they
2007 Sep 13
2
Failing to raise an exception in a stub
I''ve come across rather strange behaviour when trying to raise an
exception in a stubbed method.
I''m speccing the behaviour of a Rails create action, where I''m using
save! to catch failed saves. In the case of working save, I''m using
the following stub:
@client.stub!(:save!).and_return(true)
which works fine.
However, in the negative case,
2007 Nov 20
2
confirming that a model instance was correctly created from POST params
I''m wondering whether I''m wasting my time trying to verify that an addition I''ve made to legacy code is in fact setting a new attribute on a model.
Substruct''s (http://dev.subimage.com/projects/substruct) OrderHelper contains this method:
1 def create_order_from_post
2 @use_separate_shipping_address = params[:use_separate_shipping_address]
2007 Aug 03
0
acts_as_paranoid and Association Extensions (has_one troubles)
Hi... Isn''t there a proper way or hack/workaround for the following?
* For the example with unfortunate disabilities.. look below,,,
Usage of has_* (associationmethods) do {def with_deleted
AccociatedModel#with_scope} {Paranoid''s#find_with_deleted}...
The has_one associations give me a nil object when invoking it with
Model.association_OBJECT.with_deleted. Has_many does like
2008 Jul 07
0
ActiveRecord in Rails 2.1.0 misbehaving for Aggregate Attr.
I am not sure if this is a bug in ActiveRecord or is this the intended
behavior. If it is then it does not make sense to me.
In a nutshell: If you change an aggregate object attribute created via
composed_of method (see Agile Web Development - Second Edition Chapter
17 page 313 onwards) and then save the model, the change to the model
(composite attribute specifically) will not be saved UNLESS
2009 Jun 24
1
accepts_nested_attributes_for :reject_if issue
I have the following models:
class Order < ActiveRecord::Base
belongs_to :billing_address
belongs_to :shipping_address
accepts_nested_attributes_for :billing_address
accepts_nested_attributes_for :shipping_address, :reject_if => proc {
|attributes| attributes[''has_shipping_address''] != ''1'' }
def after_initialize
self.build_billing_address
2008 Dec 02
4
Am I wrong or is fields_for not working right in Rails 2.2.2
I may be totally wrong about what the fields_for method is supposed to
do, but for some reason I thought using it scoped an object around an
association.
For example, I have a User class and when you''re creating a new user I
want to use fields_for to add a BillingAddress to the user like so:
<%- fields_for :billing_address do |billing_address_form| -%>
<%= render :partial
2009 Mar 10
0
autosave no longer a valid option for belongs_to?
The Rails API doc (api.rubyonrails.org) says that :autosave is still a
valid option for belongs_to in the latest version of Rails. However, a
look at the activerecord/lib/active_record/associations.rb (line 1590)
reveals that it is not in the @@valid_keys_for_belongs_to_association
array. I also noticed that it''s not in the ActiveRecord API doc
(ar.rubyonrails.org).
Does anyone have any
2005 Mar 10
0
RE: Confused about extending the login generator ''user'' [fixed]
>> that should be "belongs_to :user_type"
Bingo!
-----Original Message-----
From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
[mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Jarkko Laine
Sent: Wednesday, 9 March 2005 6:59 PM
To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
Subject: Re: [Rails] Confused about
2005 Apr 25
1
Problems when using sweepers with postbacks
I''m using a cache sweeper class [1] to take care of some pretty complex
sweeping. However, there is a problem with the current implementation.
Namely, the sweeper gets called only when an action named in
cache_sweeper is called using GET. As many methods where sweeper would
be useful are using postback to send the form to the same action, this
causes the cache to get swept when
2009 Feb 26
1
composed_of, aggregate object isn't saved
I am relatively new to rails and I cannot figure out what is going on
here. I am using the composed_of method in an ActiveRecord class to
create two aggregate properties: shipping_address and billing_address.
The object properties are getting populated from the form and validation
is working - no problem. When I call order.save, though, everything is
being saved except the address fields. I am not
2006 Aug 11
5
Unit tests - NilClass problem
Hi!
Yesterday I started to write my unit tests for the fist time using
rails. I''m using this method:
http://blog.codahale.com/2005/12/23/a-rails-howto-simplify-your-unit-tests/
My customer_test.rb looks like this:
require File.dirname(__FILE__) + ''/../test_helper''
class CustomerTest < Test::Unit::TestCase
fixtures :customers
# Replace this with your real
2006 Jun 06
1
Please Help with single table inheritance relationships
I''ve been searching the web, wikis, and more, and I haven''t turned up
examples of how to have multiple entities in a single-table inheritance
related to anything.
I have an addresses table, but multiple entities can have Addresses:
both Person (which has 2 addresses) and Retailer. I''ve been told that I
need to use single-table inheritance, and this was my attempt:
2006 Jul 30
3
ActiveRecord - Multiple Address for a single record
I''m trying to figure out the Rails way to model the following problem:
I have 2 tables. One (let''s call it location) contains a single
address. The other (let''s call it company) contains 3 address. I''m
trying to figure out the best way to model this. I''ve created an
address table, a set up the model as follows:
class Address <
2006 Jul 27
0
Controllers, Models, and Validations...
Hello,
After listening to DHH''s 2006 RailsConf keynote, I decided to take a
leap on my current application and do a little more re-organizing to
make it more CRUD-based. As such, I ended up changing some things
around to get this (simplified):
User has_many :enrollments, :conditions => ''status > 0''
User has_many :schools, :through => :enrollments
User has_many
2007 Nov 12
2
Using the mock framework in story runner
Hey all,
What is the easiest way to include rpec''s mocking framework into a story
so I can use it? I want to use it to stub out a Net::HTTP method so I''m
not making API calls every time I run my story. :)
Thanks,
Ben
2007 Oct 02
1
flash in story runner
hi,
is there a way to assert a flash message directly in story runner? Or
do I have to go through the response text instead.
Then "flash message should say success" do
#flash[:notice].should == "User successfully invited"
response.should have_text(/User successfully invited/)
end
linoj
2007 Oct 05
1
Rake & Story Runner
So, having gotten a story (i.e. Story Runner) working (runs in NetBeans and
using ''ruby path/to/story.rb''), I''m looking to see how I''d integrate that
with our build.
Am I right in assuming that there''s no Rake integration yet, or a report? I
couldn''t see any. As far as I can see, "rake spec" doesn''t run or report
on my
2007 Oct 14
1
Story Runner: DRYing items used in many stories
The number of stories I have is growing and I''m writing the following step
long hand in each story.
Given ''a user named'', ''Andy'', ''Watts'' do |first_name, family_name|
@email = first_name + ''@test.lan''
create_user( :first_name => first_name, :family_name => family_name,
:email => @email )
2007 Oct 15
0
Story Runner: ''When..Then..Then..Then'' stories
Maybe I''m slow, but I just noticed that the following code..
Then ''I login''
Then ''I do something else''
...will output as...
Then ''I login''
And ''I do something else''
The same is true for two ''When'' steps
This may have implications for writing reusable steps.
I''m finding that