# RSpec

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

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

---

## [Feeding the framework?](https://www.ruby-forum.com/t/feeding-the-framework/117623)

<div class="topic-metadata">

**Author:** [@Keith\_McDonnell](https://www.ruby-forum.com/u/Keith_McDonnell)\
**Replies:** 4\
**Last updated:** [October 19, 2007, 1:42pm UTC](https://www.ruby-forum.com/t/feeding-the-framework/117623 "2007-10-19T13:42:38Z")

</div>

Hi there, Is it just me or do many other rspec / rpsec\_on\_rails users spend more time than they would like feeding the framework ? Don’t get me wrong, I love rpsec, but I seem to spend about 2/3 hours per week huntin…

---

## [Mocking models provided in Rails plugins](https://www.ruby-forum.com/t/mocking-models-provided-in-rails-plugins/117690)

<div class="topic-metadata">

**Author:** [@Keith\_McDonnell](https://www.ruby-forum.com/u/Keith_McDonnell)\
**Replies:** 0\
**Last updated:** [October 19, 2007, 12:42pm UTC](https://www.ruby-forum.com/t/mocking-models-provided-in-rails-plugins/117690 "2007-10-19T12:42:08Z")

</div>

Hi Dan, You might find these links helpful when spec’ing restful auth http://www.vaporbase.com/postings/Rspec\_1.0\_and\_Restful\_Authentication http://jonathan.tron.name/articles/2007/01/02/rspec-on-rails-restful-authent…

---

## [Mocking models provided in Rails plugins](https://www.ruby-forum.com/t/mocking-models-provided-in-rails-plugins/117661)

<div class="topic-metadata">

**Author:** [@thechak](https://www.ruby-forum.com/u/thechak)\
**Replies:** 3\
**Last updated:** [October 19, 2007, 9:21am UTC](https://www.ruby-forum.com/t/mocking-models-provided-in-rails-plugins/117661 "2007-10-19T09:21:59Z")

</div>

Hey folks, How do I mock a model that is given to me by a Rails plugin? I’m trying to mock Session from the restful\_authentication plugin but I get a number of errors telling me RSpec doesn’t recognize Session. NameE…

---

## [Strange mock\_model behaviour with ActiveResource model](https://www.ruby-forum.com/t/strange-mock-model-behaviour-with-activeresource-model/117092)

<div class="topic-metadata">

**Author:** [@sjames](https://www.ruby-forum.com/u/sjames)\
**Replies:** 3\
**Last updated:** [October 19, 2007, 5:43am UTC](https://www.ruby-forum.com/t/strange-mock-model-behaviour-with-activeresource-model/117092 "2007-10-19T05:43:22Z")

</div>

Hi, I have two models in an app that inherit from ActiveResource::Base. The scaffold controller tests for one of the models works fine, but the other one dies when calling mock\_model in the “handling GET /fa\_codes” s…

---

## [Rake spec:models failing](https://www.ruby-forum.com/t/rake-spec-models-failing/117671)

<div class="topic-metadata">

**Author:** [@Keith\_McDonnell](https://www.ruby-forum.com/u/Keith_McDonnell)\
**Replies:** 0\
**Last updated:** [October 19, 2007, 5:42am UTC](https://www.ruby-forum.com/t/rake-spec-models-failing/117671 "2007-10-19T05:42:46Z")

</div>

Hi there, I’m having trouble with rake spec:models. It’s failing on: 1 old rspec/rails project all new rspec/rails projects But, it is working fine on my other (older) rspec/rails projects. All projects are on rspec…

---

## [Any tips on teaching BDD with RSpec?](https://www.ruby-forum.com/t/any-tips-on-teaching-bdd-with-rspec/117528)

<div class="topic-metadata">

**Author:** [@Ashley\_M](https://www.ruby-forum.com/u/Ashley_M)\
**Replies:** 15\
**Last updated:** [October 19, 2007, 1:39am UTC](https://www.ruby-forum.com/t/any-tips-on-teaching-bdd-with-rspec/117528 "2007-10-19T01:39:29Z")

</div>

Hi I hope this is not OT. I’m training my replacement at work to do BDD Rails development. He’s done a CS/maths degree but has no professional programming experience, so he’s never NOT done a project without BDD. …

---

## [RSPec and rails 2.0 plan](https://www.ruby-forum.com/t/rspec-and-rails-2-0-plan/117603)

<div class="topic-metadata">

**Author:** [@Cyril\_Ucron\_D](https://www.ruby-forum.com/u/Cyril_Ucron_D)\
**Replies:** 1\
**Last updated:** [October 18, 2007, 3:26pm UTC](https://www.ruby-forum.com/t/rspec-and-rails-2-0-plan/117603 "2007-10-18T15:26:56Z")

</div>

Hello all, I’m just wondering what the overall game plan is here. Right now when I use rails 2.0 pre release with rspec trunk, I run into a LOT of problems (lot is not an understatement here). Some are solved by remo…

---

## [Re: plain text stories: motivation number 27](https://www.ruby-forum.com/t/re-plain-text-stories-motivation-number-27/117594)

<div class="topic-metadata">

**Author:** [@PSSSSdraic\_Brady](https://www.ruby-forum.com/u/PSSSSdraic_Brady)\
**Replies:** 0\
**Last updated:** [October 18, 2007, 11:51am UTC](https://www.ruby-forum.com/t/re-plain-text-stories-motivation-number-27/117594 "2007-10-18T11:51:58Z")

</div>

What Marcus said ++ :wink: I don’t think it’s a crazy idea, but having workflow both ways would be so much more useful. Paddy PÃ¡draic Brady http://blog.astrumfutura.com OpenID Europe Foundation ----- Original Me…

---

## [Plain text stories: motivation number 27](https://www.ruby-forum.com/t/plain-text-stories-motivation-number-27/117507)

<div class="topic-metadata">

**Author:** [@crucoba](https://www.ruby-forum.com/u/crucoba)\
**Replies:** 8\
**Last updated:** [October 18, 2007, 11:12am UTC](https://www.ruby-forum.com/t/plain-text-stories-motivation-number-27/117507 "2007-10-18T11:12:11Z")

</div>

This is mostly theoretical, but … I’m starting to use lighthouse (http://llighthouseapp.com) for my projects at work. I’m organizing iterations as milestones and stories as tickets tagged to a milestone. Lighthouse o…

---

## [Rspec causing validates\_presence\_of to validate twice?](https://www.ruby-forum.com/t/rspec-causing-validates-presence-of-to-validate-twice/117541)

<div class="topic-metadata">

**Author:** [@steve](https://www.ruby-forum.com/u/steve)\
**Replies:** 16\
**Last updated:** [October 18, 2007, 6:51am UTC](https://www.ruby-forum.com/t/rspec-causing-validates-presence-of-to-validate-twice/117541 "2007-10-18T06:51:59Z")

</div>

I had posted this on the regular Rails list, but upon trying this in script/console, it seems like the behavior only exists when running rspec. I’m getting some weird behavior in one of my models. I have a model defi…

---

## [Example for attr\_accessible?](https://www.ruby-forum.com/t/example-for-attr-accessible/117343)

<div class="topic-metadata">

**Author:** [@steve](https://www.ruby-forum.com/u/steve)\
**Replies:** 12\
**Last updated:** [October 18, 2007, 4:44am UTC](https://www.ruby-forum.com/t/example-for-attr-accessible/117343 "2007-10-18T04:44:04Z")

</div>

Is anyone out there writing specs to check attr\_accessible fields? I had originally written my spec to check for allowing the desired fields, and then none of the other regular db fields. Unfortunately this isn’t sati…

---

## [Scenarios Plugin Pre-Announcement](https://www.ruby-forum.com/t/scenarios-plugin-pre-announcement/117560)

<div class="topic-metadata">

**Author:** [@johnlester](https://www.ruby-forum.com/u/johnlester)\
**Replies:** 0\
**Last updated:** [October 18, 2007, 3:02am UTC](https://www.ruby-forum.com/t/scenarios-plugin-pre-announcement/117560 "2007-10-18T03:02:21Z")

</div>

On 10/17/07, Scott T. removed\_email\_address@domain.invalid wrote: I haven’t had the chance to really play with your plugin. How is it different than fixture scenarios (from err.the.blog)? I haven’t actually used er…

---

## [Blog on TDD from acceptance/functional testing](https://www.ruby-forum.com/t/blog-on-tdd-from-acceptance-functional-testing/117519)

<div class="topic-metadata">

**Author:** [@Huang\_Liang](https://www.ruby-forum.com/u/Huang_Liang)\
**Replies:** 0\
**Last updated:** [October 17, 2007, 5:35pm UTC](https://www.ruby-forum.com/t/blog-on-tdd-from-acceptance-functional-testing/117519 "2007-10-17T17:35:39Z")

</div>

Here is a blog about TDD. http://hl.thoughtworkers.org/?p=7 It talks about starting TDD from writing functional/acceptance tests according to acceptance criteria of stories, then drilling down to the unit tests.

---

## [Helpful blog on Acceptance Testing/Unit Testing](https://www.ruby-forum.com/t/helpful-blog-on-acceptance-testing-unit-testing/117510)

<div class="topic-metadata">

**Author:** [@crucoba](https://www.ruby-forum.com/u/crucoba)\
**Replies:** 0\
**Last updated:** [October 17, 2007, 5:09pm UTC](https://www.ruby-forum.com/t/helpful-blog-on-acceptance-testing-unit-testing/117510 "2007-10-17T17:09:54Z")

</div>

Hey all, While I object to the name “testing”, Uncle Bob’s recent blog on Acceptance Testing/Unit Testing might prove interesting for those of you grappling with the meaning of Story Runner (which fits in the Accepta…

---

## [RailsStory runner - empty response](https://www.ruby-forum.com/t/railsstory-runner-empty-response/117402)

<div class="topic-metadata">

**Author:** [@Alvin\_S](https://www.ruby-forum.com/u/Alvin_S)\
**Replies:** 6\
**Last updated:** [October 17, 2007, 1:16pm UTC](https://www.ruby-forum.com/t/railsstory-runner-empty-response/117402 "2007-10-17T13:16:03Z")

</div>

I generated a new rails app then installed rspec and rspec\_on\_rails from trunk. I then created a sample story: require File.dirname(FILE) + “/helper” Story “View Home Page”, %{ As a user I want to view my home page …

---

## [Step matchers](https://www.ruby-forum.com/t/step-matchers/117217)

<div class="topic-metadata">

**Author:** [@pergesu](https://www.ruby-forum.com/u/pergesu)\
**Replies:** 40\
**Last updated:** [October 17, 2007, 9:04am UTC](https://www.ruby-forum.com/t/step-matchers/117217 "2007-10-17T09:04:13Z")

</div>

I think we all know that the readability of steps isn’t great right now, and in fact there’s a very recent thread that discusses just that. It was that recent thread that prompted me to explore this a bit. The basic…

---

## [Should\_receive](https://www.ruby-forum.com/t/should-receive/117460)

<div class="topic-metadata">

**Author:** [@steve](https://www.ruby-forum.com/u/steve)\
**Replies:** 0\
**Last updated:** [October 17, 2007, 7:10am UTC](https://www.ruby-forum.com/t/should-receive/117460 "2007-10-17T07:10:48Z")

</div>

Is there any way to setup a should\_receive so that it returns whatever it was passed in from the actual code? I just want to make sure that a specific function is called, I don’t want to mess around with the paramete…

---

## [RailsStory - lessons learned](https://www.ruby-forum.com/t/railsstory-lessons-learned/117445)

<div class="topic-metadata">

**Author:** [@Alvin\_S](https://www.ruby-forum.com/u/Alvin_S)\
**Replies:** 5\
**Last updated:** [October 17, 2007, 12:57am UTC](https://www.ruby-forum.com/t/railsstory-lessons-learned/117445 "2007-10-17T00:57:30Z")

</div>

After trying RailsStory for a few days, I have learned: Rails testing support does not serve up static pages RailsStory masks errors generated by the app under test The masked errors are available in log/test …

---

## [(no subject)](https://www.ruby-forum.com/t/no-subject/116668)

<div class="topic-metadata">

**Author:** [@sthorpe](https://www.ruby-forum.com/u/sthorpe)\
**Replies:** 17\
**Last updated:** [October 16, 2007, 11:29pm UTC](https://www.ruby-forum.com/t/no-subject/116668 "2007-10-16T23:29:15Z")

</div>

Just ran svn up this morning, and got this (after running ./script/ generate rspec) escher: ./script/spec spec/models/item\_spec.rb Finished in 8.0e-06 seconds 0 examples, 0 failures ./script/spec:4:in \`run’: wrong n…

---

## [Spec dirs not in path?](https://www.ruby-forum.com/t/spec-dirs-not-in-path/117434)

<div class="topic-metadata">

**Author:** [@steve](https://www.ruby-forum.com/u/steve)\
**Replies:** 2\
**Last updated:** [October 16, 2007, 9:23pm UTC](https://www.ruby-forum.com/t/spec-dirs-not-in-path/117434 "2007-10-16T21:23:26Z")

</div>

I’m just curious if there’s a reason why rspec doesn’t add the various spec dirs to $: so that “requires” can be done without specifying the full path name. Thanks, Steve

---

## [Top Quoting?](https://www.ruby-forum.com/t/top-quoting/117301)

<div class="topic-metadata">

**Author:** [@cwd](https://www.ruby-forum.com/u/cwd)\
**Replies:** 14\
**Last updated:** [October 16, 2007, 7:23pm UTC](https://www.ruby-forum.com/t/top-quoting/117301 "2007-10-16T19:23:25Z")

</div>

Sort of off-topic and don’t mean to complain, but many on this list use top quoting. That works ok if you don’t quote the whole previous thread. However, I’m finding that scrolling forever to locate the reply on longe…

---

## [Does a mock model have to satisfy contraints](https://www.ruby-forum.com/t/does-a-mock-model-have-to-satisfy-contraints/117421)

<div class="topic-metadata">

**Author:** [@chrisolsen](https://www.ruby-forum.com/u/chrisolsen)\
**Replies:** 2\
**Last updated:** [October 16, 2007, 7:08pm UTC](https://www.ruby-forum.com/t/does-a-mock-model-have-to-satisfy-contraints/117421 "2007-10-16T19:08:27Z")

</div>

I am a little confused to the what happens with the following: before do @site = mock\_model(Site, :to\_param =\> “1”) Site.stub!(:new).and\_return(@site) end def post\_with\_successful\_save @site.should\_receive(:save).a…

---

## [Controller iterating through returned records and appending to each](https://www.ruby-forum.com/t/controller-iterating-through-returned-records-and-appending-to-each/117403)

<div class="topic-metadata">

**Author:** [@dmarkow](https://www.ruby-forum.com/u/dmarkow)\
**Replies:** 3\
**Last updated:** [October 16, 2007, 6:14pm UTC](https://www.ruby-forum.com/t/controller-iterating-through-returned-records-and-appending-to-each/117403 "2007-10-16T18:14:54Z")

</div>

I have a controller that gets a list of employees (which has an “include =\> \[:salaries, :incentives, :billablegoals, :reviews\]”). I then need it to iterate through each employee and determine their current active goal …

---

## [New screencast on rspec](https://www.ruby-forum.com/t/new-screencast-on-rspec/117390)

<div class="topic-metadata">

**Author:** [@bryan](https://www.ruby-forum.com/u/bryan)\
**Replies:** 0\
**Last updated:** [October 16, 2007, 3:45pm UTC](https://www.ruby-forum.com/t/new-screencast-on-rspec/117390 "2007-10-16T15:45:29Z")

</div>

http://tinyurl.com/2bolrs I’m working on a series of screencasts on RSpec and BDD. This first iteration is on the real basics.

---

## [Stories location](https://www.ruby-forum.com/t/stories-location/117244)

<div class="topic-metadata">

**Author:** [@steve](https://www.ruby-forum.com/u/steve)\
**Replies:** 4\
**Last updated:** [October 16, 2007, 9:24am UTC](https://www.ruby-forum.com/t/stories-location/117244 "2007-10-16T09:24:50Z")

</div>

Should the stories dir be located on the project root? I was expecting to find it located under spec/ but there isn’t anything there, just the stories dir off of /. Also there don’t appear to be any rake tasks for st…

---

## [Named routes in controller not working?](https://www.ruby-forum.com/t/named-routes-in-controller-not-working/117354)

<div class="topic-metadata">

**Author:** [@steve](https://www.ruby-forum.com/u/steve)\
**Replies:** 2\
**Last updated:** [October 16, 2007, 9:09am UTC](https://www.ruby-forum.com/t/named-routes-in-controller-not-working/117354 "2007-10-16T09:09:02Z")

</div>

I have some "redirect\_to"s using named routes in a controller that work fine in the browser, but choke my tests. The route in question is “new\_session” and comes from a “map.resource :session, :controller =\> :session”…

---

## [Stub ActionController::Base#params](https://www.ruby-forum.com/t/stub-actioncontroller-base-params/117353)

<div class="topic-metadata">

**Author:** [@meekish](https://www.ruby-forum.com/u/meekish)\
**Replies:** 1\
**Last updated:** [October 16, 2007, 8:35am UTC](https://www.ruby-forum.com/t/stub-actioncontroller-base-params/117353 "2007-10-16T08:35:06Z")

</div>

Has anyone had any success stubbing ActionController::Base#params? The following is not intercepting calls to params\[:foo\] in my controllers: ActionController::Base.stub!(:params).and\_return(:foo =\> ‘bar’)

---

## [Failure trying to test ApplicationController](https://www.ruby-forum.com/t/failure-trying-to-test-applicationcontroller/117349)

<div class="topic-metadata">

**Author:** [@steve](https://www.ruby-forum.com/u/steve)\
**Replies:** 6\
**Last updated:** [October 16, 2007, 8:04am UTC](https://www.ruby-forum.com/t/failure-trying-to-test-applicationcontroller/117349 "2007-10-16T08:04:44Z")

</div>

I’m trying to write some tests for the ApplicationController as shared tests that can be run in all of my other controller tests, but am getting a nil.rewrite error. Below is what I have… describe AccountController d…

---

## [Generate script\_controller not creating test code](https://www.ruby-forum.com/t/generate-script-controller-not-creating-test-code/117344)

<div class="topic-metadata">

**Author:** [@chrisolsen](https://www.ruby-forum.com/u/chrisolsen)\
**Replies:** 3\
**Last updated:** [October 16, 2007, 5:08am UTC](https://www.ruby-forum.com/t/generate-script-controller-not-creating-test-code/117344 "2007-10-16T05:08:12Z")

</div>

For some reason when I ran it this time it decided not to create any view or controller tests. I had already created the corresponding model with the rpsec\_model script before trying to create the controller. I am n…

---

## [Story Runner: Two 'then' steps output as 'then..and' :)](https://www.ruby-forum.com/t/story-runner-two-then-steps-output-as-then-and/117251)

<div class="topic-metadata">

**Author:** [@andywatts](https://www.ruby-forum.com/u/andywatts)\
**Replies:** 2\
**Last updated:** [October 16, 2007, 3:51am UTC](https://www.ruby-forum.com/t/story-runner-two-then-steps-output-as-then-and/117251 "2007-10-16T03:51:40Z")

</div>

Maybe I’m slow, but I just noticed that the following code… When ‘I login’ When ‘I do something else’ …will output as… When ‘I login’ And ‘I do something else’ The same is true for two ‘Then’ steps That is really …

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

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