Displaying 20 results from an estimated 400 matches similar to: "Stdlib and Defined Types"
2011 Mar 04
5
How to intercept an instance method from StdLib (1.9.2)
Hi,
I''m struggling with something that seems to be simple, and I''ve not
had any joy following the RSpec books suggestions (p. 187).
I''d like to test that a method raises and error when a file is not found.
I''ve tried adding this in my example just before I call my method, but
it never seems to get invoked.
Pathname.stub(:exist?).and_return(false)
The whole
2008 Jan 30
9
catching errors, rspec basics
Trying to spec the following but don''t know if I''m using the right matcher.
How do I spec? Plz, sugar on tops.
Audience.stats
- should have a stats of 80 when passed a flux of 10
- should return an error when passed a string (ERROR - 1)
1)
TypeError in ''Audience.stats should return an error when passed a string''
String can''t be coerced into Fixnum
2007 Sep 20
4
alias :calling :lambda
Sprinkling my examples with ''lambda'' has always seemed like a bit of a
wart to me. I''ve gotten into the habit of adding ''alias :calling
:lambda'' to my spec suites. My examples then look like:
calling { Foo }.should raise_error
calling { Bar }.should_not raise_error
Is there a reason that RSpec core has chosen not to make exception
expectations more
2012 May 24
9
Announcing Razor
Puppet Labs is really thrilled to announce, in conjunction with EMC, our
new open source bare metal provisioning tool: Razor.
Razor is next generation provisioning software that handles bare metal
hardware and virtual server provisioning with inventory discovery and
tagging, rule-based policy management, and extensible broker plugin
integration. It integrates closely with Puppet and Facter.
The
2007 May 20
9
How to test for exceptions
Hi folks,
I''m in the process of converting a Test::Unit functional test to RSpec, but I''ve run into a slight problem. I tried looking through the documentation but I still don''t know what I missed.
Thanks in advance,
Blake
describe VenuesController, "on update" do
before(:each) do
@venue = mock("venue")
2019 Aug 13
4
ORC v2 question
Hi Lang,
On Tue, 13 Aug 2019 at 22:03, Lang Hames <lhames at gmail.com> wrote:
> When you say your code is not getting optimized, do you mean that IR optimizations are not being applied, or that codegen optimizations are not being applied?
>
> What do you see if you dump the modules before/after running the pass manager on them, like this:
>
> dbgs() << "Before
2007 Nov 17
7
Down with Lambda!!
Rspec is all about using natural language to define behavior. In this
context, I feel that lambda is sorely out of place. I was chatting on
#irc and a pal of mine (wycats) proposed an interesting alternative:
alias_method :doing, :lambda
so instead of something like
lambda {post :create, {:title => nil}}.should
raise_error(ActiveRecord::RecordInvalid)
we get
doing {post :create, {:title
2009 May 02
10
Problem verifying routing error
Hi,
When upgrading to rspec/rspec-rails 1.2.6 gem (from 1.1.12), I''m having
a new problem verifying routes that should not exist.
This is to support something like this in routes.rb:
map.resources :orders do |orders|
orders.resources :items, :except => [:index,:show]
end
I used to use lambda {}.should_raise( routing error ), but it stopped
detecting any raised error.
2008 Mar 17
4
RSpec''ing model association callbacks
Hi all,
i''m learning rspec and i must admit i really love it.
But at the time i started learning it, i already
developed my models classes and their callbacks.
Now i''m trying to get a 100% coverage of my code but i
cannot reach it because i do not understand how to
spec my callbacks.
Look at this for example:
----------------- User Model
class User < ActiveRecord::Base
2012 Aug 27
5
Append string to list items.
I have an array:
$nodes = [''gfs01'' ,''gfs02'', ''gfs03'', ''gfs04]
and a string variable:
$brick_store = "/var/bricks"
How can I append "/var/bricks" to each item in the array? Lack of a
looping construct makes this challenging in puppet.
Such that:
brick_array = [''gfs01:/var/bricks'',
2007 Apr 17
8
Verifying that a block calls a method
I have something like the following:
def my_fun
my_fun2 do
raise Error
end
end
I know that I can verify that the method receives my_fun2. How can I
mock/stub out the example to verify that it calls raise Error?
Scott
2010 Feb 23
2
Feature Request: Settable 'nice' value.
So, some of us would like to be able to set the nice value on puppetd.
However, we don''t want all of our services (and some of our execs)
re-niced.
Would it be feasible/practical to have the ability to set the nice
value explicitly on Service and Exec calls?
Thanks,
Trevor
--
Trevor Vaughan
Vice President, Onyx Point, Inc
(410) 541-6699
tvaughan@onyxpoint.com
-- This account not
2011 Feb 08
3
Variable doesn't expand properly
HI,
I''m getting some strange errors when I try to use a variable in a require =>
Package construct, namely:
$packagelist = ["clamav", "clamd", "clamav-db"]
package { $packagelist:
ensure => latest,
}
# Above apparently works fine...
# ...THEN...
file { "/etc/rc.d/init.d/clamd.mimedefang":
ensure =>
2013 May 29
5
Developing custom type/providers for multiple OS
Hello all,
I am developing a few custom providers for some features that I need into
my system (such as dealing with different zipped files or generating some
JSON data based on OS files) and I have hit into a question about "how to
do this for multiple OS?"
Lets focus into the zipped file provider that should provide a common
method to pack or unpack zipped files (tar, tar.gz,
2007 Apr 17
1
updating textmate bundle
Just to let you know - in the textmate bundle the snippet shra =>
"Should raise error" is missing an open parenthesis. The snippet
code should be this:
lambda { $1 }.should raise_error(${2:error})
$0
and not this:
lambda { $1 }.should raise_error${2:error})
$0
Best,
Scott
2007 Sep 05
3
Rspec Caveman questions.
Hello!
I''m just a caveman with some caveman questions.
I''ve been parsing Rspec for quite a while, and I''m writing my first series
of specs. My initial impressions are "Verbose, but understandable. Helpful
and intuitive, but so much to digest." I want to congratulate the folks who
are dedicating a chunk of their lives to writing this, and ask 2 caveman
2007 Nov 21
7
describe scope
Hi,
Googling ''RSpec describe scope'' didn''t yield much, so apologies if
this question has been dealt with.
It seem well known that a ruby class is ''visible'' between describes,
and if this is a problem then you should use some counter as prefix or
suffix:
''class Item_001; ... end''
Is there any work underway, or sheduled release where
2012 Jan 15
1
NoMethodError: undefined method `expect'
Ideas?
ruby-1.9.2-p290 :002 > require ''rspec''
=> true
ruby-1.9.2-p290 :003 > RSpec::Version::STRING
=> "2.8.0"
ruby-1.9.2-p290 :004 > describe ''division by zero'' do
ruby-1.9.2-p290 :005 > expect { 2/0 }.to raise_error
ruby-1.9.2-p290 :006?> end
NoMethodError: undefined method `expect'' for
2009 Aug 10
2
testing exception notification plugin with rspec
Hi,
I''m trying to install exception notification plugin and test it with
rspec.
The problem that I have is that when running the server in production
mode : at the end of the log i get this when I have a critical error
rendering section "request"
rendering section "session"
rendering section "environment"
rendering section "backtrace"
Sent mail to
2011 Aug 10
5
ControllerExampleGroup.bypass_rescue
As best I can tell, bypass_rescue from rspec-rails-1 is no longer part of rspec-rails, ''> 2''. I had been using it on occasion for things like:
describe CorrespondencesController do
...
describe ''#show'' do
it "should raise an AuthorizationError if current user is not the correspondent " do
bypass_rescue
...
expect { do_get