Displaying 20 results from an estimated 300 matches similar to: "spec a replace_html with a partial"
2006 Mar 21
11
Stuck on ActiveRecord
Hi,
I''m having great fun developing with Rails but I''ve come to a problem
that I can''t quite figure out.
I have an Order object that "has_many" order_lines. This works perfectly
and I can see all the lines.
The OrderLine object has an order_id field as well as product_id and
amount.
Now ideally I would want to do :
order.orderline[0].product.name
for
2007 Apr 11
12
redirection doesn''t get detected well?
I''m doing a redirect in one of my controller actions and somehow I can''t
spec it, see this pastie: http://pastie.caboo.se/53120.
When following the link from a browser I''m being redirected to the right
page.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2007 Jan 05
2
Using RESTful routes in controller tests
Why can''t I use the RESTful route helpers in my specs?
In my controller I''m doing a redirect: redirect_to list_path(:id =>
@item.list_id)
Now when I write: controller.should_redirect_to list_path(:id => 2)
I''m getting the following error:
NoMethodError in ''POST on /lists/2/items should redirect to index on
succesful POST''
You have a nil object
2007 May 03
6
RSpec 0.9.2
Behind every great release is a maintenance release.
Go get it while it''s hot.
We''ve also reworked the website a little - trying to scare off fewer people.
Aslak
2007 Apr 19
5
Best practice thoughts: Model helpers, mocks
Hello! I''m pretty new to unit testing, and have only been using RSpec
for a few weeks. I found that for my controller specs, my setup
methods were getting very long building mocks/stubs for all the model
objects I needed to work with.
I''ve started creating helpers like the following for each of my
models. The "min_" methods are short for "minimum", and
2007 Sep 29
4
How to write the very first example?
Many posts on this list are about using RSpec with Rails and that''s the way
I''m also using RSpec all the time.
Unfortunately there isn''t that much info about using RSpec for standalone
Ruby projects.
I must admit I''m really having a hard time writing the very first example(s)
for a fresh standalone Ruby project. I haven''t really got a clue where to
2007 Apr 27
3
Problem at the start
Hi,
I''m new to rspec and wanted to translate some of my unit tests into rspecs.
Unfortunately my first test fails with "Mysql not loaded". My application is
running fine and can access the database.
I''d appreciate any help, so I can get started.
Tino
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2008 Mar 04
9
What is your workflow? Or how to use the story runner the right way.
I really would like to know how people are using the Story and Example
runner to write their software.It would be great to get some direction on
it, because I think I''m missing some points.
Taking the outside-in approach in thought:
At first we write a high-level customer-facing story, this story fails.
Then we start using mocks at object level to use them as a design tool,
and so we
2006 Mar 13
6
JobsOnRails
Announcing... JobsOnRails!
I''m creating on a Ruby on Rails oriented job site and will be launching
in the next few weeks. It''s a Rails-centric place for developers and
employers to get in touch with a minimum of hassle.
For now, I have a short outline of my ideas and an email signup form on
the live site at http://www.jobsonrails.com.
The site is coming along nicely and
2007 Jun 15
2
Is it still possible to use should_have_rjs
Hi
I''ve come back to a Rails project after about a month doing other
work, and there''s a lot of changes. I was on the 0.7 branch before
and I''ve upgraded to RSpec 1.0.5. I used the spec translator, fixed
the cases where it barfed on unusual line contents, and all my model
and controller specs now pass. But I''m getting 53 failures on my view
specs,
2008 Jan 23
4
expect_render(...).and_return(''x'')
Hi,
I''m trying to spec a controller method which renders some rjs as part
of a render :update block. The problem I''m having is that stub_render
or expect_render don''t seem to allow and_return to work.
The controller method does:
if @thing.save
render :update do |page|
page.insert_html :bottom,
2007 Jan 21
35
Collection proxies need to be stubbed ?
Hi all !
I just started writing specs on a new project. I would just like to
validate that this is the way you would write it. I know about mocks,
stubs and expectations. I don''t think this is a problem for me.
My question really boils down to:
def index
@projects = current_user.projects.active
end
My spec needs to return the proxy, no ? Here''s my code:
context "A
2009 Jan 16
2
Predictions with GAM
Dear,
I am trying to get a prediction of my GAM on a response type. So that I
eventually get plots with the correct values on my ylab.
I have been able to get some of my GAM's working with the example shown
below:
*
model1<-gam(nsdall ~ s(jdaylitr2), data=datansd)
newd1 <- data.frame(jdaylitr2=(244:304))
pred1 <- predict.gam(model1,newd1,type="response")*
The problem I am
2007 Nov 17
7
Using RSpec to drive the design of a GUI desktop application
Hello everybody,
I''ve been using RSpec as a tool to create web applications for some time
now, in Rails, and using plain Ruby with WEBrick as well. The tool suits my
needs and the story runner is great.
Now there are things that aren''t solvable on the web, you''ll need a _real_
desktop application for those problems.
So I''ve toyed a bit around with various GUI
2006 Mar 20
11
has_many brings back ''uninitialized constant''
hello. first things first - I am new to ruby on rails (ruby, too), so
I''m figuring this is just a basic newbie error.
I''m creating a basic photography website. And I have two tables with a
relationship:
photos:
- id (set up as PK)
- title
- shutter
- aperture
- date
- the_order
...etc
photo_comments:
- id (set up as a PK)
- photos_id (set up as a FK)
- author
- date
-
2007 May 03
7
before method
Would it be desirable to have before and after take a spec name as
well as :each and :all?
Scott
2006 Jul 25
1
Managing backtrace
I''m writing a method_missing handler to "automagically" create
assertions from predicate functions. So, for example, one use might be:
assert_not_include ''joes@shmoe.com'', response.to
-or-
assert_include ''info@mydomain.com'', response.from
The code is working properly, but when I trigger an assert, the
backtrace shows something like:
2006 May 30
0
The ARTS Plugin: Another RJS Testing System
If you missed it, I''ve written a plugin for testing RJS that uses
(basically) the same syntax as the RJS templates themselves. Here''s a
taste:
assert_rjs :alert, ''Hi!''
assert_rjs :assign, ''a'', ''2''
assert_rjs :call, ''foo'', ''bar'', ''baz''
assert_rjs :draggable,
2009 Mar 17
1
Route failure with Rails2.3 and rspec1.2
Hello all,
I have a spec for a route that used to pass under Rails 2.2.2 and rspec
1.1.12, but can?t figure out what is wrong since I updated. Here is the
assertion:
route_for(
{
:controller => ''purchase_orders'',
:action => ''update'',
:company_id => "32",
:id
2013 Feb 18
6
How to clear ActiveRecord query cache on associations with dynamic table
In part of my application I''m using dynamic tables. I''m aware of the single
thread conditions. I''ve tackled some caveats yet - will post a blog about
it soon - but there''s one I need help with.
Consider 2 models that are associated: Order and OrderLine where Order has
many order_lines.
Now we set the table names for them: