# RSpec

**URL:** https://www.ruby-forum.com/c/testing/rspec/25.md?page=109

[Latest](https://www.ruby-forum.com/latest.md) · [Categories](https://www.ruby-forum.com/categories.md) · [Tags](https://www.ruby-forum.com/tags.md)

**Page:** 110

---

## [Autotest just sits there](https://www.ruby-forum.com/t/autotest-just-sits-there/127877)

<div class="topic-metadata">

**Author:** [@paul](https://www.ruby-forum.com/u/paul)\
**Replies:** 1\
**Last updated:** [February 2, 2008, 12:48am UTC](https://www.ruby-forum.com/t/autotest-just-sits-there/127877 "2008-02-02T00:48:27Z")

</div>

I have had this problem for a while. autotest has never worked properly for me. I have tried different versions of rspec with different versions of ZenTest. I have tried it with .autotest files and without. When I …

---

## [Non-pending spec returning pending](https://www.ruby-forum.com/t/non-pending-spec-returning-pending/127846)

<div class="topic-metadata">

**Author:** [@Giles\_B](https://www.ruby-forum.com/u/Giles_B)\
**Replies:** 0\
**Last updated:** [February 1, 2008, 8:17pm UTC](https://www.ruby-forum.com/t/non-pending-spec-returning-pending/127846 "2008-02-01T20:17:31Z")

</div>

I’m speccing some code which monkey-patches initialize on ActiveResource::Base. The monkey-patch lives in a module. My spec looks like this: describe MyModule, “doing stuff” do it “adds methods to ARes subclasses” do …

---

## [\[ANN\] RSpec-1.1.3](https://www.ruby-forum.com/t/ann-rspec-1-1-3/127694)

<div class="topic-metadata">

**Author:** [@crucoba](https://www.ruby-forum.com/u/crucoba)\
**Replies:** 4\
**Last updated:** [February 1, 2008, 6:07am UTC](https://www.ruby-forum.com/t/ann-rspec-1-1-3/127694 "2008-02-01T06:07:40Z")

</div>

RSpec-1.1.3 has been released. If you’re using RSpec and autotest, you’ll have to upgrade to RSpec-1.1.3 and ZenTest-3.9.0 at the same time. == Version 1.1.3 Maintenance release. Tightened up exceptions list in aut…

---

## [RSpec and the Basecamp API](https://www.ruby-forum.com/t/rspec-and-the-basecamp-api/127707)

<div class="topic-metadata">

**Author:** [@crucoba](https://www.ruby-forum.com/u/crucoba)\
**Replies:** 1\
**Last updated:** [January 31, 2008, 5:25pm UTC](https://www.ruby-forum.com/t/rspec-and-the-basecamp-api/127707 "2008-01-31T17:25:50Z")

</div>

I realise that this is kind of a basic question but I’m new to rspec and still trying to work out how to do things. I’m working on a rails project that requires basecamp integration via the api, which is fairly trivia…

---

## [Reby-debug and rspec](https://www.ruby-forum.com/t/reby-debug-and-rspec/127640)

<div class="topic-metadata">

**Author:** [@bloc](https://www.ruby-forum.com/u/bloc)\
**Replies:** 4\
**Last updated:** [January 31, 2008, 4:34am UTC](https://www.ruby-forum.com/t/reby-debug-and-rspec/127640 "2008-01-31T04:34:18Z")

</div>

How do I use the ruby debugger with a specific test (not the whole spec file)? I want to do something like this. $ rdebug spec/models/user\_spec.rb -s “should error if not new\_record” \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_…

---

## [How do I get logging with rspec?](https://www.ruby-forum.com/t/how-do-i-get-logging-with-rspec/127619)

<div class="topic-metadata">

**Author:** [@combray](https://www.ruby-forum.com/u/combray)\
**Replies:** 2\
**Last updated:** [January 31, 2008, 12:12am UTC](https://www.ruby-forum.com/t/how-do-i-get-logging-with-rspec/127619 "2008-01-31T00:12:34Z")

</div>

Say I’m testing a controller with rspec, and I have logger.debug and logger.error calls. Normally I’d like them to write to the appropriate file, but in this case I’d like to see the output on STDOUT. Is there an eas…

---

## [Order of the get call and xxx.should](https://www.ruby-forum.com/t/order-of-the-get-call-and-xxx-should/127617)

<div class="topic-metadata">

**Author:** [@chrisolsen](https://www.ruby-forum.com/u/chrisolsen)\
**Replies:** 3\
**Last updated:** [January 30, 2008, 10:45pm UTC](https://www.ruby-forum.com/t/order-of-the-get-call-and-xxx-should/127617 "2008-01-30T22:45:12Z")

</div>

Just out of curiosity, why is that the following .should calls have to differ to work? The first is a normal check on the if the user is redirected if not logged in it “should redirect the user to the login screen” do …

---

## [(no subject)](https://www.ruby-forum.com/t/no-subject/127540)

<div class="topic-metadata">

**Author:** [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Replies:** 2\
**Last updated:** [January 30, 2008, 1:58pm UTC](https://www.ruby-forum.com/t/no-subject/127540 "2008-01-30T13:58:52Z")

</div>

Message-ID:removed\_email\_address@domain.invalid On: Tue, 29 Jan 2008 20:47:41 -0500, “Andrew WC Brown” removed\_email\_address@domain.invalid wrote: I’ve seen lambda before but not sure what it does. A lambda is a f…

---

## [Stubbing controller methods vs model methods](https://www.ruby-forum.com/t/stubbing-controller-methods-vs-model-methods/127528)

<div class="topic-metadata">

**Author:** [@chrisolsen](https://www.ruby-forum.com/u/chrisolsen)\
**Replies:** 2\
**Last updated:** [January 30, 2008, 7:13am UTC](https://www.ruby-forum.com/t/stubbing-controller-methods-vs-model-methods/127528 "2008-01-30T07:13:50Z")

</div>

I had an error that I couldn’t figure out, then when writing up a question for the forum I figured it out. The thing is I don’t understand why the change that was made works and why what existed before didn’t. Here…

---

## [I thought the RSPec community might be interested](https://www.ruby-forum.com/t/i-thought-the-rspec-community-might-be-interested/127511)

<div class="topic-metadata">

**Author:** [@rykkers](https://www.ruby-forum.com/u/rykkers)\
**Replies:** 3\
**Last updated:** [January 30, 2008, 6:34am UTC](https://www.ruby-forum.com/t/i-thought-the-rspec-community-might-be-interested/127511 "2008-01-30T06:34:37Z")

</div>

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/

---

## [Catching errors, rspec basics](https://www.ruby-forum.com/t/catching-errors-rspec-basics/127523)

<div class="topic-metadata">

**Author:** [@bfsog](https://www.ruby-forum.com/u/bfsog)\
**Replies:** 9\
**Last updated:** [January 30, 2008, 5:13am UTC](https://www.ruby-forum.com/t/catching-errors-rspec-basics/127523 "2008-01-30T05:13:09Z")

</div>

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 s…

---

## [Helper methods starting with should](https://www.ruby-forum.com/t/helper-methods-starting-with-should/120566)

<div class="topic-metadata">

**Author:** [@crucoba](https://www.ruby-forum.com/u/crucoba)\
**Replies:** 8\
**Last updated:** [January 30, 2008, 2:31am UTC](https://www.ruby-forum.com/t/helper-methods-starting-with-should/120566 "2008-01-30T02:31:57Z")

</div>

Hi all, As an experiment in playing nice with others, we’ve added the ability in rspec’s trunk to do this: class ThingExamples \< Spec::ExampleGroup def should\_do\_stuff … end end This is how rspec 0.1 worked, and …

---

## [Textmate RSpec Bundle 'it' snippet](https://www.ruby-forum.com/t/textmate-rspec-bundle-it-snippet/127259)

<div class="topic-metadata">

**Author:** [@vanderkerkoff](https://www.ruby-forum.com/u/vanderkerkoff)\
**Replies:** 8\
**Last updated:** [January 30, 2008, 12:35am UTC](https://www.ruby-forum.com/t/textmate-rspec-bundle-it-snippet/127259 "2008-01-30T00:35:48Z")

</div>

It seems to me that the RSpec bundle’s ‘it’ snippet is in need of some love. By default, a newly inserted spec passes. This seems odd as it is misleading. It also makes it harder find what specs still need to be compl…

---

## [Re: client first, top down, outside in, etc with rails](https://www.ruby-forum.com/t/re-client-first-top-down-outside-in-etc-with-rails/127412)

<div class="topic-metadata">

**Author:** [@bloc](https://www.ruby-forum.com/u/bloc)\
**Replies:** 3\
**Last updated:** [January 29, 2008, 2:52pm UTC](https://www.ruby-forum.com/t/re-client-first-top-down-outside-in-etc-with-rails/127412 "2008-01-29T14:52:22Z")

</div>

I apologize, I oversimplified for the sake of brevity. We have most of the models written but there are some pieces than aren’t and won’t be written in the near future. I wanted to mock them out in some form so we can…

---

## [Re: client first, top down, outside in, etc with rails](https://www.ruby-forum.com/t/re-client-first-top-down-outside-in-etc-with-rails/127420)

<div class="topic-metadata">

**Author:** [@bloc](https://www.ruby-forum.com/u/bloc)\
**Replies:** 0\
**Last updated:** [January 29, 2008, 1:30am UTC](https://www.ruby-forum.com/t/re-client-first-top-down-outside-in-etc-with-rails/127420 "2008-01-29T01:30:37Z")

</div>

sorry about that, I have no idea how that happened. It looked fine in yahoo mail before I sent it :confused: \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ Looking for last minu…

---

## [Client first, top down, outside in, etc with rails](https://www.ruby-forum.com/t/client-first-top-down-outside-in-etc-with-rails/127390)

<div class="topic-metadata">

**Author:** [@bloc](https://www.ruby-forum.com/u/bloc)\
**Replies:** 1\
**Last updated:** [January 28, 2008, 11:10pm UTC](https://www.ruby-forum.com/t/client-first-top-down-outside-in-etc-with-rails/127390 "2008-01-28T23:10:46Z")

</div>

I’m starting a new project and I want to try writing the client first. I.e. I want to write my ‘views’ first and I would like to mock out all the models in such a way that I can run the site and browse it with the moc…

---

## [Could this controller test be made simpler?](https://www.ruby-forum.com/t/could-this-controller-test-be-made-simpler/127385)

<div class="topic-metadata">

**Author:** [@chrisolsen](https://www.ruby-forum.com/u/chrisolsen)\
**Replies:** 2\
**Last updated:** [January 28, 2008, 9:30pm UTC](https://www.ruby-forum.com/t/could-this-controller-test-be-made-simpler/127385 "2008-01-28T21:30:28Z")

</div>

In a create controller method I am testing the else clause that occurs when the model is unable to be saved. Sounds simple enough, but because model is created before the save and the form has to be re-filled I now h…

---

## [Attachment\_fu with fixtures](https://www.ruby-forum.com/t/attachment-fu-with-fixtures/127352)

<div class="topic-metadata">

**Author:** [@Harm\_Aarts](https://www.ruby-forum.com/u/Harm_Aarts)\
**Replies:** 0\
**Last updated:** [January 28, 2008, 3:28pm UTC](https://www.ruby-forum.com/t/attachment-fu-with-fixtures/127352 "2008-01-28T15:28:44Z")

</div>

Dear list, I can’t figure out how to use fixtures with attachment\_fu. I know how to use files with RSpec in my controllers, BackgroundPhoto.create(:uploaded\_data =\> fixture\_file\_upload(“files/ some.zip”, “application…

---

## [Route\_for and nested resources](https://www.ruby-forum.com/t/route-for-and-nested-resources/120935)

<div class="topic-metadata">

**Author:** [@chrisolsen](https://www.ruby-forum.com/u/chrisolsen)\
**Replies:** 6\
**Last updated:** [January 28, 2008, 4:35am UTC](https://www.ruby-forum.com/t/route-for-and-nested-resources/120935 "2008-01-28T04:35:31Z")

</div>

I can’t figure out how to make the updates to allow for the route\_form method to return a url that matches the expected. Here is a sample route\_for(:controller =\> :task, :action =\> :new).should == “/task/new” If a ta…

---

## [DRYing up stories](https://www.ruby-forum.com/t/drying-up-stories/126979)

<div class="topic-metadata">

**Author:** [@Neil\_MSYoung](https://www.ruby-forum.com/u/Neil_MSYoung)\
**Replies:** 13\
**Last updated:** [January 27, 2008, 10:54pm UTC](https://www.ruby-forum.com/t/drying-up-stories/126979 "2008-01-27T22:54:55Z")

</div>

I’m finding that I’m writing sets of very similar scenarios to check access permissions for each of my actions. Does anyone have suggestions on how to dry this up: Given an existing Account And a logged in Admin W…

---

## [Not seeing the failure](https://www.ruby-forum.com/t/not-seeing-the-failure/126932)

<div class="topic-metadata">

**Author:** [@visage](https://www.ruby-forum.com/u/visage)\
**Replies:** 18\
**Last updated:** [January 27, 2008, 9:32pm UTC](https://www.ruby-forum.com/t/not-seeing-the-failure/126932 "2008-01-27T21:32:13Z")

</div>

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 CouponContro…

---

## [Changing rspec directory structure](https://www.ruby-forum.com/t/changing-rspec-directory-structure/126903)

<div class="topic-metadata">

**Author:** [@combray](https://www.ruby-forum.com/u/combray)\
**Replies:** 5\
**Last updated:** [January 26, 2008, 11:35pm UTC](https://www.ruby-forum.com/t/changing-rspec-directory-structure/126903 "2008-01-26T23:35:41Z")

</div>

I’d like to change the rspec directory structure from /spec /model /controllers etc to /spec /unit /models /controllers /lib /functional /models /controllers etc. Basically the Jay Fields style of testing …

---

## [RSpec and resource\_controller plugin](https://www.ruby-forum.com/t/rspec-and-resource-controller-plugin/127239)

<div class="topic-metadata">

**Author:** [@rykkers](https://www.ruby-forum.com/u/rykkers)\
**Replies:** 0\
**Last updated:** [January 26, 2008, 9:00pm UTC](https://www.ruby-forum.com/t/rspec-and-resource-controller-plugin/127239 "2008-01-26T21:00:10Z")

</div>

I just discovered James Golick’s resource\_controller plugin http://jamesgolick.com/resource\_controller after spending another stretch of boredom making the changes to nest yet another rails resource controller. I’d …

---

## [Story runner "macros"](https://www.ruby-forum.com/t/story-runner-macros/126660)

<div class="topic-metadata">

**Author:** [@rykkers](https://www.ruby-forum.com/u/rykkers)\
**Replies:** 3\
**Last updated:** [January 25, 2008, 4:27pm UTC](https://www.ruby-forum.com/t/story-runner-macros/126660 "2008-01-25T16:27:12Z")

</div>

I’ve gotten quite a bit out of Pat M.'s screencast One thing I’m not sure of is the feature where he writes things like: When “I POST to”, “/articles”, :post =\> {:title =\> “Title”, :body =\> “Body”) do | path, params| …

---

## [Expect\_render(...).and\_return('x')](https://www.ruby-forum.com/t/expect-render-and-return-x/126913)

<div class="topic-metadata">

**Author:** [@rhalff](https://www.ruby-forum.com/u/rhalff)\
**Replies:** 4\
**Last updated:** [January 25, 2008, 2:42pm UTC](https://www.ruby-forum.com/t/expect-render-and-return-x/126913 "2008-01-25T14:42:41Z")

</div>

Hi, I’m trying to spec a controller method which renders some rjs as part of a render :update block. The problem I’m having is that stub\_render or expect\_render don’t seem to allow and\_return to work. The controller …

---

## [Re -raise exceptions in stories?](https://www.ruby-forum.com/t/re-raise-exceptions-in-stories/127098)

<div class="topic-metadata">

**Author:** [@Neil\_MSYoung](https://www.ruby-forum.com/u/Neil_MSYoung)\
**Replies:** 1\
**Last updated:** [January 24, 2008, 11:56pm UTC](https://www.ruby-forum.com/t/re-raise-exceptions-in-stories/127098 "2008-01-24T23:56:16Z")

</div>

I see that rails handles exceptions in stories by rendering public/500.html, whereas in controller specs exceptions are re-raised. Is it possible to have this same behaviour in stories so I can check the correct exc…

---

## [Meridian case](https://www.ruby-forum.com/t/meridian-case/127068)

<div class="topic-metadata">

**Author:** [@Keith\_McDonnell](https://www.ruby-forum.com/u/Keith_McDonnell)\
**Replies:** 0\
**Last updated:** [January 24, 2008, 5:58pm UTC](https://www.ruby-forum.com/t/meridian-case/127068 "2008-01-24T17:58:02Z")

</div>

Hi, Here’s the spec: ‘absolute\_time\_in\_words should say ‘Today 08:00 PM’’ FAILED expected: “Today 08:00 PM”, got: “Today 08:00 pm” (using ==) absolute\_time\_in\_words(Time.now.utc.change({ :hour =\> 20, :minute =\> 0, …

---

## [Sharing specs in a subclass](https://www.ruby-forum.com/t/sharing-specs-in-a-subclass/126891)

<div class="topic-metadata">

**Author:** [@johanatan](https://www.ruby-forum.com/u/johanatan)\
**Replies:** 6\
**Last updated:** [January 24, 2008, 4:26pm UTC](https://www.ruby-forum.com/t/sharing-specs-in-a-subclass/126891 "2008-01-24T16:26:00Z")

</div>

Hi I’ve spec’d a class and they pass. Now I’d like to assure that any subclass of this class also passes the same specs. Any suggestions for a clever way to handle this? I’d prefer to keep the existing specs as is (…

---

## [Constant definition matcher](https://www.ruby-forum.com/t/constant-definition-matcher/127043)

<div class="topic-metadata">

**Author:** [@jug](https://www.ruby-forum.com/u/jug)\
**Replies:** 1\
**Last updated:** [January 24, 2008, 4:00pm UTC](https://www.ruby-forum.com/t/constant-definition-matcher/127043 "2008-01-24T16:00:30Z")

</div>

Hello all, I need to specify that a class should define a constant. I couldn’t find something such as “should define\_const(‘MY\_CONST’)” in the RSpec documentation, even though there are similar matchers such as “shou…

---

## [Meridian case](https://www.ruby-forum.com/t/meridian-case/127033)

<div class="topic-metadata">

**Author:** [@Keith\_McDonnell](https://www.ruby-forum.com/u/Keith_McDonnell)\
**Replies:** 1\
**Last updated:** [January 24, 2008, 3:47pm UTC](https://www.ruby-forum.com/t/meridian-case/127033 "2008-01-24T15:47:29Z")

</div>

Hi there, I have a really weird issue with rspec on rails: Given a time meridian formatted using %p When I run rake spec the time meridian is converted to lower case: expected: “Today 08:00 PM”, got: “Today 08:00 pm…

[Previous page](https://www.ruby-forum.com/c/testing/rspec/25.md?page=108)

[Next page](https://www.ruby-forum.com/c/testing/rspec/25.md?page=110)
