# RSpec

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

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

---

## [Newbie question](https://www.ruby-forum.com/t/newbie-question/122099)

<div class="topic-metadata">

**Author:** [@nctodc](https://www.ruby-forum.com/u/nctodc)\
**Replies:** 2\
**Last updated:** [December 4, 2007, 5:11pm UTC](https://www.ruby-forum.com/t/newbie-question/122099 "2007-12-04T17:11:15Z")

</div>

Good day all :slight\_smile: I am getting into RSpec and am a little confused by an aspect of mocks / mock\_models in controller tests. I’ve gone through the online docs and the PeepCode movies and have them slightly c…

---

## [Re: params not available for controller specs?](https://www.ruby-forum.com/t/re-params-not-available-for-controller-specs/122093)

<div class="topic-metadata">

**Author:** [@Al\_Chou](https://www.ruby-forum.com/u/Al_Chou)\
**Replies:** 1\
**Last updated:** [December 4, 2007, 4:40pm UTC](https://www.ruby-forum.com/t/re-params-not-available-for-controller-specs/122093 "2007-12-04T16:40:39Z")

</div>

Ah, thanks! That was a breakthrough. My mock object “ids\_string” isn’t receiving the method calls I expect (even though the code under test actually does what I want it to do and works correctly), but at least I’m p…

---

## [Re: params not available for controller specs?](https://www.ruby-forum.com/t/re-params-not-available-for-controller-specs/122071)

<div class="topic-metadata">

**Author:** [@Al\_Chou](https://www.ruby-forum.com/u/Al_Chou)\
**Replies:** 1\
**Last updated:** [December 4, 2007, 10:57am UTC](https://www.ruby-forum.com/t/re-params-not-available-for-controller-specs/122071 "2007-12-04T10:57:48Z")

</div>

I actually did stub Order.find() but was getting a nil object error because params\[:ids\] was nil. I can’t write controller.download :ids =\> ‘1/2/3’ in the controller spec, and get download, :ids =\> ids\_string resul…

---

## [Params not available for controller specs?](https://www.ruby-forum.com/t/params-not-available-for-controller-specs/122064)

<div class="topic-metadata">

**Author:** [@Al\_Chou](https://www.ruby-forum.com/u/Al_Chou)\
**Replies:** 1\
**Last updated:** [December 4, 2007, 9:39am UTC](https://www.ruby-forum.com/t/params-not-available-for-controller-specs/122064 "2007-12-04T09:39:51Z")

</div>

Hi, all, I’m trying to write a spec for a controller method that starts out: def download @orders = Order.find( params\[:ids\] ) … and started writing a spec that set params\[:ids\] to a mock. I was surprised to disco…

---

## [Spec'ing shared controller methods](https://www.ruby-forum.com/t/specing-shared-controller-methods/122050)

<div class="topic-metadata">

**Author:** [@johanatan](https://www.ruby-forum.com/u/johanatan)\
**Replies:** 1\
**Last updated:** [December 4, 2007, 7:14am UTC](https://www.ruby-forum.com/t/specing-shared-controller-methods/122050 "2007-12-04T07:14:43Z")

</div>

I want to isolate and spec methods that are shared by controllers, and live in application.rb. Whereas I usually also provide examples in individual controllers that use these methods, not necessarily all the edge cas…

---

## [Spec for model\_id should eql](https://www.ruby-forum.com/t/spec-for-model-id-should-eql/121997)

<div class="topic-metadata">

**Author:** [@cienfuegos](https://www.ruby-forum.com/u/cienfuegos)\
**Replies:** 5\
**Last updated:** [December 3, 2007, 9:43pm UTC](https://www.ruby-forum.com/t/spec-for-model-id-should-eql/121997 "2007-12-03T21:43:50Z")

</div>

Hello, I’m confused why the spec described below is failing. Other simple comparison specs are passing fine for the same model. The code is working accordingly when I test it through the console, I’m just having dif…

---

## [Stylistic preferences](https://www.ruby-forum.com/t/stylistic-preferences/121620)

<div class="topic-metadata">

**Author:** [@datorrey](https://www.ruby-forum.com/u/datorrey)\
**Replies:** 3\
**Last updated:** [December 3, 2007, 4:33pm UTC](https://www.ruby-forum.com/t/stylistic-preferences/121620 "2007-12-03T16:33:38Z")

</div>

What are people’s opinions on which of these two styles is better to use? before module UserSpecHelper include GenericSpecHelper def valid\_sms\_attributes(phone\_number=“12345”) { :phone\_number =\> phone\_number } e…

---

## [Need help mocking this out](https://www.ruby-forum.com/t/need-help-mocking-this-out/121953)

<div class="topic-metadata">

**Author:** [@FischerS\_Daniel](https://www.ruby-forum.com/u/FischerS_Daniel)\
**Replies:** 0\
**Last updated:** [December 3, 2007, 10:59am UTC](https://www.ruby-forum.com/t/need-help-mocking-this-out/121953 "2007-12-03T10:59:44Z")

</div>

Let’s say you’re using the restful\_authentication plugin. You have a model called articles. On the index action of the articlescontroller you simply want to spec out that it’ll scope the results to the ownership of t…

---

## [Specifying an HTTP status code](https://www.ruby-forum.com/t/specifying-an-http-status-code/121847)

<div class="topic-metadata">

**Author:** [@Francis\_H](https://www.ruby-forum.com/u/Francis_H)\
**Replies:** 5\
**Last updated:** [December 2, 2007, 2:17pm UTC](https://www.ruby-forum.com/t/specifying-an-http-status-code/121847 "2007-12-02T14:17:15Z")

</div>

Hi all, I’m just starting to work w/ RSpec, so I hope this question isn’t too obvious or missing the point somehow: Is there a way in RSpec to specify that a controller action should use a specific HTTP status code? …

---

## [Mock feed](https://www.ruby-forum.com/t/mock-feed/121834)

<div class="topic-metadata">

**Author:** [@cienfuegos](https://www.ruby-forum.com/u/cienfuegos)\
**Replies:** 0\
**Last updated:** [December 1, 2007, 5:44pm UTC](https://www.ruby-forum.com/t/mock-feed/121834 "2007-12-01T17:44:09Z")

</div>

Hello generous coders, I’m having difficulty getting a couple of tests to pass. I have an address model which takes an address and with a callback on save and update passes the address to google’s geocoding service.…

---

## [Autotest'ing specs on non-rails app](https://www.ruby-forum.com/t/autotesting-specs-on-non-rails-app/121758)

<div class="topic-metadata">

**Author:** [@rykkers](https://www.ruby-forum.com/u/rykkers)\
**Replies:** 4\
**Last updated:** [November 30, 2007, 7:41pm UTC](https://www.ruby-forum.com/t/autotesting-specs-on-non-rails-app/121758 "2007-11-30T19:41:22Z")

</div>

I’m having trouble using autotest with rspec on a non-rails project. my Rspec gem is version 1.0.8, ZenTest is 3.6.2 project structure $ ls \* lib: parser.rb spec: parser\_spec.rb autotest finds and runs the spec, …

---

## [Rendering a view and passing a variable](https://www.ruby-forum.com/t/rendering-a-view-and-passing-a-variable/121705)

<div class="topic-metadata">

**Author:** [@reivilo](https://www.ruby-forum.com/u/reivilo)\
**Replies:** 4\
**Last updated:** [November 30, 2007, 3:44am UTC](https://www.ruby-forum.com/t/rendering-a-view-and-passing-a-variable/121705 "2007-11-30T03:44:24Z")

</div>

Hello all, I have a view which display html based on the value of a variable. Here’s the code : \<% if @language == ‘e’ %\> \<%= link\_to “Français”, :action =\> :index, :id =\> “f” %\> \<% end %\> In my test, I’m trying to…

---

## [\[ANN\] Webrat 0.1.0 released - Ruby Acceptance Testing for Web applications](https://www.ruby-forum.com/t/ann-webrat-0-1-0-released-ruby-acceptance-testing-for-web-applications/121666)

<div class="topic-metadata">

**Author:** [@bryan123](https://www.ruby-forum.com/u/bryan123)\
**Replies:** 5\
**Last updated:** [November 29, 2007, 10:14pm UTC](https://www.ruby-forum.com/t/ann-webrat-0-1-0-released-ruby-acceptance-testing-for-web-applications/121666 "2007-11-29T22:14:28Z")

</div>

Hey guys, We developed this plugin while writing my first real set of RSpec stories. It’s still missing a lot of functionality, but it’s useful to us as is, so I’m shipping 0.1.0. (Patches welcome. :slight\_smile: ) C…

---

## [Rollbacks, Sqlite3 bug. Has this been reintroduced?](https://www.ruby-forum.com/t/rollbacks-sqlite3-bug-has-this-been-reintroduced/121654)

<div class="topic-metadata">

**Author:** [@sinclair\_bain](https://www.ruby-forum.com/u/sinclair_bain)\
**Replies:** 4\
**Last updated:** [November 29, 2007, 6:49pm UTC](https://www.ruby-forum.com/t/rollbacks-sqlite3-bug-has-this-been-reintroduced/121654 "2007-11-29T18:49:04Z")

</div>

Hey, I just updated from the edge and it looks like this issue has resurfaced. Yesterday things were working (stories and specs). No code base changes, only rspec and rspec\_on\_rails After updating today I now need …

---

## [Textmate bundle](https://www.ruby-forum.com/t/textmate-bundle/121516)

<div class="topic-metadata">

**Author:** [@zdennis](https://www.ruby-forum.com/u/zdennis)\
**Replies:** 6\
**Last updated:** [November 29, 2007, 4:03pm UTC](https://www.ruby-forum.com/t/textmate-bundle/121516 "2007-11-29T16:03:15Z")

</div>

Does anyone else have issues running rspec textmate bundle? I’ve got revision 2997, but the blasted thing just won’t run. It is checked out to my /Users/zdennis/Library/Application Support/TextMate/Bundles/RSpec.tmbun…

---

## [Possible Problem with RSpec and](https://www.ruby-forum.com/t/possible-problem-with-rspec-and/121189)

<div class="topic-metadata">

**Author:** [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Replies:** 15\
**Last updated:** [November 29, 2007, 11:25am UTC](https://www.ruby-forum.com/t/possible-problem-with-rspec-and/121189 "2007-11-29T11:25:15Z")

</div>

Sorry to be such a pest but I am trying to learn Ruby, Rails and RSpec all at one go and it is a bit overwhelming. I have previously completed the depot tutorial in the Agile Web Dev with rails book and now I am tryi…

---

## [Testing cookies](https://www.ruby-forum.com/t/testing-cookies/121559)

<div class="topic-metadata">

**Author:** [@reivilo](https://www.ruby-forum.com/u/reivilo)\
**Replies:** 2\
**Last updated:** [November 28, 2007, 10:52pm UTC](https://www.ruby-forum.com/t/testing-cookies/121559 "2007-11-28T22:52:39Z")

</div>

Hello, Here’s a test I wrote for cookies: it “should change language when params\[:id\] is present” do cookies\[:thothle\_language\] = ‘e’ get ‘index’, :id =\> ‘f’ response.cookies\[“thothle\_language”\].should equal(‘f’) e…

---

## [Broken edge](https://www.ruby-forum.com/t/broken-edge/121505)

<div class="topic-metadata">

**Author:** [@datorrey](https://www.ruby-forum.com/u/datorrey)\
**Replies:** 6\
**Last updated:** [November 28, 2007, 5:41pm UTC](https://www.ruby-forum.com/t/broken-edge/121505 "2007-11-28T17:41:00Z")

</div>

Hi all, Not sure if I’m the only one with this problem… We’re on edge for both rails and rspec, and i just did an update… Some apparently innocuous rails stuff was updated, and then half my specs broke due to an erro…

---

## [Newbie question](https://www.ruby-forum.com/t/newbie-question/121445)

<div class="topic-metadata">

**Author:** [@pitosalas](https://www.ruby-forum.com/u/pitosalas)\
**Replies:** 3\
**Last updated:** [November 28, 2007, 3:07am UTC](https://www.ruby-forum.com/t/newbie-question/121445 "2007-11-28T03:07:06Z")

</div>

I installed Rspec and am getting the following failure: $ sudo gem install rspec Successfully installed rspec-1.0.8 Installing ri documentation for rspec-1.0.8… Installing RDoc documentation for rspec-1.0.8… $ spec …

---

## [Expectations on Class Methods](https://www.ruby-forum.com/t/expectations-on-class-methods/121422)

<div class="topic-metadata">

**Author:** [@cwd](https://www.ruby-forum.com/u/cwd)\
**Replies:** 2\
**Last updated:** [November 27, 2007, 9:38pm UTC](https://www.ruby-forum.com/t/expectations-on-class-methods/121422 "2007-11-27T21:38:36Z")

</div>

Sorry about the non-specific subject. Here’s what I’m trying to do. I have a method: DataMapper::Database.setup That I want to create an expectation on. I wrote: DataMapper::Database.should\_receive(:setup).once.and\_r…

---

## [Custom matcher tutorial](https://www.ruby-forum.com/t/custom-matcher-tutorial/121337)

<div class="topic-metadata">

**Author:** [@bryan](https://www.ruby-forum.com/u/bryan)\
**Replies:** 0\
**Last updated:** [November 27, 2007, 12:36am UTC](https://www.ruby-forum.com/t/custom-matcher-tutorial/121337 "2007-11-27T00:36:07Z")

</div>

I wrote some quick notes up on a custom matcher I wrote around a pattern that I am using constantly. http://smartic.us/2007/11/26/rspec-matcher-for-active-record-associations You could use it as a custom matcher tutor…

---

## [Renaming RailsExample to RailsExampleGroup](https://www.ruby-forum.com/t/renaming-railsexample-to-railsexamplegroup/121245)

<div class="topic-metadata">

**Author:** [@bct](https://www.ruby-forum.com/u/bct)\
**Replies:** 8\
**Last updated:** [November 26, 2007, 9:37pm UTC](https://www.ruby-forum.com/t/renaming-railsexample-to-railsexamplegroup/121245 "2007-11-26T21:37:22Z")

</div>

Fyi, I made the following renames: RailsExample -\> RailsExampleGroup FunctionalExample -\> FunctionalExampleGroup ControllerExample -\> ControllerExampleGroup ViewExample -\> ViewExampleGroup HelperExample -\> HelperExampl…

---

## [Setting fail\_on\_error](https://www.ruby-forum.com/t/setting-fail-on-error/121310)

<div class="topic-metadata">

**Author:** [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Replies:** 0\
**Last updated:** [November 26, 2007, 6:57pm UTC](https://www.ruby-forum.com/t/setting-fail-on-error/121310 "2007-11-26T18:57:49Z")

</div>

For the default setup of RSpec is there a way to set the fail\_on\_error instance variable to false from outside of spectask.rb? I am not familiar enough with either ruby or rails to figure this out from the informatio…

---

## [rSpec (rev 2996), Rails (rev 8214): TextMate bundle problems](https://www.ruby-forum.com/t/rspec-rev-2996-rails-rev-8214-textmate-bundle-problems/121269)

<div class="topic-metadata">

**Author:** [@bradumbaugh](https://www.ruby-forum.com/u/bradumbaugh)\
**Replies:** 0\
**Last updated:** [November 26, 2007, 10:52am UTC](https://www.ruby-forum.com/t/rspec-rev-2996-rails-rev-8214-textmate-bundle-problems/121269 "2007-11-26T10:52:19Z")

</div>

Hey guys, I’m trying to get rSpec (rev 2996) working with Rails 2 (rev 8214). Running the tests from the command line works, no problem. I installed the RSpec.tmbundle (also rev 2996), and would like to see the HTML …

---

## ['it' duplicate example: BUG](https://www.ruby-forum.com/t/it-duplicate-example-bug/120914)

<div class="topic-metadata">

**Author:** [@sthorpe](https://www.ruby-forum.com/u/sthorpe)\
**Replies:** 9\
**Last updated:** [November 25, 2007, 7:55pm UTC](https://www.ruby-forum.com/t/it-duplicate-example-bug/120914 "2007-11-25T19:55:50Z")

</div>

I svn up’ed this morning, to get the following message with rake spec: /Users/smt/src/web/urbis/trunk/vendor/plugins/rspec/lib/spec/example/ example\_group\_methods.rb:96:in \`it’: Duplicate example: ‘should contain the …

---

## [Rails sessions in plain text stories](https://www.ruby-forum.com/t/rails-sessions-in-plain-text-stories/121230)

<div class="topic-metadata">

**Author:** [@datorrey](https://www.ruby-forum.com/u/datorrey)\
**Replies:** 2\
**Last updated:** [November 25, 2007, 7:22pm UTC](https://www.ruby-forum.com/t/rails-sessions-in-plain-text-stories/121230 "2007-11-25T19:22:59Z")

</div>

Ok, maybe I’m being particularly thick, but I’ve been trying to find the solution to this for a couple of hours now and I just can’t seem to be able to do it… I’m trying to write a step as such: Given(“user $email is…

---

## [Rspec.opts](https://www.ruby-forum.com/t/rspec-opts/121184)

<div class="topic-metadata">

**Author:** [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Replies:** 5\
**Last updated:** [November 25, 2007, 2:34am UTC](https://www.ruby-forum.com/t/rspec-opts/121184 "2007-11-25T02:34:53Z")

</div>

Where can I find a list of the options and their usage and meanings for the contents of this file? Regards, – \*\*\* E-Mail is NOT a SECURE channel \*\*\* James B. Byrne mailto:removed\_ema…

---

## [Initial run of RSpec 1.0.8 on MS-WinXPproSP2](https://www.ruby-forum.com/t/initial-run-of-rspec-1-0-8-on-ms-winxpprosp2/121027)

<div class="topic-metadata">

**Author:** [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Replies:** 8\
**Last updated:** [November 24, 2007, 10:45pm UTC](https://www.ruby-forum.com/t/initial-run-of-rspec-1-0-8-on-ms-winxpprosp2/121027 "2007-11-24T22:45:04Z")

</div>

ENV Rails 1.2.5 Ruby 1.8.6 Rake 0.7.3 RSpec 1.0.8 PostgreSQL 8.2.5 MicroSoft Windows XP pro SP2 I am experiencing a problem with the “rake spec spec\\models” task on an initialtrial of rspec. After creating the r…

---

## [Textmate Bundle Errors](https://www.ruby-forum.com/t/textmate-bundle-errors/121098)

<div class="topic-metadata">

**Author:** [@reynar](https://www.ruby-forum.com/u/reynar)\
**Replies:** 1\
**Last updated:** [November 23, 2007, 5:56pm UTC](https://www.ruby-forum.com/t/textmate-bundle-errors/121098 "2007-11-23T17:56:20Z")

</div>

Hi, Running #rake spec seems to work as expected, however using cmd+r in textmate does not. I assume Textmate has some specific references to rails or ruby which I have not set. I have set the TM\_RUBY to /usr/local/b…

---

## [Creation of spec.opts spec\_helper etc](https://www.ruby-forum.com/t/creation-of-spec-opts-spec-helper-etc/121047)

<div class="topic-metadata">

**Author:** [@chrisolsen](https://www.ruby-forum.com/u/chrisolsen)\
**Replies:** 3\
**Last updated:** [November 23, 2007, 7:31am UTC](https://www.ruby-forum.com/t/creation-of-spec-opts-spec-helper-etc/121047 "2007-11-23T07:31:27Z")

</div>

When do these files, along with lib/spec and lib/spec\_server get created? I tried to create a quick test project and can’t remember how they were created in a previous project. Thanks

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

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