Displaying 20 results from an estimated 20000 matches similar to: "View spec''ing style"
2008 Jan 13
10
.html.erb files and autotest
When I work with a .html.erb file, the autotest rspec on rails stuff doesn''t
understand the file to map it to the right test. I wanted to submit a patch
for this, but I''m unsure where the specs would be to update. I found the
necessary mapping in rspec_autotest.rb, but I can''t find any specs anywhere.
Help?
I just need to have
/app/views/coupon/index.html.erb to map to
2008 Mar 14
2
Multiple should_receive(:render).with
I''m trying to specify that a particular view must render two different partials.
My spec looks like:
describe AClass do
it do
template.should_receive(:render).with(:partial => ''foo'', :locals => { ... })
...
end
describe ''some conditional case'' do
it do
template.should_receive(:render).with(:partial =>
2008 Jan 23
18
Not seeing the failure
All,
I''m missing something simple, I think. I am writing a spec to say that my
CouponController should create a new coupon from the form parameters, then
set the current user. Here''s the spec:
describe CouponController, "When posting to save_coupon" do
before(:each) do
@expectedName = "pepper''s"
@expectedAmount = 5
coupon =
2008 Jan 31
6
loading fixtures?
How do you load fixtures from specs as you would test?
eg. rake db:fixtures:load RAILS_ENV=development
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080131/38c3b0ab/attachment.html
2008 Jan 27
20
OT local version control?
Hi, all,
This isn''t about rspec, but this list has people whose opinions I respect.
So, I''m looking for a new version control system for my local development. I
was going to install subversion, but I''ve heard rumors of people using some
newer ones. Thoughts? I''d like to be able to run it either locally or on a
home server. If I run it off a home server, then
2008 Mar 04
2
textmate bundle
Hi,
I''m just getting e set up on my machine, and I was wondering if someone
could point me to the current rspec bundle for textmate? I googled and found
a million of them, I think.
Thanks.
-Corey
--
http://www.coreyhaines.com
The Internet''s Premiere source of information about Corey Haines
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2008 Jan 15
4
Okay, I''m finally asking for help
Hi, all!
I would love if someone could help me figure this out. I can''t seem to see
why the following fails:
Here''s the spec:
it "should redirect back to the index page" do
Coupon.should_receive
(:new).with({"name"=>@expectedName,"amount"=>@expectedAmount}).and_return(@coupon)
@coupon.should_receive(:save)
response.should
2008 Mar 11
6
Story testing views in isolation
Hi,
I''ve been investigating plain text stories, and I had a quick question. How
would I go about creating story tests for views in isolation, instead of the
full stack? I had hoped to be able to do a straight render ''/'', but it says
it can''t find the method.
The reason that I want to do this is that I want to give our
designer/business people a way to write
2008 Mar 19
3
ApplicationHelper
When working with views, I use instance methods of ApplicationHelper:
# app/helpers/application_helper.rb:
module ApplicationHelper
def distribute(total, min, cutof, list)
[1,2,3]
end
end
# app/views/planner/_mta_colors.rhtml:
<td>
<%
...
dist = distribute(total_v_px, 4, 0, colors.collect{|color| color[1]})
...
%>
So to test the distribute method in ApplicationHelper, I have
2007 Dec 27
5
ExampleGroup and SharedExampleGroup relationship(?)
I''m working on a series going over the source code for rspec, and I ran into
something interesting with ExampleGroup and SharedExampleGroup. I was
wondering if anyone could shed light on it.
[NOTE: I''m working through the code for my own edification in learning Ruby.
Ruby has some features that I think are incredibly cool, so I''m using a
concrete implementation (RSpec)
2008 Jan 29
3
I thought the RSPec community might be interested
in my latest blog posting
:http://talklikeaduck.denhaven2.com/articles/2008/01/29/why-i-dont-mind-using-rspec-in-fact-ive-come-to-love-it
--
Rick DeNatale
My blog on Ruby
http://talklikeaduck.denhaven2.com/
2008 Mar 05
2
Testing that a model helper method is called
So, I have a plugin that adds a method to ActiveRecord::Base, let''s call the
method is_encrypted.
class MyModel < ActiveRecord::Base
is_encrypted
end
So, my question is, how do I write a spec to show that is_encrypted is
called here? I would rather not write specs that say that the behavior is
there, since I have tested the behavior already in my plugin.
Thanks.
-Corey
--
2008 Mar 04
3
rspec vs. test::more
Hey all,
you HAVE to read this blog post:
http://blog.jrock.us/articles/RSpec%20vs.%20Test::More.pod#comments
My favorite parts are:
1)
... some rspec code ...
> For the sake of comparison lets translate this directly into perl:
... some perl code ...
2)
>First, notice that the rspec-version isn''t actually ruby code. It''s
not any real language.
For the sake of
2008 Mar 08
7
ridding away with do_request
I''m heading out of town, but had a quick thought I wanted to share.
Rather then using ambiguous named request helpers in controller specs
like "do_request", I''ve been using more readable helpers like
"post_create".
For example...
describe ProjectController do
def post_create
post :create, ...
end
before do
end
it "creates a new
2008 Mar 05
7
mocking successive return values
I''m having a problems mocking successive return values. I don''t know
if I''m doing something wrong or if this is a limitation of rspec
mocks. Any ideas of what I may be doing wrong?
I''m trying to test the generate_quote_number method. It generates a
quote number, looks to see if it is in the db already. If it is, it
calls itself to try again. I want
2008 Feb 29
5
outside-in = integration tests on views?
Hi,
In the spirit of "outside-in" are given-when-then scenarios supposed to be
integration tests of views? Or should we be accessing the model interfaces
directly (not through a view)?
Thanks,
David :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080229/dc6b1660/attachment.html
2008 Mar 21
3
Oh inheritacne, wherefore art thou
Is there anyway to achieve inheritance of specifications?
Suppose I had an action like
def index
filter = params[:filter] ? params[:filter] : ''%''
order = params[:order] ? params[:order] : ''created_at DESC''
@posts = Post.find(:conditions => "title LIKE #{filter}", :order => order)
...
end
Now I might have half a dozen specs for this
2008 Mar 13
22
Specifing methods in a steps_for block
Hey list,
I''m refactoring some much-used functionality into a common_steps step
group. Methods like this are in there:
steps_for :common do
Given "a number of existing $types?" do |type|
@initial_item_count = type.singularize.classify.constantize.count
end
When "the user adds an invalid $type" do |type|
post
2008 Jan 30
2
(no subject)
Message-ID:<ef1d468f0801291747q3f605e6cjb73028a888a441ee at mail.gmail.com>
On: Tue, 29 Jan 2008 20:47:41 -0500, "Andrew WC Brown" <omen.king at gmail.com>
wrote:
> I''ve seen lambda before but not sure what it does.
A lambda is a fancy name for an anonymous or unbound function. Its
significance comes from the fact that it is completely stateless, producing no
2008 Jan 20
2
Which taggable library do people use?
I''d like to add taggability to a model in the site I''m working on, and I
wanted to get an idea of what people are using. I keep seeing that
acts_as_taggable is deprecated, so I tried the acts_as_taggable_on_steroids.
I also tried be_taggable.
In any case, I figured I''d see what people use.
thanks.
-corey
--
http://www.coreyhaines.com
The Internet''s Premiere