Displaying 20 results from an estimated 1200 matches similar to: "Specing exit codes"
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
2013 Aug 30
3
rspec-puppet not working
I''m trying to get rspec-puppet working and have run into a problem. I have
a VM running ubuntu lucid, have installed rubygems 1.3.5 from the apt
package and have install rspec-puppet (and other required gems), and rake,
using gem install.
I''ve run rspec-puppet-init in the module I want to test, and have created a
very basic spec file for one of the classes in my module.
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 =
2006 Nov 02
2
Rescue don't work on web applications
Hi,
I''ve a Rails application who starts a Ruby script .
The script is made via Web -> database.
Than you can select a script to start via a database list.
Problem:
In case of errors , I like to start a rescue showing the users the
problems.
render(:text => "<pre>" + CGI::escapeHTML(`
begin
/home/luc/radrails/cpe/public/startq_test.rb
2007 Jul 29
24
View-Driven-Development by Behavior-Driven-Development and RSpec
One of the things that turned me on to BDD and RSpec was speccing
views first, that the desired end would drive the development. In
previous projects while using Test::Unit I would try to make educated
guesses as to what would be needed in the model and controllers to
derive the view without actually writing the view until afterwards.
This is all because testing relied on each previous
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 Jul 18
10
Rails - Mock going out of scope?
Hello list,
I think I have a rails related RSpec problem with a mock going out of
scope on a recursive call to a model.
The code is at: http://pastie.textmate.org/79821 if you want to see it
highlighted. I have pasted it below as well.
Basically, I have an acts_as_nested_set model called "Node", which
works fine. I have a function which finds the language name of the
node instance.
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)
2008 Jan 07
7
[Bug 1427] New: scp -q behavior different than documented
https://bugzilla.mindrot.org/show_bug.cgi?id=1427
Summary: scp -q behavior different than documented
Classification: Unclassified
Product: Portable OpenSSH
Version: 4.7p1
Platform: All
OS/Version: All
Status: NEW
Severity: minor
Priority: P3
Component: scp
AssignedTo: bitbucket at mindrot.org
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
2009 May 27
3
Call in progress tones
Hello all,
I've played with background and play sounds apps and googled around
and asked the list before to no avail.
Does anyone know of a way to have tones played during the call
progress stage of the call?
We (especially on some international circuits) get up to 5 seconds of
silence before the phone starts ringing or is busy.
I don't want to force "R" on the Dial app as
2012 Jun 07
2
Gentoo Linux-installed Samba 4 alpha 21 getting python error
I installed the Samba 4 alpha 21 using the Samba 4 alpha 20 ebuild as a
template:
When I try to run the samba-tool command, I keep getting
*Code:*File "/usr/bin/samba-tool", line 38
except SystemExit, e:
^
SyntaxError: invalid syntax
2020 Feb 29
2
Chrome not allowing mixed content anymore
For example, in my case, we use several servers with Centovacast, with
several Icecast2 services. Version 2.5 of Icecast2, allows to respond to
http and https connections from the same port, but takes years in beta.
Centovacast does not update its panel, waiting for the final version of
Icecast 2.5 to be released.
Chrome has been warning for months that this would happen in February, but
no one
2007 Jul 24
11
Mock or Stub strategy for validates_uniqueness_of
Hi,
I''m a bit stuck with mocking a unit test of a join model with regards to a
validates_uniqueness_of clause.
I have
class Book < AR:B
has_many :clippings
various validates_presence_of etc
end
class Clip < AR:B
has_many :clippings
various validates_presence_of etc
end
class Clipping < AR:B
belongs_to :book
belongs_to :clip
validates_uniqueness_of :clip_id,