# RSpec

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

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

---

## [How to run specs AND tests with autotest](https://www.ruby-forum.com/t/how-to-run-specs-and-tests-with-autotest/143430)

<div class="topic-metadata">

**Author:** [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Replies:** 2\
**Last updated:** [July 18, 2008, 3:03pm UTC](https://www.ruby-forum.com/t/how-to-run-specs-and-tests-with-autotest/143430 "2008-07-18T15:03:43Z")

</div>

Hi All I’m using test/unit on a project, at the client’s insistence, but I’m also using rspec stories for integration testing. I notice that as soon as I install rspec and rspec-rails plugins, autotest no longer find…

---

## [Specing Law of Demeter methods](https://www.ruby-forum.com/t/specing-law-of-demeter-methods/143402)

<div class="topic-metadata">

**Author:** [@Britt\_Mileshosky](https://www.ruby-forum.com/u/Britt_Mileshosky)\
**Replies:** 1\
**Last updated:** [July 18, 2008, 4:01am UTC](https://www.ruby-forum.com/t/specing-law-of-demeter-methods/143402 "2008-07-18T04:01:01Z")

</div>

It’s been suggested that instead of doing – organization.events.find(params\[:id\]) that you should be writing – organization.get\_event( params\[:id\] ) and the orgs ‘get\_event’ method should look like – def get\_event( …

---

## [Seed Data With Stories](https://www.ruby-forum.com/t/seed-data-with-stories/143358)

<div class="topic-metadata">

**Author:** [@zdennis](https://www.ruby-forum.com/u/zdennis)\
**Replies:** 0\
**Last updated:** [July 17, 2008, 5:09pm UTC](https://www.ruby-forum.com/t/seed-data-with-stories/143358 "2008-07-17T17:09:34Z")

</div>

More of an FYI should someone find this useful, http://www.continuousthinking.com/2008/7/17/using-seed-data-with-rspec-stories – Zach D. http://www.continuousthinking.com

---

## [How to do HTTP Basic Authentication in stories with WebRat?](https://www.ruby-forum.com/t/how-to-do-http-basic-authentication-in-stories-with-webrat/143292)

<div class="topic-metadata">

**Author:** [@fxp](https://www.ruby-forum.com/u/fxp)\
**Replies:** 0\
**Last updated:** [July 17, 2008, 2:01am UTC](https://www.ruby-forum.com/t/how-to-do-http-basic-authentication-in-stories-with-webrat/143292 "2008-07-17T02:01:32Z")

</div>

I have a controller that has simple HTTP basic authentication protecting a bunch of its actions. How can I authentication/get around this when creating stories for this controller that I’m driving via WebRat? From w…

---

## [License to post rspec example](https://www.ruby-forum.com/t/license-to-post-rspec-example/143262)

<div class="topic-metadata">

**Author:** [@aidy\_lewis](https://www.ruby-forum.com/u/aidy_lewis)\
**Replies:** 0\
**Last updated:** [July 16, 2008, 9:16pm UTC](https://www.ruby-forum.com/t/license-to-post-rspec-example/143262 "2008-07-16T21:16:31Z")

</div>

Hi, Would I need to use a license or give credit if I posted on OpenQA an example of Rspec and Watir (with my own AUT object model)? Aidy

---

## [Testing upload via web services](https://www.ruby-forum.com/t/testing-upload-via-web-services/143214)

<div class="topic-metadata">

**Author:** [@Nicholas\_W](https://www.ruby-forum.com/u/Nicholas_W)\
**Replies:** 1\
**Last updated:** [July 16, 2008, 1:29pm UTC](https://www.ruby-forum.com/t/testing-upload-via-web-services/143214 "2008-07-16T13:29:46Z")

</div>

Hi \*, I need to write a web service that accepts file uploads (even large ones). My WS is REST based, so I have a create method that accepts only POST. My problem is passing the file to the method, so if someone alre…

---

## [Re: How to write specification for the \*base\* class API?](https://www.ruby-forum.com/t/re-how-to-write-specification-for-the-base-class-api/143137)

<div class="topic-metadata">

**Author:** [@crucoba](https://www.ruby-forum.com/u/crucoba)\
**Replies:** 5\
**Last updated:** [July 16, 2008, 7:14am UTC](https://www.ruby-forum.com/t/re-how-to-write-specification-for-the-base-class-api/143137 "2008-07-16T07:14:28Z")

</div>

On Jul 15, 2008, at 8:22 AM, Piotr W. removed\_email\_address@domain.invalid wrote: It’s not AR. I have 2 levels: Site1Scraper \< BaseScraper. There will be many SiteXScrapers implemented by several people. ++++ From…

---

## [Profiling specs](https://www.ruby-forum.com/t/profiling-specs/143117)

<div class="topic-metadata">

**Author:** [@johanatan](https://www.ruby-forum.com/u/johanatan)\
**Replies:** 3\
**Last updated:** [July 16, 2008, 2:08am UTC](https://www.ruby-forum.com/t/profiling-specs/143117 "2008-07-16T02:08:15Z")

</div>

Hi, Is there any simple, easy way to profile the running of my specs? It has recently starting being way slower and I want to know why :slight\_smile: Cheers, Jon

---

## [How to write specification for the \*base\* class API?](https://www.ruby-forum.com/t/how-to-write-specification-for-the-base-class-api/143108)

<div class="topic-metadata">

**Author:** [@qertoip](https://www.ruby-forum.com/u/qertoip)\
**Replies:** 6\
**Last updated:** [July 15, 2008, 3:22pm UTC](https://www.ruby-forum.com/t/how-to-write-specification-for-the-base-class-api/143108 "2008-07-15T15:22:12Z")

</div>

For the base class, it seems reasonable to specify public API with RSpec. However, since we deal with a base class, methods are often empty (put there just to show the API). The spec cannot be run against the base cl…

---

## [Specyfing behaviour VS specifying implementation](https://www.ruby-forum.com/t/specyfing-behaviour-vs-specifying-implementation/143113)

<div class="topic-metadata">

**Author:** [@qertoip](https://www.ruby-forum.com/u/qertoip)\
**Replies:** 1\
**Last updated:** [July 15, 2008, 2:45pm UTC](https://www.ruby-forum.com/t/specyfing-behaviour-vs-specifying-implementation/143113 "2008-07-15T14:45:12Z")

</div>

At first it seems obvious: one should specify behaviour, not implementation. However, there may be a tremendous overhead and duplication with such approach. Let’s assume: def a lot’s of business logic end deb b l…

---

## [Re: Getting RSpec 1.1.4+ to Work with Autotest (ZenTest 3.10.0) on Windows (Win32)](https://www.ruby-forum.com/t/re-getting-rspec-1-1-4-to-work-with-autotest-zentest-3-10-0-on-windows-win32/142961)

<div class="topic-metadata">

**Author:** [@charlesgreen](https://www.ruby-forum.com/u/charlesgreen)\
**Replies:** 4\
**Last updated:** [July 15, 2008, 2:43pm UTC](https://www.ruby-forum.com/t/re-getting-rspec-1-1-4-to-work-with-autotest-zentest-3-10-0-on-windows-win32/142961 "2008-07-15T14:43:26Z")

</div>

Hi, Thanks for the info, Luis. I am glad that they fixed the calling a batch file issue. I have had to handle this myself in several different situations. I do have one additional question. It sounds like your set…

---

## [Should\_receive - how to allow multiple calls](https://www.ruby-forum.com/t/should-receive-how-to-allow-multiple-calls/143105)

<div class="topic-metadata">

**Author:** [@qertoip](https://www.ruby-forum.com/u/qertoip)\
**Replies:** 1\
**Last updated:** [July 15, 2008, 2:00pm UTC](https://www.ruby-forum.com/t/should-receive-how-to-allow-multiple-calls/143105 "2008-07-15T14:00:04Z")

</div>

code: info( ‘attempting to sign in’ ) # I want to test it … info( ‘signed in’ ) # I don’t care about it spec: @scraper.should\_receive( :info ).with( ‘attempting to sign in’ ).at\_least( 1 ).times res…

---

## [Rspec - stubbing same class multiple times with different conditions](https://www.ruby-forum.com/t/rspec-stubbing-same-class-multiple-times-with-different-conditions/143074)

<div class="topic-metadata">

**Author:** [@tafkamk](https://www.ruby-forum.com/u/tafkamk)\
**Replies:** 0\
**Last updated:** [July 15, 2008, 12:05am UTC](https://www.ruby-forum.com/t/rspec-stubbing-same-class-multiple-times-with-different-conditions/143074 "2008-07-15T00:05:30Z")

</div>

Im having a hard time with a rspec controller test im writting, I need to stub! the User.find call twice once to return the owning user and once to return the viewing user. however when I attempt User.stub!(:find).w…

---

## [How to use more than ONE mock frmk (mocha, rr, rspec)](https://www.ruby-forum.com/t/how-to-use-more-than-one-mock-frmk-mocha-rr-rspec/143038)

<div class="topic-metadata">

**Author:** [@21croissants](https://www.ruby-forum.com/u/21croissants)\
**Replies:** 0\
**Last updated:** [July 14, 2008, 6:42pm UTC](https://www.ruby-forum.com/t/how-to-use-more-than-one-mock-frmk-mocha-rr-rspec/143038 "2008-07-14T18:42:29Z")

</div>

I have started to play with http://pivots.pivotallabs.com/users/brian/blog/articles/352-introducing-rr and I really like its hyper-minimalist but readable syntax … For the sake of flexibility, I’d like to use more tha…

---

## [Need help testing a module behavior with RSpec](https://www.ruby-forum.com/t/need-help-testing-a-module-behavior-with-rspec/143014)

<div class="topic-metadata">

**Author:** [@df-sean](https://www.ruby-forum.com/u/df-sean)\
**Replies:** 0\
**Last updated:** [July 14, 2008, 3:16pm UTC](https://www.ruby-forum.com/t/need-help-testing-a-module-behavior-with-rspec/143014 "2008-07-14T15:16:19Z")

</div>

I have a resource\_security.rb file that includes instance and class method definitions. At the end of the file I mix these into ActiveRecord::Base. ActiveRecord::Base.class\_eval { include ResourceSecurity::InstanceM…

---

## [Expecting arbitrary method calls in a particular order](https://www.ruby-forum.com/t/expecting-arbitrary-method-calls-in-a-particular-order/142925)

<div class="topic-metadata">

**Author:** [@Sven\_F](https://www.ruby-forum.com/u/Sven_F)\
**Replies:** 9\
**Last updated:** [July 13, 2008, 7:33pm UTC](https://www.ruby-forum.com/t/expecting-arbitrary-method-calls-in-a-particular-order/142925 "2008-07-13T19:33:06Z")

</div>

I’ve been wondering how to expect arbitrary methods being called in a particular order. The RSpec documentation for expecting method calls on mock objects mentions that it is possible to pass a block to #should\_receiv…

---

## [Rspec render :update](https://www.ruby-forum.com/t/rspec-render-update/142813)

<div class="topic-metadata">

**Author:** [@regealey](https://www.ruby-forum.com/u/regealey)\
**Replies:** 2\
**Last updated:** [July 13, 2008, 6:58am UTC](https://www.ruby-forum.com/t/rspec-render-update/142813 "2008-07-13T06:58:10Z")

</div>

Hi all, I’m having trouble with rspec 1.1.4 and rjs In the controller: render :update do |page| page \<\< ‘added text’ end render :update do |page| page.replace\_html :divid :partial =\> ‘apartial’ end spec: respon…

---

## [Executing multiple rspec scripts](https://www.ruby-forum.com/t/executing-multiple-rspec-scripts/142747)

<div class="topic-metadata">

**Author:** [@Robert\_Stagner](https://www.ruby-forum.com/u/Robert_Stagner)\
**Replies:** 5\
**Last updated:** [July 13, 2008, 2:36am UTC](https://www.ruby-forum.com/t/executing-multiple-rspec-scripts/142747 "2008-07-13T02:36:48Z")

</div>

I’m new to RSpec. I’ve just installed the gem and begun experimenting with developing several scripts. From what I’ve seen thus far, it looks like it will aid our QA team in testing many web applications. Is there …

---

## [Fwd: Getting RSpec 1.1.4+ to Work with Autotest (ZenTest 3.10.0) on Windows (Win32)](https://www.ruby-forum.com/t/fwd-getting-rspec-1-1-4-to-work-with-autotest-zentest-3-10-0-on-windows-win32/142837)

<div class="topic-metadata">

**Author:** [@marksbrain](https://www.ruby-forum.com/u/marksbrain)\
**Replies:** 1\
**Last updated:** [July 12, 2008, 12:15am UTC](https://www.ruby-forum.com/t/fwd-getting-rspec-1-1-4-to-work-with-autotest-zentest-3-10-0-on-windows-win32/142837 "2008-07-12T00:15:01Z")

</div>

Rspactor is a great alternative to autotest if you’re on a Mac. It uses the OS to tell it when files have changed, instead of continually scanning the project tree. That makes it faster and less of a burden on the sy…

---

## [Getting RSpec 1.1.4+ to Work with Autotest (ZenTest 3.10.0) on Windows (Win32)](https://www.ruby-forum.com/t/getting-rspec-1-1-4-to-work-with-autotest-zentest-3-10-0-on-windows-win32/142827)

<div class="topic-metadata">

**Author:** [@charlesgreen](https://www.ruby-forum.com/u/charlesgreen)\
**Replies:** 1\
**Last updated:** [July 11, 2008, 9:30pm UTC](https://www.ruby-forum.com/t/getting-rspec-1-1-4-to-work-with-autotest-zentest-3-10-0-on-windows-win32/142827 "2008-07-11T21:30:55Z")

</div>

Hi, After upgrading to Rails 2.1, RSpec 1.1.4+ and ZenTest 3.10.0, autotest would no longer find any of my specs on my Windows development machine. Some Googling directed me to a very recent update in the History.txt …

---

## [How to stub forever?](https://www.ruby-forum.com/t/how-to-stub-forever/142776)

<div class="topic-metadata">

**Author:** [@qertoip](https://www.ruby-forum.com/u/qertoip)\
**Replies:** 2\
**Last updated:** [July 11, 2008, 9:20pm UTC](https://www.ruby-forum.com/t/how-to-stub-forever/142776 "2008-07-11T21:20:59Z")

</div>

How to stub a method for multiple calls? The calls are done in a loop. I expect: @agent.stub!( :submit ).multiple\_times.and\_return( @account\_details\_page ) …to stub submit method “forever” (any number of calls).

---

## [Setting request.raw\_post with rspec-rails](https://www.ruby-forum.com/t/setting-request-raw-post-with-rspec-rails/142645)

<div class="topic-metadata">

**Author:** [@Francis\_H](https://www.ruby-forum.com/u/Francis_H)\
**Replies:** 2\
**Last updated:** [July 11, 2008, 4:45am UTC](https://www.ruby-forum.com/t/setting-request-raw-post-with-rspec-rails/142645 "2008-07-11T04:45:47Z")

</div>

… is there a way to do this? We have some REST-ish POSTs we’d like to spec out. In the controller this gets accessed with request.raw\_post.to\_s, is there a way to set this with rspec? Thanks as always, Francis

---

## [Whence "post" in a description?](https://www.ruby-forum.com/t/whence-post-in-a-description/131681)

<div class="topic-metadata">

**Author:** [@nzook](https://www.ruby-forum.com/u/nzook)\
**Replies:** 2\
**Last updated:** [July 11, 2008, 1:30am UTC](https://www.ruby-forum.com/t/whence-post-in-a-description/131681 "2008-07-11T01:30:17Z")

</div>

I’m having the exact problem described in this earlier post: http://www.nabble.com/Odd-response.body-behavior-to12837556.html#a12837556 That is, after a post, response.body is just the controller/view string (“user/lo…

---

## [Rake task to run stories?](https://www.ruby-forum.com/t/rake-task-to-run-stories/142728)

<div class="topic-metadata">

**Author:** [@wolfmanjm](https://www.ruby-forum.com/u/wolfmanjm)\
**Replies:** 1\
**Last updated:** [July 10, 2008, 10:44pm UTC](https://www.ruby-forum.com/t/rake-task-to-run-stories/142728 "2008-07-10T22:44:02Z")

</div>

Hi, Shouldn’t there be a rake task in rails to run the stories? and shouldn’t rake spec run the stories as well? Right now it seems I run all my specs via rake spec, but then have to run the stories by ruby stories/…

---

## [Baffled by error running rake rspec:models](https://www.ruby-forum.com/t/baffled-by-error-running-rake-rspec-models/142715)

<div class="topic-metadata">

**Author:** [@Lori\_M\_Olson](https://www.ruby-forum.com/u/Lori_M_Olson)\
**Replies:** 0\
**Last updated:** [July 10, 2008, 7:41pm UTC](https://www.ruby-forum.com/t/baffled-by-error-running-rake-rspec-models/142715 "2008-07-10T19:41:37Z")

</div>

In my application, we connect to 2 databases, so we make a lot of specs to test this type of interaction. When I run individual model specs using spec, or using rake spec SPEC=xxx, they run fine. When I run rake spec…

---

## [Persistence across steps in stories](https://www.ruby-forum.com/t/persistence-across-steps-in-stories/142705)

<div class="topic-metadata">

**Author:** [@Miguel\_Gomez](https://www.ruby-forum.com/u/Miguel_Gomez)\
**Replies:** 0\
**Last updated:** [July 10, 2008, 3:32pm UTC](https://www.ruby-forum.com/t/persistence-across-steps-in-stories/142705 "2008-07-10T15:32:41Z")

</div>

Hello. I have divided my story into several steps. I have a Given requirement in one file where I create (and save) an object. Afterwards, I have a When requirement in another “steps\_for” file, which i suppossed to u…

---

## [Can I get RSpec NOT to abort rake on failing specs?](https://www.ruby-forum.com/t/can-i-get-rspec-not-to-abort-rake-on-failing-specs/142647)

<div class="topic-metadata">

**Author:** [@rykkers](https://www.ruby-forum.com/u/rykkers)\
**Replies:** 2\
**Last updated:** [July 10, 2008, 2:48pm UTC](https://www.ruby-forum.com/t/can-i-get-rspec-not-to-abort-rake-on-failing-specs/142647 "2008-07-10T14:48:38Z")

</div>

At work we’ve got a rather complex app with both specs and tests. Our default rake task runs all our our tests and specs. We’ve also got separate rake tasks to run groups of tests and specs in the various subdirecto…

---

## [Re: is there a plain format output for stories?](https://www.ruby-forum.com/t/re-is-there-a-plain-format-output-for-stories/142605)

<div class="topic-metadata">

**Author:** [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Replies:** 1\
**Last updated:** [July 9, 2008, 9:56pm UTC](https://www.ruby-forum.com/t/re-is-there-a-plain-format-output-for-stories/142605 "2008-07-09T21:56:57Z")

</div>

I’ve created a very simple ‘basic’ formatter, than prints story scenarios as . / P / F for passing, pending and failing scenarios. You can get it here; http://github.com/digitalronin/rspec/tree/master Run it by appe…

---

## [Controller vars for examples](https://www.ruby-forum.com/t/controller-vars-for-examples/142627)

<div class="topic-metadata">

**Author:** [@weliwarmer](https://www.ruby-forum.com/u/weliwarmer)\
**Replies:** 2\
**Last updated:** [July 9, 2008, 9:49pm UTC](https://www.ruby-forum.com/t/controller-vars-for-examples/142627 "2008-07-09T21:49:54Z")

</div>

Hi, How do I override the value of a controller variable in a controller spec. For ex, if I have an action with an array, I want to have examples with different variables in the array def testing my\_array = \[1,2,4\] …

---

## [Why has the --color gone from my life?](https://www.ruby-forum.com/t/why-has-the-color-gone-from-my-life/139498)

<div class="topic-metadata">

**Author:** [@Mikel\_L](https://www.ruby-forum.com/u/Mikel_L)\
**Replies:** 8\
**Last updated:** [July 8, 2008, 10:33pm UTC](https://www.ruby-forum.com/t/why-has-the-color-gone-from-my-life/139498 "2008-07-08T22:33:04Z")

</div>

Hi all, Running on OSX 10.5.3, Latest Rspec trunk, Rspec rails trunk, latest autotest gem and rails 2.1 I’ve lost my colour output in autotest. rake spec gives colour output, but autotest gives me black and white. I…

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

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