# RSpec

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

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

---

## [When using command line -l, why do tests from other describe blocks run?](https://www.ruby-forum.com/t/when-using-command-line-l-why-do-tests-from-other-describe-blocks-run/201613)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 2\
**Last updated:** [January 14, 2011, 2:40am UTC](https://www.ruby-forum.com/t/when-using-command-line-l-why-do-tests-from-other-describe-blocks-run/201613 "2011-01-14T02:40:09Z")

</div>

Hi, I frequently use the -l option to run only tests of interest, but it’s messy in a way I don’t understand… describe SomeModel do describe “#some\_method” do it... # let's call this line 20 end describe “#some\_o…

---

## [Preloading of data in rspec2](https://www.ruby-forum.com/t/preloading-of-data-in-rspec2/201730)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 2\
**Last updated:** [January 14, 2011, 12:59am UTC](https://www.ruby-forum.com/t/preloading-of-data-in-rspec2/201730 "2011-01-14T00:59:39Z")

</div>

Hello, I had used Fixtures and factory girl for preloading of data in earlier version rspec. Is there any new thing for loading of data in rspec 2 or do we have to use the same. Also is there any documentation link …

---

## [\`rake spec\` with rails 3.0.3 and rspec-rails 2.4.1](https://www.ruby-forum.com/t/rake-spec-with-rails-3-0-3-and-rspec-rails-2-4-1/201757)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 3\
**Last updated:** [January 13, 2011, 11:50pm UTC](https://www.ruby-forum.com/t/rake-spec-with-rails-3-0-3-and-rspec-rails-2-4-1/201757 "2011-01-13T23:50:42Z")

</div>

We’re upgrading a rails 2.3.x application to Rails 3. When running rake spec no specs are running. $ rake spec --trace (in /Users/michaelguterl/code/rm/board) \*\* Invoke spec (first\_time, not\_needed) $ gem list | gr…

---

## [Response.should have\_text leads to undefined method \`has\_text?'](https://www.ruby-forum.com/t/response-should-have-text-leads-to-undefined-method-has-text/195919)

<div class="topic-metadata">

**Author:** [@song](https://www.ruby-forum.com/u/song)\
**Replies:** 3\
**Last updated:** [January 13, 2011, 8:45pm UTC](https://www.ruby-forum.com/t/response-should-have-text-leads-to-undefined-method-has-text/195919 "2011-01-13T20:45:44Z")

</div>

A big hello. I would like to test a controller that directly renders some JSON output (by using “render :json =\> @entity\_names”). For that task I tried in my spec file “response.should have\_text(‘\[“enim”, “enita”\]’)”. …

---

## [Results in rspec 2.4.0](https://www.ruby-forum.com/t/results-in-rspec-2-4-0/201641)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 2\
**Last updated:** [January 13, 2011, 3:06pm UTC](https://www.ruby-forum.com/t/results-in-rspec-2-4-0/201641 "2011-01-13T15:06:54Z")

</div>

Hi, I am running rspec spec for Rails 3.The version for rspec is 2.4.0 When running the script i am getting output as User Profile should not be created if name is blank Failure/Error: @contact\_detail.should be\_valid …

---

## [RSpec 2.4, named/restful routes falling apart](https://www.ruby-forum.com/t/rspec-2-4-named-restful-routes-falling-apart/201706)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 2\
**Last updated:** [January 13, 2011, 3:04pm UTC](https://www.ruby-forum.com/t/rspec-2-4-named-restful-routes-falling-apart/201706 "2011-01-13T15:04:49Z")

</div>

Guys, This could be me, but I thought I’d check For some reason, when I spec controllers, I run into this problem (intermittently it would seem). Right now, I have a spec that fails predictably. I’m using Rspec 2.…

---

## [Spec output no longer displays with results](https://www.ruby-forum.com/t/spec-output-no-longer-displays-with-results/201696)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 0\
**Last updated:** [January 13, 2011, 2:04am UTC](https://www.ruby-forum.com/t/spec-output-no-longer-displays-with-results/201696 "2011-01-13T02:04:45Z")

</div>

In RSpec 1.x, a print statement in the spec would print out with the results from that spec. In RSpec 2.x, the print statements are separated from the spec results. Is there a way to restore the 1.x behavior, so qui…

---

## [Can you control $stdout when specs are running?](https://www.ruby-forum.com/t/can-you-control-stdout-when-specs-are-running/195814)

<div class="topic-metadata">

**Author:** [@destiney](https://www.ruby-forum.com/u/destiney)\
**Replies:** 4\
**Last updated:** [January 12, 2011, 8:12pm UTC](https://www.ruby-forum.com/t/can-you-control-stdout-when-specs-are-running/195814 "2011-01-12T20:12:10Z")

</div>

Hi all, I’m testing java classed using rspec and jruby. The java super class is trapping an exception and sending a custom message to stdout along with the original exception meaasage. The original exception is a S…

---

## [No examples were matched](https://www.ruby-forum.com/t/no-examples-were-matched/201674)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 0\
**Last updated:** [January 12, 2011, 7:08pm UTC](https://www.ruby-forum.com/t/no-examples-were-matched/201674 "2011-01-12T19:08:42Z")

</div>

I am using rspec-rails 2.4.1 on a rails3 (3.0.3) app. I have around 20 specs. When I run rake spec all 20 specs run fine. However when I do bundle exec rspec then I get this message. No examples were matched. Perhaps …

---

## [Installing rspec 2 for Rails 3](https://www.ruby-forum.com/t/installing-rspec-2-for-rails-3/201645)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 2\
**Last updated:** [January 12, 2011, 1:33pm UTC](https://www.ruby-forum.com/t/installing-rspec-2-for-rails-3/201645 "2011-01-12T13:33:08Z")

</div>

Hi, I have successfully installed rspec 2 for Rails 3 by visiting the following link In this post it is mentioned taht when i do “rails g rspec:install” then it should install exist lib create lib/tasks/rspec.r…

---

## [Cookie value set in spec, but controller can't read it](https://www.ruby-forum.com/t/cookie-value-set-in-spec-but-controller-cant-read-it/201524)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 4\
**Last updated:** [January 12, 2011, 12:15pm UTC](https://www.ruby-forum.com/t/cookie-value-set-in-spec-but-controller-cant-read-it/201524 "2011-01-12T12:15:59Z")

</div>

Hello, I set a value in controller spec using @request.cookies: but when the controller reads it, it’s nil somehow, as this screenshot from the debugger shows: http://dl.dropbox.com/u/830772/p/Selection\_033.jpeg Th…

---

## [RSpec newbie ran rspec 2.4 on WinXP, got HOME undefined](https://www.ruby-forum.com/t/rspec-newbie-ran-rspec-2-4-on-winxp-got-home-undefined/201572)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 3\
**Last updated:** [January 11, 2011, 12:47pm UTC](https://www.ruby-forum.com/t/rspec-newbie-ran-rspec-2-4-on-winxp-got-home-undefined/201572 "2011-01-11T12:47:03Z")

</div>

Hi, I’m running WinXP-Pro/SP3 & Ruby 1.8.6 I just got the RSpec Book and successfully ran gem install rspec --version 2.0.0 per the book’s suggestion. In a Command window, I ran K:\>rspec -v and got: K:/\_Utilities…

---

## [View specs - best practices](https://www.ruby-forum.com/t/view-specs-best-practices/201523)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 1\
**Last updated:** [January 10, 2011, 6:05pm UTC](https://www.ruby-forum.com/t/view-specs-best-practices/201523 "2011-01-10T18:05:40Z")

</div>

Howdy, I’m trying to test some mailer views (which is no different to normal views in terms of specs)… ran into the following problem… In adherence to the “one expectation per ‘spec’”… I’m trying to write the followi…

---

## [No such file to load -- spec/rake/spectask](https://www.ruby-forum.com/t/no-such-file-to-load-spec-rake-spectask/201525)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [January 10, 2011, 5:09am UTC](https://www.ruby-forum.com/t/no-such-file-to-load-spec-rake-spectask/201525 "2011-01-10T05:09:47Z")

</div>

I am sorry but it seems like this should be a simple answer. when i run a any rake command i get the following error: no such file to load – spec/rake/spectask i amusing bundler and have the latest rspec installed. a…

---

## [Trouble making rspec-rails 2 work with webrat](https://www.ruby-forum.com/t/trouble-making-rspec-rails-2-work-with-webrat/199162)

<div class="topic-metadata">

**Author:** [@okkezSS](https://www.ruby-forum.com/u/okkezSS)\
**Replies:** 12\
**Last updated:** [January 9, 2011, 11:24pm UTC](https://www.ruby-forum.com/t/trouble-making-rspec-rails-2-work-with-webrat/199162 "2011-01-09T23:24:12Z")

</div>

I’m having problems getting rspec-rails 2 request specs to work with webrat. Any help would be appreciated. Here’s my setup: ruby 1.9.2p0 rails 3.0.1 rspec-rails 2.1.0 webrat 0.7.2 Here’s the error I’m getting: $ …

---

## [Stumped with nil Class error](https://www.ruby-forum.com/t/stumped-with-nil-class-error/201459)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 2\
**Last updated:** [January 9, 2011, 3:04pm UTC](https://www.ruby-forum.com/t/stumped-with-nil-class-error/201459 "2011-01-09T15:04:56Z")

</div>

I’m really, really confused about the use of instance variables in my controller and their relationship to my controller spec. I’m trying to spec a controller that has a before\_filter :require\_member (it’s Authlogic a…

---

## [How to test scripts in the lib directory of Rails?](https://www.ruby-forum.com/t/how-to-test-scripts-in-the-lib-directory-of-rails/201470)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 2\
**Last updated:** [January 8, 2011, 2:24am UTC](https://www.ruby-forum.com/t/how-to-test-scripts-in-the-lib-directory-of-rails/201470 "2011-01-08T02:24:42Z")

</div>

I have a script called query.rb inside my lib folder in Rails 3. I am writing a spec test for it. Though I’m no sure how to reference the Query class from my tests. Whenever I use Query, RSpec complain that it’s not a…

---

## ["No route matches" error?](https://www.ruby-forum.com/t/no-route-matches-error/201457)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 2\
**Last updated:** [January 7, 2011, 7:19pm UTC](https://www.ruby-forum.com/t/no-route-matches-error/201457 "2011-01-07T19:19:52Z")

</div>

I am new Rspec and just started by generating a new controller on Rails 3. It generates some Rspec tests by default. I have a question about how to make them pass though. As it stands, I see this test in my terminal" …

---

## [Configuring RSpec for Integration Test](https://www.ruby-forum.com/t/configuring-rspec-for-integration-test/200666)

<div class="topic-metadata">

**Author:** [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Replies:** 8\
**Last updated:** [January 7, 2011, 4:12pm UTC](https://www.ruby-forum.com/t/configuring-rspec-for-integration-test/200666 "2011-01-07T16:12:30Z")

</div>

In using RSpec for integration testing with Capybara, I was surprised thave I needed to do extra configuration. I started with the config from this blog post: http://codingfrontier.com/integration-testing-setup-with-…

---

## [After changing text in "it" block -e and -l options not working](https://www.ruby-forum.com/t/after-changing-text-in-it-block-e-and-l-options-not-working/201344)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [January 5, 2011, 5:19pm UTC](https://www.ruby-forum.com/t/after-changing-text-in-it-block-e-and-l-options-not-working/201344 "2011-01-05T17:19:43Z")

</div>

hi guys ! I am pretty new to rspec and I am still learning. I tried to change the text in “it” block and then run the rspec with -e and -l flag with appropriate values. But it dint work. What i can think of is rspe…

---

## [Looking for a gem which uses rspec for testing and tests need to deal with database](https://www.ruby-forum.com/t/looking-for-a-gem-which-uses-rspec-for-testing-and-tests-need-to-deal-with-database/201289)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 2\
**Last updated:** [January 4, 2011, 7:13pm UTC](https://www.ruby-forum.com/t/looking-for-a-gem-which-uses-rspec-for-testing-and-tests-need-to-deal-with-database/201289 "2011-01-04T19:13:12Z")

</div>

Let’s say that I develop a gem which adds a new method to ActiveRecord . Now I want to test this method using rspec. I am able to get started but not sure where to put the database.yml for testing purpose. I was wond…

---

## [Rspec-rails-2.4.0 is released!](https://www.ruby-forum.com/t/rspec-rails-2-4-0-is-released/201206)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 11\
**Last updated:** [January 3, 2011, 8:10am UTC](https://www.ruby-forum.com/t/rspec-rails-2-4-0-is-released/201206 "2011-01-03T08:10:26Z")

</div>

rspec-rails-2.4.0 / 2011-01-02 full changelog Enhancements include ApplicationHelper in helper object in helper specs include request spec extensions in files in spec/integration include controller spec extensions…

---

## [Rspec-2.4.0 is released!](https://www.ruby-forum.com/t/rspec-2-4-0-is-released/201207)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 0\
**Last updated:** [January 2, 2011, 11:43pm UTC](https://www.ruby-forum.com/t/rspec-2-4-0-is-released/201207 "2011-01-02T23:43:36Z")

</div>

Changes to rspec-core listed below. There are no functional changes to rspec-mocks or rspec-expectations for this release. Happy New Year! Cheers, David rspec-core-2.4.0 / 2011-01-02 full changelog Enhancements …

---

## [Specing Ajaxy Views](https://www.ruby-forum.com/t/specing-ajaxy-views/201096)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [January 2, 2011, 5:49pm UTC](https://www.ruby-forum.com/t/specing-ajaxy-views/201096 "2011-01-02T17:49:03Z")

</div>

Hi all, I am working on a feature to allow administrators of an online store to rearrange the order in which their product categories show up on the site. I want to use a simple implementation of sortable\_lists (mad…

---

## [Fantastic Thread on Mock Objects](https://www.ruby-forum.com/t/fantastic-thread-on-mock-objects/201196)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 0\
**Last updated:** [January 2, 2011, 3:20pm UTC](https://www.ruby-forum.com/t/fantastic-thread-on-mock-objects/201196 "2011-01-02T15:20:54Z")

</div>

This is a classic, with some terrific insights from Steve Freeman and Nat Pryce, two of the finest practitioners of TDD that I know: http://groups.google.com/group/growing-object-oriented-software/t/af0c4251123fde43 c…

---

## [My helper stubs aren't working (rspec2, rails3)](https://www.ruby-forum.com/t/my-helper-stubs-arent-working-rspec2-rails3/201157)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 6\
**Last updated:** [January 1, 2011, 10:24pm UTC](https://www.ruby-forum.com/t/my-helper-stubs-arent-working-rspec2-rails3/201157 "2011-01-01T22:24:09Z")

</div>

My helper tests broke when I upgraded to rails3/rspec2.3 - I don’t seem to be able to stub out methods in my helper tests: #users\_helper\_spec.rb describe UsersHelper do describe “the helper” do it “should stub” do …

---

## [Helper spec problems](https://www.ruby-forum.com/t/helper-spec-problems/201177)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [January 1, 2011, 6:44pm UTC](https://www.ruby-forum.com/t/helper-spec-problems/201177 "2011-01-01T18:44:45Z")

</div>

Using: rspec 2.3 with rails3 I’m unable to stub out the current\_user method in my helper, not sure what I’m doing wrong: describe “link\_to\_current\_user, When logged in” do it “should link to the given user” do helpe…

---

## [Can't get RSpec 2.3.1 to work in Rails 3.0.3 - uninitialized constant Rails (NameError)](https://www.ruby-forum.com/t/cant-get-rspec-2-3-1-to-work-in-rails-3-0-3-uninitialized-constant-rails-nameerror/201178)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 1\
**Last updated:** [January 1, 2011, 6:27pm UTC](https://www.ruby-forum.com/t/cant-get-rspec-2-3-1-to-work-in-rails-3-0-3-uninitialized-constant-rails-nameerror/201178 "2011-01-01T18:27:10Z")

</div>

I just installed rspec-rails 2.3.1 gem into a new Rails 3.0.3 app, ran the rspec:install generator, but the system doesn’t see any other RSpec generators (like rspec\_controller), and the server will no longer start. B…

---

## [Problems with rspec 1.3.1 and Ruby 1.9.2](https://www.ruby-forum.com/t/problems-with-rspec-1-3-1-and-ruby-1-9-2/201098)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 0\
**Last updated:** [December 30, 2010, 5:19am UTC](https://www.ruby-forum.com/t/problems-with-rspec-1-3-1-and-ruby-1-9-2/201098 "2010-12-30T05:19:30Z")

</div>

Hello, Recently was driving a spike on moving our app to Ruby 1.9 and ran into some problems with out test suite. I could be totally off here as I couldn’t find much reference to rspec 1.3’s ruby 1.9 compatibility. T…

---

## [Webrat or RSpec and Table Headers](https://www.ruby-forum.com/t/webrat-or-rspec-and-table-headers/201057)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 3\
**Last updated:** [December 29, 2010, 4:15pm UTC](https://www.ruby-forum.com/t/webrat-or-rspec-and-table-headers/201057 "2010-12-29T16:15:18Z")

</div>

Hi all, Suppose I have a table that lists all of my products, that includes a a somewhere in the first , and each product has its data held within a . After updating a product’s description, I want to write somethi…

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

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