# RSpec

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

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

---

## [Possible to ask rspec to show more code in the debugger?](https://www.ruby-forum.com/t/possible-to-ask-rspec-to-show-more-code-in-the-debugger/202695)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 2\
**Last updated:** [February 9, 2011, 1:59am UTC](https://www.ruby-forum.com/t/possible-to-ask-rspec-to-show-more-code-in-the-debugger/202695 "2011-02-09T01:59:16Z")

</div>

This came up from an other issue where I needed to go check something in test::unit. Immediately when I dropped into the debugger in test::unit I saw something I have been missing: test unit by default shows a number …

---

## [Why use DatabaseCleaner with rSpec?](https://www.ruby-forum.com/t/why-use-databasecleaner-with-rspec/202907)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [February 8, 2011, 7:34pm UTC](https://www.ruby-forum.com/t/why-use-databasecleaner-with-rspec/202907 "2011-02-08T19:34:04Z")

</div>

Hi list, I’ve used DatabaseCleaner in the past, but only when using Cucumber and Selenium (or Steak + Celerity) since turning on transactional\_fixtures would prevent the data being accessible from app-server that is …

---

## [Custom matchers for request specs](https://www.ruby-forum.com/t/custom-matchers-for-request-specs/202863)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 2\
**Last updated:** [February 8, 2011, 2:34pm UTC](https://www.ruby-forum.com/t/custom-matchers-for-request-specs/202863 "2011-02-08T14:34:12Z")

</div>

Hi all, I’m trying to create a custom matcher that will visit a given path and check it’s authenticated. Here’s what I have so far (using rspec-rails and capybara): matcher :require\_authentication do match do |path| …

---

## [Routing error for a name-spaced nested controller](https://www.ruby-forum.com/t/routing-error-for-a-name-spaced-nested-controller/202864)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 2\
**Last updated:** [February 8, 2011, 1:17pm UTC](https://www.ruby-forum.com/t/routing-error-for-a-name-spaced-nested-controller/202864 "2011-02-08T13:17:37Z")

</div>

Struggling with nested routing and rspec… When I run spec/controllers/admin/website\_users\_controller\_spec.rb describe Admin::WebsiteUsersController do … get :index, :website =\> @website at this line I get: ActionCo…

---

## [Debugger in controller in rspec](https://www.ruby-forum.com/t/debugger-in-controller-in-rspec/202865)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 1\
**Last updated:** [February 8, 2011, 10:17am UTC](https://www.ruby-forum.com/t/debugger-in-controller-in-rspec/202865 "2011-02-08T10:17:18Z")

</div>

I placed a debugger statement in a controller being tested with rspec2 to catch what’s going on, but the statement is ignored? Do I have to do anything special to get the debugger to stop in the controller under rspec…

---

## [Autotest Errors](https://www.ruby-forum.com/t/autotest-errors/202867)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [February 8, 2011, 1:38am UTC](https://www.ruby-forum.com/t/autotest-errors/202867 "2011-02-08T01:38:46Z")

</div>

From my Rails project directory in Terminal, I’m able to run ‘bundle exec rspec spec/’ and it works successfully. When I try and run ‘autotest’, however, I get the error(s) below. Note: my .autotest file has require …

---

## [Controller Testing + Devise = boom (undefined @controller, request)](https://www.ruby-forum.com/t/controller-testing-devise-boom-undefined-controller-request/202794)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 2\
**Last updated:** [February 6, 2011, 6:17pm UTC](https://www.ruby-forum.com/t/controller-testing-devise-boom-undefined-controller-request/202794 "2011-02-06T18:17:58Z")

</div>

Here I am, trying to learn TDD and BDD. Getting start, most simple case, and the world is falling apart: My test code: it “should respond with success” do puts ‘hi’ get :new response.should be\_success end My stack…

---

## [Rspec test for correct file search](https://www.ruby-forum.com/t/rspec-test-for-correct-file-search/202791)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 0\
**Last updated:** [February 6, 2011, 4:30am UTC](https://www.ruby-forum.com/t/rspec-test-for-correct-file-search/202791 "2011-02-06T04:30:11Z")

</div>

Hi! I wrote a method to locate the file on a given within a directory, the name and line in it. How to test it? Tell me please, I have daily headache with this problem… def search(dir,name,line) … end

---

## [\`:example\` and \`:group\` scope aliases](https://www.ruby-forum.com/t/example-and-group-scope-aliases/202731)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 0\
**Last updated:** [February 4, 2011, 5:16pm UTC](https://www.ruby-forum.com/t/example-and-group-scope-aliases/202731 "2011-02-04T17:16:22Z")

</div>

As per a discussion on the mailing list \[1\], Evgeniy D. suggested that if we were going to have aliases, it would be optimal to have a change that introduced the aliases of :example, and :group, to parallel the existi…

---

## [Is there a way to tell rspec not to fail the test while in debugger?](https://www.ruby-forum.com/t/is-there-a-way-to-tell-rspec-not-to-fail-the-test-while-in-debugger/202679)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 7\
**Last updated:** [February 3, 2011, 8:10pm UTC](https://www.ruby-forum.com/t/is-there-a-way-to-tell-rspec-not-to-fail-the-test-while-in-debugger/202679 "2011-02-03T20:10:18Z")

</div>

I am curious as with Test::Unit I could go into the debugger and stay all day inside of a test and make all kinds of errors without a problem. With rspec I experience that if I make a bad query/ActiveRecord call that…

---

## [\[RAILS\] \[rspec 2.4.0\] helper spec works but rails escapes all output](https://www.ruby-forum.com/t/rails-rspec-2-4-0-helper-spec-works-but-rails-escapes-all-output/202621)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 1\
**Last updated:** [February 3, 2011, 10:54am UTC](https://www.ruby-forum.com/t/rails-rspec-2-4-0-helper-spec-works-but-rails-escapes-all-output/202621 "2011-02-03T10:54:52Z")

</div>

Hi, rspec version: 2.4.0 Given this helper - snippet: def participants\_summary table table.participants.collect{|participant| show\_short\_participant\_link(participant) }.join(’, ') end def show\_table\_link(table) li…

---

## [Array order-agnostic matching?](https://www.ruby-forum.com/t/array-order-agnostic-matching/202553)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 11\
**Last updated:** [February 2, 2011, 7:28am UTC](https://www.ruby-forum.com/t/array-order-agnostic-matching/202553 "2011-02-02T07:28:46Z")

</div>

hey, thanks for reading: I have a problem which can be reduced to this, from within an example of mine I call the helper ‘expect\_call’ which is defined thus: def expect\_call(hash)\* obj.should\_receive(:some\_ method)…

---

## [Notes on upgrading from RSpec 1 to RSpec 2](https://www.ruby-forum.com/t/notes-on-upgrading-from-rspec-1-to-rspec-2/200101)

<div class="topic-metadata">

**Author:** [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Replies:** 8\
**Last updated:** [February 2, 2011, 12:18am UTC](https://www.ruby-forum.com/t/notes-on-upgrading-from-rspec-1-to-rspec-2/200101 "2011-02-02T00:18:26Z")

</div>

I am trying to upgrade a Rails 2.2.2 app to Rails3, its a pain :wink: Part of this is I need to upgrade all my Specs to RSpec2, as this info does not seem to be in any one place, here is a summary of what I needed to…

---

## [Rspec2 - Absolutely brilliant! (at breaking stuff) - Is there a downgrade path?](https://www.ruby-forum.com/t/rspec2-absolutely-brilliant-at-breaking-stuff-is-there-a-downgrade-path/199894)

<div class="topic-metadata">

**Author:** [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Replies:** 3\
**Last updated:** [February 2, 2011, 12:11am UTC](https://www.ruby-forum.com/t/rspec2-absolutely-brilliant-at-breaking-stuff-is-there-a-downgrade-path/199894 "2011-02-02T00:11:33Z")

</div>

Just installed Rspec2 and noticed an immediate improvement in speed: it broke all 899 passing tests on an important project in a matter of seconds. Sadly, I don’t have the time to work my way through the multitude up…

---

## [Comparing two XML documents](https://www.ruby-forum.com/t/comparing-two-xml-documents/202306)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 3\
**Last updated:** [January 31, 2011, 11:56pm UTC](https://www.ruby-forum.com/t/comparing-two-xml-documents/202306 "2011-01-31T23:56:43Z")

</div>

I have a problem. I have a test that needs to assert that one XML document looks exactly like another XML document. I couldn’t find a way to compare them as Nokogiri::XML::Documents, so I converted them both to string…

---

## [Difference between :each and :all](https://www.ruby-forum.com/t/difference-between-each-and-all/202385)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 14\
**Last updated:** [January 31, 2011, 6:58pm UTC](https://www.ruby-forum.com/t/difference-between-each-and-all/202385 "2011-01-31T18:58:00Z")

</div>

I’m having a hard time grasping the difference between :each and :all. If I have a bunch of stuff inside a “before :each” block. Everytime I try to run an example that block of code will be run before the example. Now…

---

## [Feedback on feature request](https://www.ruby-forum.com/t/feedback-on-feature-request/202513)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 0\
**Last updated:** [January 31, 2011, 4:43pm UTC](https://www.ruby-forum.com/t/feedback-on-feature-request/202513 "2011-01-31T16:43:39Z")

</div>

Hey all, There is a feature request for rspec-core that I’d like to see some opinions about. The idea is to be able to reference subjects and methods defined with let() in parent groups from within the subject() and l…

---

## [Autotest giving error when having shared example in specs](https://www.ruby-forum.com/t/autotest-giving-error-when-having-shared-example-in-specs/195733)

<div class="topic-metadata">

**Author:** [@anagri](https://www.ruby-forum.com/u/anagri)\
**Replies:** 10\
**Last updated:** [January 31, 2011, 2:23pm UTC](https://www.ruby-forum.com/t/autotest-giving-error-when-having-shared-example-in-specs/195733 "2011-01-31T14:23:14Z")

</div>

I am having a shared example ‘allow authorized actions’ for my Rails 3 RSpec 2.beta.20 application. The shared example looks like share\_examples\_for ‘allow authorized actions’ do … end This shared example is in fil…

---

## [Command with -l and shared examples](https://www.ruby-forum.com/t/command-with-l-and-shared-examples/202503)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 0\
**Last updated:** [January 31, 2011, 1:28pm UTC](https://www.ruby-forum.com/t/command-with-l-and-shared-examples/202503 "2011-01-31T13:28:34Z")

</div>

I cannot use the -l option on a spec that has shared examples definition. If I try to run with -l value set to a test block that is outside the shared examples group all it does it runs the tests in the shared exampl…

---

## [Are there test:recent, test:uncommitted task alternative for RSpec](https://www.ruby-forum.com/t/are-there-test-recent-test-uncommitted-task-alternative-for-rspec/202500)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 0\
**Last updated:** [January 31, 2011, 11:47am UTC](https://www.ruby-forum.com/t/are-there-test-recent-test-uncommitted-task-alternative-for-rspec/202500 "2011-01-31T11:47:22Z")

</div>

By default Rails provides these task to test\_unit tests: rake -T rake test:recent # Run tests for recenttest:prepare / Test recent changes rake test:uncommitted # R…

---

## [Named routes problem more rails than rspec](https://www.ruby-forum.com/t/named-routes-problem-more-rails-than-rspec/202477)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 5\
**Last updated:** [January 31, 2011, 6:54am UTC](https://www.ruby-forum.com/t/named-routes-problem-more-rails-than-rspec/202477 "2011-01-31T06:54:42Z")

</div>

Howdy, I have emailed before about the inconsistencies I’m spotting when using named routes/resource, but I think I’ve narrowed down the issue. It would seem this has nothing to do with rspec per se, but more with ho…

---

## [Undefined method \`stub!' for](https://www.ruby-forum.com/t/undefined-method-stub-for/202484)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 0\
**Last updated:** [January 30, 2011, 7:16pm UTC](https://www.ruby-forum.com/t/undefined-method-stub-for/202484 "2011-01-30T19:16:42Z")

</div>

Hey, Using RSpec 2.4.0 with Rails 3.0.3 I’m doing this: rake spec:models and things works well. Now, when doing rspec spec/models/spot\_spec.rb that has Spot.stub! :test1 I get: undefined method \`stub!’ for Spot:Cl…

---

## [Is there an easy way to inject each example text into test.log](https://www.ruby-forum.com/t/is-there-an-easy-way-to-inject-each-example-text-into-test-log/202475)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 6\
**Last updated:** [January 30, 2011, 6:15pm UTC](https://www.ruby-forum.com/t/is-there-an-easy-way-to-inject-each-example-text-into-test-log/202475 "2011-01-30T18:15:08Z")

</div>

This was asked back in 2008 but I’m wondering if there is an easier way with rspec2 and rails. Seems like it would make my test log much more meaningful. Surely somebody must have done it. Is there an easy way to inje…

---

## [Feedback Requested (pretty please)](https://www.ruby-forum.com/t/feedback-requested-pretty-please/201414)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 4\
**Last updated:** [January 29, 2011, 5:08am UTC](https://www.ruby-forum.com/t/feedback-requested-pretty-please/201414 "2011-01-29T05:08:48Z")

</div>

I have dabbled with RSpec with the Beta books but am only now getting my teeth in to it. Because of this and because I have no one to ask/bounce ideas off, I am asking for a kind soul to look at what I’ve done for my …

---

## [Changes in rspec 2.4 break ci\_reporter](https://www.ruby-forum.com/t/changes-in-rspec-2-4-break-ci-reporter/202302)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 2\
**Last updated:** [January 28, 2011, 11:26am UTC](https://www.ruby-forum.com/t/changes-in-rspec-2-4-break-ci-reporter/202302 "2011-01-28T11:26:37Z")

</div>

Hi I use the ci\_reporter gem for builds on my CI machine (hudson). Prior to rspec 2.4, environment options would override commandline options. So the gem used this to change the formatter and require its files. In …

---

## [Rspec-rails 2 adding current account helper to all view specs](https://www.ruby-forum.com/t/rspec-rails-2-adding-current-account-helper-to-all-view-specs/202382)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 1\
**Last updated:** [January 28, 2011, 10:53am UTC](https://www.ruby-forum.com/t/rspec-rails-2-adding-current-account-helper-to-all-view-specs/202382 "2011-01-28T10:53:16Z")

</div>

Hi, in rspec-1 view specs i had the ability to say: login\_as(some\_role\_or\_account) which made some helper methods like current\_account that where used in views and controllers return something valuable. Implementat…

---

## [Checking order of method calls on different mocks](https://www.ruby-forum.com/t/checking-order-of-method-calls-on-different-mocks/202390)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [January 28, 2011, 4:21am UTC](https://www.ruby-forum.com/t/checking-order-of-method-calls-on-different-mocks/202390 "2011-01-28T04:21:26Z")

</div>

I have a spec where I need to check that the order of 2 method calls to 2 different mocks is correct: mock\_customer.should\_receive(:save).ordered mock\_customer.should\_recieve(:id).and\_return(1).ordered mock\_order.sho…

---

## [Performance tests using Rspec](https://www.ruby-forum.com/t/performance-tests-using-rspec/201908)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 3\
**Last updated:** [January 28, 2011, 4:07am UTC](https://www.ruby-forum.com/t/performance-tests-using-rspec/201908 "2011-01-28T04:07:34Z")

</div>

Know of any guides to writing performance tests using Rspec? Does Rspec have the capability to run specs in benchmarking or profiling mode similar to the way Rails has performance tests that run in these modes (ht…

---

## [Feedback on matcher](https://www.ruby-forum.com/t/feedback-on-matcher/202357)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 5\
**Last updated:** [January 28, 2011, 12:31am UTC](https://www.ruby-forum.com/t/feedback-on-matcher/202357 "2011-01-28T00:31:46Z")

</div>

We have moved from Rails 2 to 3 and the changing Mailer syntax has caused us to rewrite some of our specs. In Rails 2: Implementation: Mailer.deliver\_job\_application(job.id, user.id) Spec: Mailer.should\_receive(:de…

---

## [Relish documentation for RSpec](https://www.ruby-forum.com/t/relish-documentation-for-rspec/202383)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [January 27, 2011, 11:42pm UTC](https://www.ruby-forum.com/t/relish-documentation-for-rspec/202383 "2011-01-27T23:42:11Z")

</div>

I was looking at the Relish documentation for RSpec today and noticed there are a few missing bits. For example, the expectation raise\_error can take a block which the raised error gets passed to. This is not documen…

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

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