Displaying 20 results from an estimated 1100 matches similar to: "Specing raising error, handling, and then not raising error"
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
2006 Mar 29
4
Collecting data from forms
Hi,
I?m having some problems collecting the content of some forms.
This is whats in list.rhtml:
<%= form_tag :action => ''send_message'' %>
From:
<%= text_field ''message'', ''from''%>
<br>Message:
<%= text_area ''message'', ''text'', :rows => 6 %>
<tr>
<td></td>
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 Feb 05
1
[rspec] [rails] Specing a form builder
I''m trying to set up and run a new form builder under rails, which lives
under the helpers directory, but isn''t really a helper. (Not a module, so
doesn''t mix in well)
Short of dropping down into a view spec, how do I set up to actually spec
the form builder?
describe RandomFormBuilder do
attr_reader :builder
before do
@object = mock_model(Foo)
@builder =
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 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
2006 Oct 27
8
Error after moving to production server
so i have an after_create method on my track model that kicks off a
background process that converts an mp3 to a swf.
this is working fine locally on my machine, but upon moving it to my
production server, i am getting the following error. I''ve only been
using backgroundRB for like 48 hours, so i''m not really sure what
this means or where to go. any ideas?
2008 Dec 04
3
The RSpec way of doing this? Need help on validating block
Hello, I''m back again with more questions about mocks and how to do good
testing in general. Let''s say I''m writing this EmailSender class and I
want to make it totally awesomely tested with RSpec. Here''s how far I''ve
gotten so far:
require ''net/smtp''
class EmailSender
def send_email
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
2006 Feb 21
26
Net::SMS::BulkSMS 0.1
This is the first release of a new Ruby library for the
www.bulksms.co.ukAPI which should allow simple integration of SMS
functionality into your
Ruby or Rails apps.
Sending a message is as simple as:
@service = Service.new(''username'', ''password'')
@service.send_message(''This is my message!'', ''4479123456789'')
# whats my
2009 Feb 13
2
Continue processing AGI script after hangup
All;
I wrote a PERL AGI script that prompts a caller to leave a message using
print "RECORD FILE $recordfile wav # 60000 BEEP s=3\n";
When the caller is done, they need to press the # key. The message is then delivered.
However, the message is not delivered if the caller simply hangs up when finished.
If the user hangs up, the script ends right then. How do I keep on processing the
1997 Nov 29
1
Workgroup popups with samba
Hello,
I'd like to know if there's a way to receive Workgroup's winpopup messages
with samba under linux.
If it's impossible, what are the technical problems caused by such a request ?
Thank you
--
,,,
o +
+-----------------------ooO---(_)---Ooo---------------------------+
| "Xylo", a.k.a
2007 Jan 11
4
counter-intuitive behaveour when passing a proc to Mocha::Expectation#returns
Let''s say that I have a procedure that:
* gets the number of bytes to write into some file
* and returns the number of successfully written bytes
def save( text, len )
This procedure is being used all over the place especially inside the method
"process" which I want to test. Thus in order not to polute my filesystem I stub
the "save" procedure. But of course in
2008 Oct 17
4
Error when posting facebook.feed.publishActionOfUser
posting ''facebook.feed.publishActionOfUser'' with {:title=>"<fb:fbml>
<fb:name ifcantsee=\"A Hidden User\" linked=\"true\" uid=\"579947937\"
/> wrote a <a href=\"http://apps.facebook.com/dailycaption/captions/1273\">caption</a></fb:fbml>",