# RSpec

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

[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:** 43

---

## [Check out my shelves](https://www.ruby-forum.com/t/check-out-my-shelves/183940)

<div class="topic-metadata">

**Author:** [@pat](https://www.ruby-forum.com/u/pat)\
**Replies:** 0\
**Last updated:** [February 22, 2010, 8:56pm UTC](https://www.ruby-forum.com/t/check-out-my-shelves/183940 "2010-02-22T20:56:46Z")

</div>

Hi rspec, Check out the books I added on Goodreads. users&e=removed\_email\_address@domain.invalid&i=LTM2MDQzNDk4OTE6MzY4 Pat (removed\_email\_address@domain.invalid) Goodreads is a community for book lovers. It’s a …

---

## [Re: Do you still Write Tests First on code that is churning hard?](https://www.ruby-forum.com/t/re-do-you-still-write-tests-first-on-code-that-is-churning-hard/183929)

<div class="topic-metadata">

**Author:** [@Chuck\_van\_der\_Linde](https://www.ruby-forum.com/u/Chuck_van_der_Linde)\
**Replies:** 0\
**Last updated:** [February 22, 2010, 7:30pm UTC](https://www.ruby-forum.com/t/re-do-you-still-write-tests-first-on-code-that-is-churning-hard/183929 "2010-02-22T19:30:41Z")

</div>

On 19 February 2010 08:59, Erik P. removed\_email\_address@domain.invalid wrote: creating more debugging time for myself than I’m saving without I think you can consider writing a completely separate spike to explore …

---

## [GET a path in a controller spec](https://www.ruby-forum.com/t/get-a-path-in-a-controller-spec/182644)

<div class="topic-metadata">

**Author:** [@nickh](https://www.ruby-forum.com/u/nickh)\
**Replies:** 3\
**Last updated:** [February 22, 2010, 8:31am UTC](https://www.ruby-forum.com/t/get-a-path-in-a-controller-spec/182644 "2010-02-22T08:31:34Z")

</div>

One of my controller actions sends a redirect if the request URI begins with /foods/search 34 def search 35 return redirect\_to “/#{params\[:name\]}” if request.request\_uri.match /^/foods/search/ Unfortunately, I c…

---

## [Adding path for autotest to monitor](https://www.ruby-forum.com/t/adding-path-for-autotest-to-monitor/197025)

<div class="topic-metadata">

**Author:** [@drewB](https://www.ruby-forum.com/u/drewB)\
**Replies:** 2\
**Last updated:** [February 21, 2010, 11:03pm UTC](https://www.ruby-forum.com/t/adding-path-for-autotest-to-monitor/197025 "2010-02-21T23:03:19Z")

</div>

I am using autotest with RSpec (autospec) and for some reason it doesn’t monitor files under the integration folder. Does anyone know how to config autotest to monitor additional paths? I tried playing with add\_mapp…

---

## [Suggested shorthand for and\_return when stubbing](https://www.ruby-forum.com/t/suggested-shorthand-for-and-return-when-stubbing/183817)

<div class="topic-metadata">

**Author:** [@mwalsh](https://www.ruby-forum.com/u/mwalsh)\
**Replies:** 4\
**Last updated:** [February 21, 2010, 12:42am UTC](https://www.ruby-forum.com/t/suggested-shorthand-for-and-return-when-stubbing/183817 "2010-02-21T00:42:18Z")

</div>

I keep wanting to do this, and I don’t think it’s possible so I thought I’d suggest it. Similarly to the way I can specify stub values as hash key/value pairs when constructing a test double, I’d like to be able to th…

---

## [Question About Cleaning Up Specs?](https://www.ruby-forum.com/t/question-about-cleaning-up-specs/183682)

<div class="topic-metadata">

**Author:** [@unknown](https://www.ruby-forum.com/u/unknown)\
**Replies:** 5\
**Last updated:** [February 20, 2010, 2:29am UTC](https://www.ruby-forum.com/t/question-about-cleaning-up-specs/183682 "2010-02-20T02:29:05Z")

</div>

I know we are suppose to keep specs obvious and readable, but is it normal (or there any opposition) to stubbing every method call that you needed in a before block and simply over-riding the same method with a should…

---

## [Adding to the callbacks that rspec-rails adds](https://www.ruby-forum.com/t/adding-to-the-callbacks-that-rspec-rails-adds/183565)

<div class="topic-metadata">

**Author:** [@killswitchcollectiv](https://www.ruby-forum.com/u/killswitchcollectiv)\
**Replies:** 2\
**Last updated:** [February 20, 2010, 2:14am UTC](https://www.ruby-forum.com/t/adding-to-the-callbacks-that-rspec-rails-adds/183565 "2010-02-20T02:14:27Z")

</div>

I have some code that adds to the callbacks that rspec-rails adds by default to setup and teardown fixtures. My code looks something like: module Test module Unit class TestCase append\_before(:each) …

---

## [Do you still Write Tests First on code that is churning hard?](https://www.ruby-forum.com/t/do-you-still-write-tests-first-on-code-that-is-churning-hard/183741)

<div class="topic-metadata">

**Author:** [@erik](https://www.ruby-forum.com/u/erik)\
**Replies:** 5\
**Last updated:** [February 19, 2010, 1:23pm UTC](https://www.ruby-forum.com/t/do-you-still-write-tests-first-on-code-that-is-churning-hard/183741 "2010-02-19T13:23:29Z")

</div>

Hello Specmeisters! I have a bit of a philosophical question for the TDD witches and wizards out there. I’m working on some code that is really churning… It’s doing complicated calculations, but the actual desired r…

---

## [Please help me learn how to use rspec!](https://www.ruby-forum.com/t/please-help-me-learn-how-to-use-rspec/183656)

<div class="topic-metadata">

**Author:** [@patrick99e99](https://www.ruby-forum.com/u/patrick99e99)\
**Replies:** 4\
**Last updated:** [February 18, 2010, 11:07pm UTC](https://www.ruby-forum.com/t/please-help-me-learn-how-to-use-rspec/183656 "2010-02-18T23:07:41Z")

</div>

Hi, So-- I am very very new to BDD… and I am trying to go over and write some tests for existing code that has been problematic… I am struggling with knowing exactly how to write the proper specs. So I wrote out a …

---

## [Recall a example inside another (just like in Cucumber)](https://www.ruby-forum.com/t/recall-a-example-inside-another-just-like-in-cucumber/183697)

<div class="topic-metadata">

**Author:** [@mhfs](https://www.ruby-forum.com/u/mhfs)\
**Replies:** 2\
**Last updated:** [February 18, 2010, 9:21pm UTC](https://www.ruby-forum.com/t/recall-a-example-inside-another-just-like-in-cucumber/183697 "2010-02-18T21:21:44Z")

</div>

Hello guys, I was spec’ing a model and just tried to do something like this it "should create a payment with period\_start & period\_end set correctly" do it “should create a new payment for an approved transaction” …

---

## [Have\_tag missing assert\_select outside of controller/view tests](https://www.ruby-forum.com/t/have-tag-missing-assert-select-outside-of-controller-view-tests/183638)

<div class="topic-metadata">

**Author:** [@Ed\_Howland](https://www.ruby-forum.com/u/Ed_Howland)\
**Replies:** 3\
**Last updated:** [February 18, 2010, 6:25pm UTC](https://www.ruby-forum.com/t/have-tag-missing-assert-select-outside-of-controller-view-tests/183638 "2010-02-18T18:25:31Z")

</div>

Hi, I’m trying to write an example that uses response.should have\_tag(‘div’) outside of a Rails view test. I read somewhere that as long as you have an instance variable named @response and it respondes to .body with…

---

## [Stubbing @instance.association.build](https://www.ruby-forum.com/t/stubbing-instance-association-build/183617)

<div class="topic-metadata">

**Author:** [@nmk](https://www.ruby-forum.com/u/nmk)\
**Replies:** 6\
**Last updated:** [February 18, 2010, 8:24am UTC](https://www.ruby-forum.com/t/stubbing-instance-association-build/183617 "2010-02-18T08:24:57Z")

</div>

Hi all, I am trying to spec a controller for a nested resource: Running the spec as it is in the gist results in undefined method \`save’ for nil:NilClass (line 66 in the gist) So should\_receive is interfering with …

---

## [Trying to write a failing test-- but am failing!](https://www.ruby-forum.com/t/trying-to-write-a-failing-test-but-am-failing/183591)

<div class="topic-metadata">

**Author:** [@patrick99e99](https://www.ruby-forum.com/u/patrick99e99)\
**Replies:** 13\
**Last updated:** [February 17, 2010, 7:32pm UTC](https://www.ruby-forum.com/t/trying-to-write-a-failing-test-but-am-failing/183591 "2010-02-17T19:32:24Z")

</div>

I am new to BDD, so am not quite sure how I am supposed to write a test like this… I get: “ActiveRecord::RecordInvalid in ‘User should fail when passwords do not match’ Validation failed: Password doesn’t match conf…

---

## [Running rspec complains about missing cucumber-rails](https://www.ruby-forum.com/t/running-rspec-complains-about-missing-cucumber-rails/183576)

<div class="topic-metadata">

**Author:** [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Replies:** 2\
**Last updated:** [February 17, 2010, 4:47pm UTC](https://www.ruby-forum.com/t/running-rspec-complains-about-missing-cucumber-rails/183576 "2010-02-17T16:47:17Z")

</div>

Hello, I can run cucumber tests, but when I run a rspec command (\>ruby script \\spec spec\\views\\category\_metr ics\\show.html.erb\_spec.rb --backtrace), I am getting an error that the rails-cucumber gem is not found: n…

---

## [Hash\_include with regular expression](https://www.ruby-forum.com/t/hash-include-with-regular-expression/183552)

<div class="topic-metadata">

**Author:** [@globallyunique](https://www.ruby-forum.com/u/globallyunique)\
**Replies:** 1\
**Last updated:** [February 17, 2010, 2:28pm UTC](https://www.ruby-forum.com/t/hash-include-with-regular-expression/183552 "2010-02-17T14:28:30Z")

</div>

I’m trying to match a string in a hash passed to :find using a regular expression since I don’t want to know all the other details of the :conditions passed to find. I’ve tried variations on the following with no suc…

---

## [Looking for a new NullDB maintainer](https://www.ruby-forum.com/t/looking-for-a-new-nulldb-maintainer/183561)

<div class="topic-metadata">

**Author:** [@avdi](https://www.ruby-forum.com/u/avdi)\
**Replies:** 0\
**Last updated:** [February 16, 2010, 4:21pm UTC](https://www.ruby-forum.com/t/looking-for-a-new-nulldb-maintainer/183561 "2010-02-16T16:21:36Z")

</div>

The time has come to turn NullDB maintenance over to someone new. See this post for details: Please get in touch if you’d be interested in taking over maintenance for the NullDB project. Thanks! – Avdi Home: http…

---

## [Controller specs and Middleware on Rails](https://www.ruby-forum.com/t/controller-specs-and-middleware-on-rails/183188)

<div class="topic-metadata">

**Author:** [@RomSSSSn\_GonzSSSSle](https://www.ruby-forum.com/u/RomSSSSn_GonzSSSSle)\
**Replies:** 2\
**Last updated:** [February 11, 2010, 7:44pm UTC](https://www.ruby-forum.com/t/controller-specs-and-middleware-on-rails/183188 "2010-02-11T19:44:52Z")

</div>

Hey guys, I’m having some problems on my controller specs regarding authentication. Previously I was using restful\_authentication on the project, but after a major refactoring we changed the authentication code to “…

---

## [Accept user input](https://www.ruby-forum.com/t/accept-user-input/183310)

<div class="topic-metadata">

**Author:** [@dipti](https://www.ruby-forum.com/u/dipti)\
**Replies:** 1\
**Last updated:** [February 11, 2010, 3:29pm UTC](https://www.ruby-forum.com/t/accept-user-input/183310 "2010-02-11T15:29:38Z")

</div>

How to accept input from command prompt by user

---

## [OT: Identifying unused code?](https://www.ruby-forum.com/t/ot-identifying-unused-code/183282)

<div class="topic-metadata">

**Author:** [@asoto](https://www.ruby-forum.com/u/asoto)\
**Replies:** 1\
**Last updated:** [February 11, 2010, 11:19am UTC](https://www.ruby-forum.com/t/ot-identifying-unused-code/183282 "2010-02-11T11:19:04Z")

</div>

I’m sure this has been covered before, but after some time all I’ve been able to find on the intarwebs are references to the use of code coverage tests to identify code that is not used by any current tests. I guess t…

---

## [Terminate on first failure?](https://www.ruby-forum.com/t/terminate-on-first-failure/183181)

<div class="topic-metadata">

**Author:** [@solutionmeister](https://www.ruby-forum.com/u/solutionmeister)\
**Replies:** 2\
**Last updated:** [February 10, 2010, 3:21pm UTC](https://www.ruby-forum.com/t/terminate-on-first-failure/183181 "2010-02-10T15:21:11Z")

</div>

We have thousands of code examples (‘it’ methods) in each of our rspec files, each of which is dependent upon the success of the previous one. These are wrapped in a few example groups (‘desc’ methods). There’s no cha…

---

## [\[rspec-rails\] For helper specs, why is the helper cached in the class between running each example?](https://www.ruby-forum.com/t/rspec-rails-for-helper-specs-why-is-the-helper-cached-in-the-class-between-running-each-example/183136)

<div class="topic-metadata">

**Author:** [@Myron\_M](https://www.ruby-forum.com/u/Myron_M)\
**Replies:** 3\
**Last updated:** [February 9, 2010, 2:42am UTC](https://www.ruby-forum.com/t/rspec-rails-for-helper-specs-why-is-the-helper-cached-in-the-class-between-running-each-example/183136 "2010-02-09T02:42:57Z")

</div>

I ran into a recent problem writing specs for a helper. I was testing a helper that uses the standard memoization technique of caching the result of an expensive calculation in an instance variable: def something\_exp…

---

## [Stub activerecord find given instance?](https://www.ruby-forum.com/t/stub-activerecord-find-given-instance/178741)

<div class="topic-metadata">

**Author:** [@itmozart](https://www.ruby-forum.com/u/itmozart)\
**Replies:** 9\
**Last updated:** [February 9, 2010, 12:05am UTC](https://www.ruby-forum.com/t/stub-activerecord-find-given-instance/178741 "2010-02-09T00:05:55Z")

</div>

Is there a clean/simple way of stubbing the activerecord find() for a single instance? As usual pattern, I see something like myModel = MyModel.new(…) MyModel.stub( :find ).and\_return( myModel ) which can give probl…

---

## [Testing controller plugin](https://www.ruby-forum.com/t/testing-controller-plugin/182693)

<div class="topic-metadata">

**Author:** [@pkoebbe](https://www.ruby-forum.com/u/pkoebbe)\
**Replies:** 7\
**Last updated:** [February 8, 2010, 6:28pm UTC](https://www.ruby-forum.com/t/testing-controller-plugin/182693 "2010-02-08T18:28:16Z")

</div>

I have just recently started creating some plugins, mainly of the controller variety. I have been looking for a tutorial or other documentation detailing how to go about testing these plugins with RSpec, but have not …

---

## [RSpec Rails 3 generators - first draft](https://www.ruby-forum.com/t/rspec-rails-3-generators-first-draft/183007)

<div class="topic-metadata">

**Author:** [@kristianm](https://www.ruby-forum.com/u/kristianm)\
**Replies:** 1\
**Last updated:** [February 5, 2010, 11:27pm UTC](https://www.ruby-forum.com/t/rspec-rails-3-generators-first-draft/183007 "2010-02-05T23:27:32Z")

</div>

I have just finished creating a working set of Rails 3 compatible generators for RSpec. http://github.com/kristianmandrup/rspec\_rails3\_gen Also available from gemcutter under the same name: rspec\_rails3\_gen They work…

---

## [Rspec-core requires rspec-expectations](https://www.ruby-forum.com/t/rspec-core-requires-rspec-expectations/182945)

<div class="topic-metadata">

**Author:** [@codejoy](https://www.ruby-forum.com/u/codejoy)\
**Replies:** 0\
**Last updated:** [February 5, 2010, 3:47am UTC](https://www.ruby-forum.com/t/rspec-core-requires-rspec-expectations/182945 "2010-02-05T03:47:34Z")

</div>

Hi Just wondering if anyone knows why I am getting this error now … ?? gem install rspec-rails --version 1.2.9 --no-ri --no-rdoc Thank you for installing rspec-rails-1.2.9 If you are upgrading, do this in each of y…

---

## [Spec\_server for test-unit](https://www.ruby-forum.com/t/spec-server-for-test-unit/182859)

<div class="topic-metadata">

**Author:** [@rogerdpack](https://www.ruby-forum.com/u/rogerdpack)\
**Replies:** 3\
**Last updated:** [February 5, 2010, 3:12am UTC](https://www.ruby-forum.com/t/spec-server-for-test-unit/182859 "2010-02-05T03:12:27Z")

</div>

A bit off topic, but does anybody know if there’s an equivalent to “spec\_server” for test-unit style tests? Thanks. -r

---

## [Best practices to managing RSpec code for very large projects?](https://www.ruby-forum.com/t/best-practices-to-managing-rspec-code-for-very-large-projects/182873)

<div class="topic-metadata">

**Author:** [@dgm](https://www.ruby-forum.com/u/dgm)\
**Replies:** 7\
**Last updated:** [February 4, 2010, 11:16pm UTC](https://www.ruby-forum.com/t/best-practices-to-managing-rspec-code-for-very-large-projects/182873 "2010-02-04T23:16:33Z")

</div>

Hello group, I’ve searched through several months messages in the archive, but haven’t found an answer to this… What is the ‘best practice’ way to structure RSpec code and documentation when testing a very large pr…

---

## [Passing parameters to Rspec scripts](https://www.ruby-forum.com/t/passing-parameters-to-rspec-scripts/182809)

<div class="topic-metadata">

**Author:** [@Levi\_C](https://www.ruby-forum.com/u/Levi_C)\
**Replies:** 3\
**Last updated:** [February 4, 2010, 10:13pm UTC](https://www.ruby-forum.com/t/passing-parameters-to-rspec-scripts/182809 "2010-02-04T22:13:55Z")

</div>

Newbie here. I’m hoping someone can give me an outline of how to re-use rspec scripts by passing them parameters. The situation I have is testing a web application (using watir) for about 30 different customers. Som…

---

## [rSpec 2 covered in the rSpec Book](https://www.ruby-forum.com/t/rspec-2-covered-in-the-rspec-book/182904)

<div class="topic-metadata">

**Author:** [@sclarke](https://www.ruby-forum.com/u/sclarke)\
**Replies:** 2\
**Last updated:** [February 4, 2010, 4:00pm UTC](https://www.ruby-forum.com/t/rspec-2-covered-in-the-rspec-book/182904 "2010-02-04T16:00:18Z")

</div>

Is rSpec 2.0 going to be covered at all in the rSpec book, I’m expecting delivery of the book as soon as it goes to print, so just curious.

---

## [When to use Factories, Mock Models, Mocks & Stubs](https://www.ruby-forum.com/t/when-to-use-factories-mock-models-mocks-stubs/182805)

<div class="topic-metadata">

**Author:** [@fjlj](https://www.ruby-forum.com/u/fjlj)\
**Replies:** 10\
**Last updated:** [February 3, 2010, 6:26pm UTC](https://www.ruby-forum.com/t/when-to-use-factories-mock-models-mocks-stubs/182805 "2010-02-03T18:26:04Z")

</div>

Hi guys, been following for about 3 weeks, first question - I’ve been spending the last couple of months learning RSpec and Cucumber and I’m just finally starting to see the “big picture”, at least I think I am. But I…

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

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