Displaying 20 results from an estimated 200 matches similar to: "[rspec] [rails] Specing a form builder"
2007 Apr 12
3
specing class methods
Here is an example from autotest:
class Autotest
def self.run
new.run
end
def new
...
end
def run
...
end
...
end
How would I spec out Autotest.run?
Two complications come to my mind:
1. How do I spec out class methods? (please point me to docs, if
any. I can only find class level specing on "partial mocks" (of
rails class objects)
2. How can I tell
2007 Sep 04
2
specing helpers fails on restful routes
Hi,
I am trying to spec helper methods in a Rails project, but it seems
the specs fail with the error:
You might have expected an instance of Array.
The error occurred while evaluating nil.<<
if the restful routes helper are used either in spec files, or the helper file.
What can I be doing wrong? Or how can I fix this.
Thanks!
--
Surendra Singhi
http://ssinghi.kreeti.com,
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
2007 Oct 13
1
specing system
Hi!
Having some wine on Saturday and just playing around writing some ruby script:
* have you spec any ''system'' method? As long I know it just returns
false or true and everything else is just out of reach; prove me I''m
wrong :-)
it ''should have response with 64.233.167.99''
system ''ping google.com''
Priit
2007 Dec 22
1
Rails: Specing libraries
I was reading the documentation on using rails with rspec and I didn''t see
anything about how to spec libraries in the rails /lib directory so that
they''re integrated into the whole spec::rails system.
Where should I put specs for my libraries, and what''s the best way to
require the files that I''m testing in my spec?
I''ve never used rspec before, and
2008 Mar 05
3
having trouble specing an ajax request
Do I need to spec an AR. If yes, what is the best way to spec this.
here is the code -
def index
@deals = Deal.paginate(:all, :conditions =>
prepare_search_conditions, :order
=> ''created_at DESC'', :page => params[:page]
)
if request.xhr?
render :update do |page|
page.replace_html "table", :partial =>
2009 Oct 06
3
rspec-rails 1.2.9 Released
rspec-rails version 1.2.9 has been released!
* <http://rspec.info>
* <http://rubyforge.org/projects/rspec>
* <http://github.com/dchelimsky/rspec-rails>
* <http://wiki.github.com/dchelimsky/rspec/rails>
* <rspec-devel at rubyforge.org>
Behaviour Driven Development for Ruby on Rails.
Changes:
### Version 1.2.9 / 2009-10-05
* enhancements
* added route_to and
2007 Jul 28
2
specing a call to render :layout => "some_layout"
I''m trying to specify that an action should be rendered with a given layout
one particular spec.
What I''ve got at the moment is this.
it "should render with the grabber layout" do
controller.should_receive( :render ).with( :layout => "my_layout" )
do_get
end
This doesnt work even though this call to render is being executed.
render :layout
2007 Nov 04
3
Specing raising error, handling, and then not raising error
Hey guys and gals,
I have a snippet of code:
Net::SMTP(@host, @port, @from_domain) do |smtp|
@emails.each do |email|
begin
smtp.send_message email.encoded, email.from, email.destinations
@emails_sent += 1
rescue Exception => e
# blah
end
end
end
What I want to do is:
Say there are 4 emails.
First email is sent OK
On the second email smtp raises a IOError
2007 Oct 07
2
Specing exit codes
I am writing a small ruby script that will be accepting input from
postfix''s pipe command (ie, not running via the shell, directly
executing).
One of the things I need to do it spec the exit codes to make sure I
am returing the correct exit codes for each condition as Postfix will
then return SMTP errors as appropriate.
I have two files that concern this bit of the program, init.rb and
2007 Oct 26
5
specing rescue, ensure and else blocks of an Exception
Greetings,
I''m using rspec with rcov for my applications and there is one issue
which I cannot solve nor can find any proper information regarding
it: specing what is in a rescue block in case of an exception.
I''m using Ruby on Rails and I usually make use of exceptions in my
controllers, like the following example:
def action
@foo = Foo.find(1)
2007 Aug 12
3
Scope and specing models
Hello all, I''m currently having an issue with some specs, specifically scope
issues (probably more of a scope issue than a spec issue at this point)...
Here''s the error:
ActiveRecord::AssociationTypeMismatch in ''A new User should know what role
it has''
Role expected, got NilClass
D:/ruby/projects/restful_authentication_test/config/../app/models/role.rb:5:in
2007 Oct 26
3
Specing with Subdomains as Account Keys
How do you go about implementing and rspecing subdomains as account
keys? I''m sure that this must be an issues for others as well.
So I have an app using subdomains as account keys. The Application
Controller sets up @current_company in a before filter. Everything is
done within the context of the @current_company.
After reading about Demeter''s Revenge
2008 Jun 03
9
Build rspec-rails as a gem?
I can''t figure out how to build rspec-rails as a gem when just cloned
from github... there isn''t any .gemspec file or rake task that does
this. Any help?
--
Posted via http://www.ruby-forum.com/.
2010 Jan 05
2
Conditional named_scope chaining with params (Need help)
Hello there,
I have a model that has more then one named_scope.
In my action Index of the controller that handle this model I want to do
this in a drier way:
if params[:ownership] == "mine"
@posts = Post.tagged_with(params[:tags], :on =>
:tags).owner(current_user.id).paginate :all, :page => params[:page],
:order => ''created_at DESC''
else
2007 Oct 20
14
Problems with form_for and partials
i''m having problem with a form_for situation where i''m trying to DRY
out the repeated parts of my forms and put them in common/form and
render the form elements via another partial in controller_name/_form.
Here''s the first form
# app/views/common/form
<% form_for ... do |f| -%>
<%= render :partial => "params[:controller]/form", :object => f
2008 May 23
3
RailsExampleGroup
So I have a describe which is a subclass of RailsExampleGroup. I inserted
some data into my database, and reconnect! my connection. Before reconnect,
finding the data I just created is fine. The data cannot be found, after
reconnection, the data is gone. It''s not in the database. It looks to me the
data is not actually inserted into the DB at all, just somehow buffered
somewhere. Would
2007 Jul 14
8
Specing Layouts
Hi,
I''ve just started to try and spec my application.html.erb layout as one of
the view specs but it totally barfs.
I''m guessing that it''s due to the yield statements in the layout.
Any clues as to how to proceed?
Cheers
Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2005 Dec 27
2
Rewriting FormBuilder
Hi,
I want to extend formbuilder to make it output a lable (I know about
labeled_form_helper made by technoweenie), my own formating, and a
couple of extra tags inside the form attribute. I was easily able to
extend form_remote_to. But when I continue to adjust the way elements
are handled I don''t know how to continue. I can''t find the method
text_field thats should is
2006 Apr 23
3
custom form builder
In the API docs I found this:
"You can also build forms using a customized FormBuilder class. Subclass
FormBuilder and override or define some more helpers, then use your
custom builder "
I couldn''t find any further documentation on this. Where can I read more
about this formbuilder class? For starters, where would I define a
subclass of this class?
TIA,
Jeroen
--