# RSpec

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

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

---

## [Real story examples & guidelines learnt](https://www.ruby-forum.com/t/real-story-examples-guidelines-learnt/146041)

<div class="topic-metadata">

**Author:** [@joesniff](https://www.ruby-forum.com/u/joesniff)\
**Replies:** 0\
**Last updated:** [August 16, 2008, 4:15pm UTC](https://www.ruby-forum.com/t/real-story-examples-guidelines-learnt/146041 "2008-08-16T16:15:20Z")

</div>

Hello, I have been putting together over the last couple of months various guidelines I’ve learnt and picked as I’ve used Rspec stories. After speaking to lots of people I found they initially found great resources t…

---

## [Formatter writing output on different files](https://www.ruby-forum.com/t/formatter-writing-output-on-different-files/145865)

<div class="topic-metadata">

**Author:** [@crocco](https://www.ruby-forum.com/u/crocco)\
**Replies:** 1\
**Last updated:** [August 16, 2008, 2:14pm UTC](https://www.ruby-forum.com/t/formatter-writing-output-on-different-files/145865 "2008-08-16T14:14:58Z")

</div>

Hello to every one, First of all, sorry if this message has already reached the list. I sent it yesterday, but since today I don’t see it in the archives, I’m resending it. I’m writing an application and using rspec…

---

## [How many scenarios](https://www.ruby-forum.com/t/how-many-scenarios/146010)

<div class="topic-metadata">

**Author:** [@johanatan](https://www.ruby-forum.com/u/johanatan)\
**Replies:** 1\
**Last updated:** [August 16, 2008, 2:25am UTC](https://www.ruby-forum.com/t/how-many-scenarios/146010 "2008-08-16T02:25:58Z")

</div>

Hi, at the risk of posing an insignificant question, I’m curious how many Scenarios you are putting into a given Story file? How many would you consider ‘alot’? ‘too much’? and why?

---

## [Rake and Story HTML](https://www.ruby-forum.com/t/rake-and-story-html/145967)

<div class="topic-metadata">

**Author:** [@aidy\_lewis](https://www.ruby-forum.com/u/aidy_lewis)\
**Replies:** 0\
**Last updated:** [August 15, 2008, 4:23pm UTC](https://www.ruby-forum.com/t/rake-and-story-html/145967 "2008-08-15T16:23:53Z")

</div>

Hi, I have a rake file require 'rake' require 'rake/runtest' task :default =\> \[:dcs\] task :dcs do Rake.run\_tests ‘projects/dcs/runner/\*\*/\*.rb’ end That cycles through the runner folder and executes the tests. H…

---

## [Stubbing calls to the command line](https://www.ruby-forum.com/t/stubbing-calls-to-the-command-line/145823)

<div class="topic-metadata">

**Author:** [@andy](https://www.ruby-forum.com/u/andy)\
**Replies:** 5\
**Last updated:** [August 15, 2008, 5:58am UTC](https://www.ruby-forum.com/t/stubbing-calls-to-the-command-line/145823 "2008-08-15T05:58:35Z")

</div>

I’m using a call to wget to download a large datafile (multiple megabytes) having assumed this will be quicker than using open-uri. How can I spec the behaviour? Ideally I’d also like to not be hitting the internet ev…

---

## [First try to make a controller test with RSpe](https://www.ruby-forum.com/t/first-try-to-make-a-controller-test-with-rspe/145773)

<div class="topic-metadata">

**Author:** [@unknown](https://www.ruby-forum.com/u/unknown)\
**Replies:** 9\
**Last updated:** [August 14, 2008, 8:27pm UTC](https://www.ruby-forum.com/t/first-try-to-make-a-controller-test-with-rspe/145773 "2008-08-14T20:27:08Z")

</div>

Hello, I’m trying to create a controller test with RSpec but I get the error when I run spec login\_controller\_spec.rb --format specdoc …/…/app/controllers/application.rb:4: uninitialized constant ActionController (…

---

## [Template.expect\_render fails when partial is rendered from a helper](https://www.ruby-forum.com/t/template-expect-render-fails-when-partial-is-rendered-from-a-helper/145417)

<div class="topic-metadata">

**Author:** [@noagenda](https://www.ruby-forum.com/u/noagenda)\
**Replies:** 2\
**Last updated:** [August 14, 2008, 7:15pm UTC](https://www.ruby-forum.com/t/template-expect-render-fails-when-partial-is-rendered-from-a-helper/145417 "2008-08-14T19:15:31Z")

</div>

My spec; describe ‘subnav rendering while logged in’ do before do template.stub!(:logged\_in?).and\_return(true) template.stub! (:current\_profile).at\_least(:once).and\_return(mock\_profile) end def do\_render rende…

---

## [How do you stub out callbacks?](https://www.ruby-forum.com/t/how-do-you-stub-out-callbacks/145853)

<div class="topic-metadata">

**Author:** [@rob](https://www.ruby-forum.com/u/rob)\
**Replies:** 3\
**Last updated:** [August 14, 2008, 6:51pm UTC](https://www.ruby-forum.com/t/how-do-you-stub-out-callbacks/145853 "2008-08-14T18:51:26Z")

</div>

Hi there, I’m trying to write a spec for and existing model. It has an after\_create callback which I’d like to stub out. Any quick solution to this? Many thanks Rob L.

---

## [Require StepGroup problem](https://www.ruby-forum.com/t/require-stepgroup-problem/145796)

<div class="topic-metadata">

**Author:** [@Gaston\_R](https://www.ruby-forum.com/u/Gaston_R)\
**Replies:** 4\
**Last updated:** [August 14, 2008, 6:34pm UTC](https://www.ruby-forum.com/t/require-stepgroup-problem/145796 "2008-08-14T18:34:22Z")

</div>

Hi guys, I’m trying to run this story http://pastie.org/252361 and I get the following error: http://pastie.org/252367 the helper file is: http://pastie.org/252368 I think that I’m missing a require somewhere, can any…

---

## [Traditional Rspec HTML reports through Story Runner?](https://www.ruby-forum.com/t/traditional-rspec-html-reports-through-story-runner/145836)

<div class="topic-metadata">

**Author:** [@aidy\_lewis](https://www.ruby-forum.com/u/aidy_lewis)\
**Replies:** 2\
**Last updated:** [August 14, 2008, 2:59pm UTC](https://www.ruby-forum.com/t/traditional-rspec-html-reports-through-story-runner/145836 "2008-08-14T14:59:04Z")

</div>

Hi, I am currently using the story runner HTML ruby aut.rb -fh:“C:\\C:\\rspec\_reports\\aut.htm” Is it possible to also produce the traditional Rspec HTML reports through Story Runner as well Aidy

---

## [Multy threading in ruby](https://www.ruby-forum.com/t/multy-threading-in-ruby/145830)

<div class="topic-metadata">

**Author:** [@kajamohaideen\_2003](https://www.ruby-forum.com/u/kajamohaideen_2003)\
**Replies:** 1\
**Last updated:** [August 14, 2008, 11:05am UTC](https://www.ruby-forum.com/t/multy-threading-in-ruby/145830 "2008-08-14T11:05:07Z")

</div>

we people are new team for ruby. we trying to put multithreading in our code. how is it possible? we want to read a message from queue and process that message parellaly and finally insert the message to the DB. Can y…

---

## [Formatter writing output on different files](https://www.ruby-forum.com/t/formatter-writing-output-on-different-files/145758)

<div class="topic-metadata">

**Author:** [@crocco](https://www.ruby-forum.com/u/crocco)\
**Replies:** 0\
**Last updated:** [August 13, 2008, 6:54pm UTC](https://www.ruby-forum.com/t/formatter-writing-output-on-different-files/145758 "2008-08-13T18:54:16Z")

</div>

Hello to every one, I’m writing an application and using rspec to test it. I like very much it’s html output, since it allows me to look at it and see how something is supposed to work. The only problem is that the l…

---

## [Return code question](https://www.ruby-forum.com/t/return-code-question/145676)

<div class="topic-metadata">

**Author:** [@killswitchcollectiv](https://www.ruby-forum.com/u/killswitchcollectiv)\
**Replies:** 2\
**Last updated:** [August 13, 2008, 6:12pm UTC](https://www.ruby-forum.com/t/return-code-question/145676 "2008-08-13T18:12:39Z")

</div>

We are trying to automate the running of our rspec tests for our Rails app on a build server using Capistrano. The problem is that Capistrano seems to think that the command called to run the model tests failed when…

---

## [WDYT, simple, anonymous story listeners?](https://www.ruby-forum.com/t/wdyt-simple-anonymous-story-listeners/145700)

<div class="topic-metadata">

**Author:** [@zdennis](https://www.ruby-forum.com/u/zdennis)\
**Replies:** 11\
**Last updated:** [August 13, 2008, 5:27pm UTC](https://www.ruby-forum.com/t/wdyt-simple-anonymous-story-listeners/145700 "2008-08-13T17:27:26Z")

</div>

Sometimes I don’t have a full need to make a class to do something, yet I want something readable and concise. This is influenced from the joys of JavaScript. Today I made this happen. Love it, like it, hate it, WDYT? …

---

## [Keep getting respond\_to? errors](https://www.ruby-forum.com/t/keep-getting-respond-to-errors/144986)

<div class="topic-metadata">

**Author:** [@FischerS\_Daniel](https://www.ruby-forum.com/u/FischerS_Daniel)\
**Replies:** 3\
**Last updated:** [August 13, 2008, 10:53am UTC](https://www.ruby-forum.com/t/keep-getting-respond-to-errors/144986 "2008-08-13T10:53:12Z")

</div>

Every time I save a model spec I get this: super: no superclass method \`respond\_to?’ And I have to restart autotest to get it to go away. Is there any solution to this?

---

## [Find\_all\_by returning nil](https://www.ruby-forum.com/t/find-all-by-returning-nil/145586)

<div class="topic-metadata">

**Author:** [@jmaenpaa](https://www.ruby-forum.com/u/jmaenpaa)\
**Replies:** 11\
**Last updated:** [August 11, 2008, 10:35pm UTC](https://www.ruby-forum.com/t/find-all-by-returning-nil/145586 "2008-08-11T22:35:16Z")

</div>

The statement products = find\_all\_by\_category\_id(category\_id) in the Product model is returning nil with rspec. I am expecting it to to return value for the stub that I provided it with. It does not also work with f…

---

## [Someone please name this matcher for me](https://www.ruby-forum.com/t/someone-please-name-this-matcher-for-me/145199)

<div class="topic-metadata">

**Author:** [@pergesu](https://www.ruby-forum.com/u/pergesu)\
**Replies:** 17\
**Last updated:** [August 11, 2008, 9:23pm UTC](https://www.ruby-forum.com/t/someone-please-name-this-matcher-for-me/145199 "2008-08-11T21:23:09Z")

</div>

I’ve had a matcher in my head for a couple months, that I frequently want but never get around to writing because I can’t think of the name for it. Here’s how it would look \[1, 2, 3, 4, 1\].should … \[1, 3, 1, 4, 2\] I…

---

## [Calls with block in views](https://www.ruby-forum.com/t/calls-with-block-in-views/145529)

<div class="topic-metadata">

**Author:** [@yura](https://www.ruby-forum.com/u/yura)\
**Replies:** 1\
**Last updated:** [August 11, 2008, 12:47pm UTC](https://www.ruby-forum.com/t/calls-with-block-in-views/145529 "2008-08-11T12:47:18Z")

</div>

Hi! I have a view: \<% restrict\_to ‘admin’ do %\> \<%= render :partial =\> 'detail' %\> \<% end %\> What’s the best way to spec view in this case - I just want to yield block in restrict\_to call. Thanks in advanc…

---

## [Confused about square bracket usage](https://www.ruby-forum.com/t/confused-about-square-bracket-usage/145521)

<div class="topic-metadata">

**Author:** [@Teedub](https://www.ruby-forum.com/u/Teedub)\
**Replies:** 1\
**Last updated:** [August 11, 2008, 8:32am UTC](https://www.ruby-forum.com/t/confused-about-square-bracket-usage/145521 "2008-08-11T08:32:40Z")

</div>

I ran script/generate rspec\_scaffold page title:string body:text and have been reading on the generated code in my spare time in an attempt to fully understand rspec. It mostly makes a lot of sense except for the squa…

---

## [First encounter with RSpec, please help](https://www.ruby-forum.com/t/first-encounter-with-rspec-please-help/145490)

<div class="topic-metadata">

**Author:** [@caiwangqin](https://www.ruby-forum.com/u/caiwangqin)\
**Replies:** 2\
**Last updated:** [August 11, 2008, 1:22am UTC](https://www.ruby-forum.com/t/first-encounter-with-rspec-please-help/145490 "2008-08-11T01:22:29Z")

</div>

Hello, I’m working on a feature of insoshi to limit daily connection requests, using a boolean and integer value set by the admin. The feature works fine, but causes 11 failures in \`rake spec’, not to mention the two…

---

## [Passing a hash in stories](https://www.ruby-forum.com/t/passing-a-hash-in-stories/145388)

<div class="topic-metadata">

**Author:** [@johanatan](https://www.ruby-forum.com/u/johanatan)\
**Replies:** 2\
**Last updated:** [August 8, 2008, 11:37pm UTC](https://www.ruby-forum.com/t/passing-a-hash-in-stories/145388 "2008-08-08T23:37:29Z")

</div>

Hi, Anyone have code you could share that lets you pass a hash in plain text stories, for example Then I fill out form with name: Jon, email: removed\_email\_address@domain.invalid, age: 9 passes in a hash { ‘name’ =\> …

---

## [Can't test for page content after a redirect](https://www.ruby-forum.com/t/cant-test-for-page-content-after-a-redirect/145312)

<div class="topic-metadata">

**Author:** [@clauer](https://www.ruby-forum.com/u/clauer)\
**Replies:** 3\
**Last updated:** [August 8, 2008, 7:29pm UTC](https://www.ruby-forum.com/t/cant-test-for-page-content-after-a-redirect/145312 "2008-08-08T19:29:19Z")

</div>

I’m trying to verify that data entered in a form has been saved in the database. Scenario: User enters a bookmark URL Given a bookmark ‘http://www.gotapi.com/rubyrails’ When the user adds the bookmark Then should re…

---

## [Embedding variable in a regex](https://www.ruby-forum.com/t/embedding-variable-in-a-regex/145378)

<div class="topic-metadata">

**Author:** [@aidy\_lewis](https://www.ruby-forum.com/u/aidy_lewis)\
**Replies:** 1\
**Last updated:** [August 8, 2008, 5:39pm UTC](https://www.ruby-forum.com/t/embedding-variable-in-a-regex/145378 "2008-08-08T17:39:06Z")

</div>

Given /a (PROGRAM|PROGRAMMES) title of ‘$title’/ do |title| … end Could anyone give me the correct syntax for embedding this variable in a regex? Aidy

---

## [Stories run with "ruby", not "spec"](https://www.ruby-forum.com/t/stories-run-with-ruby-not-spec/145387)

<div class="topic-metadata">

**Author:** [@jay-levitt](https://www.ruby-forum.com/u/jay-levitt)\
**Replies:** 0\
**Last updated:** [August 8, 2008, 5:39pm UTC](https://www.ruby-forum.com/t/stories-run-with-ruby-not-spec/145387 "2008-08-08T17:39:06Z")

</div>

Since there’s no real documentation for stories yet, and since none of the blog posts about it ever show it being run, I thought some other newbie might find this useful information when they’re Googling: You don’t r…

---

## [Hash\_excluding/hash\_only?](https://www.ruby-forum.com/t/hash-excluding-hash-only/145179)

<div class="topic-metadata">

**Author:** [@steve](https://www.ruby-forum.com/u/steve)\
**Replies:** 3\
**Last updated:** [August 7, 2008, 3:49am UTC](https://www.ruby-forum.com/t/hash-excluding-hash-only/145179 "2008-08-07T03:49:04Z")

</div>

I know there is a hash\_including, which is quite useful. Are there by chance any matchers for ensuring a hash includes only the specified values, or that it doesn’t have certain values? Thanks, Steve

---

## [How to consolidate old\_project/test/\* with new\_project/spec/\*?](https://www.ruby-forum.com/t/how-to-consolidate-old-project-test-with-new-project-spec/145155)

<div class="topic-metadata">

**Author:** [@reddvinylene](https://www.ruby-forum.com/u/reddvinylene)\
**Replies:** 1\
**Last updated:** [August 7, 2008, 1:22am UTC](https://www.ruby-forum.com/t/how-to-consolidate-old-project-test-with-new-project-spec/145155 "2008-08-07T01:22:08Z")

</div>

Hello everybody:) I’m new to this, but how should I go about consolidating old\_project/test/\* with new\_project/spec/\*? Here is the contents of my old\_project/test/\* – http://pastie.org/248453 Would I have to rewrite…

---

## [Old plugin points to old docs to explain how to upgrade to new plugin](https://www.ruby-forum.com/t/old-plugin-points-to-old-docs-to-explain-how-to-upgrade-to-new-plugin/145186)

<div class="topic-metadata">

**Author:** [@jay-levitt](https://www.ruby-forum.com/u/jay-levitt)\
**Replies:** 0\
**Last updated:** [August 6, 2008, 6:58pm UTC](https://www.ruby-forum.com/t/old-plugin-points-to-old-docs-to-explain-how-to-upgrade-to-new-plugin/145186 "2008-08-06T18:58:40Z")

</div>

I was using Ben M.'s tutorial, which includes an older RSpec on Rails (20080131122909) plugin, and thus reported that it was incompatible with my 1.1.4 gem. It tries to be helpful, and says: “See http://rspec.rubyfo…

---

## [Re: \[ANN/ADV\] "Scripted GUI Testing With Ruby" book (uses RSpec)](https://www.ruby-forum.com/t/re-ann-adv-scripted-gui-testing-with-ruby-book-uses-rspec/145181)

<div class="topic-metadata">

**Author:** [@idrysdale](https://www.ruby-forum.com/u/idrysdale)\
**Replies:** 0\
**Last updated:** [August 6, 2008, 6:39pm UTC](https://www.ruby-forum.com/t/re-ann-adv-scripted-gui-testing-with-ruby-book-uses-rspec/145181 "2008-08-06T18:39:57Z")

</div>

Ian, sounds like your espresso machine needs some gui testing… Hmmm … gui espresso? I prefer mine a bit more watiry. What, no Mocha jokes?

---

## [Straw Poll: How are you using plain text stories (in rails)?](https://www.ruby-forum.com/t/straw-poll-how-are-you-using-plain-text-stories-in-rails/145138)

<div class="topic-metadata">

**Author:** [@mwalsh](https://www.ruby-forum.com/u/mwalsh)\
**Replies:** 9\
**Last updated:** [August 6, 2008, 6:32pm UTC](https://www.ruby-forum.com/t/straw-poll-how-are-you-using-plain-text-stories-in-rails/145138 "2008-08-06T18:32:01Z")

</div>

Hi all, I’ve been using rspec / rails for just over a week now, and I’m loving the specification framework. The way I can group examples together feels really natural, and I’m finding the TDD flow terrific. Thus far…

---

## [\[ANN/ADV\] "Scripted GUI Testing With Ruby" book (uses RSpec)](https://www.ruby-forum.com/t/ann-adv-scripted-gui-testing-with-ruby-book-uses-rspec/145117)

<div class="topic-metadata">

**Author:** [@idrysdale](https://www.ruby-forum.com/u/idrysdale)\
**Replies:** 3\
**Last updated:** [August 6, 2008, 2:56pm UTC](https://www.ruby-forum.com/t/ann-adv-scripted-gui-testing-with-ruby-book-uses-rspec/145117 "2008-08-06T14:56:38Z")

</div>

Hi, all. The publishers have just thrown the switch to make my new book, “Scripted GUI Testing With Ruby,” available for purchase in both PDF and “analog.” The book uses RSpec heavily throughout (both example notat…

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

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