# RSpec

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

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

---

## [Running rspec on 1.2.3?](https://www.ruby-forum.com/t/running-rspec-on-1-2-3/138225)

<div class="topic-metadata">

**Author:** [@ldk2005](https://www.ruby-forum.com/u/ldk2005)\
**Replies:** 1\
**Last updated:** [May 21, 2008, 3:40pm UTC](https://www.ruby-forum.com/t/running-rspec-on-1-2-3/138225 "2008-05-21T15:40:11Z")

</div>

Hi, Anyone know how to run rspec on 1.2.3? It fails out of the box… I newly downloaded rspec, rspec\_on\_rails and ran the command ruby script/generate rspec ==\>\>\> Does this script work right? from the instruction…

---

## [How to write a test for validates\_uniqueness\_of](https://www.ruby-forum.com/t/how-to-write-a-test-for-validates-uniqueness-of/138203)

<div class="topic-metadata">

**Author:** [@T\_K](https://www.ruby-forum.com/u/T_K)\
**Replies:** 5\
**Last updated:** [May 21, 2008, 2:29am UTC](https://www.ruby-forum.com/t/how-to-write-a-test-for-validates-uniqueness-of/138203 "2008-05-21T02:29:59Z")

</div>

Hi, I have a spec it "should have a unique username " I have a code: validates\_uniqueness\_of :user\_name Now, I don’t know how to test this code. In order to test this, do I need to run save? For example, @user = …

---

## [Mock\_model not stubbing model attribtues in view spec](https://www.ruby-forum.com/t/mock-model-not-stubbing-model-attribtues-in-view-spec/138123)

<div class="topic-metadata">

**Author:** [@biot023](https://www.ruby-forum.com/u/biot023)\
**Replies:** 4\
**Last updated:** [May 20, 2008, 1:36pm UTC](https://www.ruby-forum.com/t/mock-model-not-stubbing-model-attribtues-in-view-spec/138123 "2008-05-20T13:36:13Z")

</div>

Hi – I am just getting to grips w/ view specs, and am having an issue with mock\_model not stubbing the mocked model’s attributes. For instance, I have the following: before do @input\_timesheet = mock\_model( InputTim…

---

## [Re: rspec fails at first run -- no such file to load -- spec/rails](https://www.ruby-forum.com/t/re-rspec-fails-at-first-run-no-such-file-to-load-spec-rails/138086)

<div class="topic-metadata">

**Author:** [@ldk2005](https://www.ruby-forum.com/u/ldk2005)\
**Replies:** 0\
**Last updated:** [May 20, 2008, 3:44am UTC](https://www.ruby-forum.com/t/re-rspec-fails-at-first-run-no-such-file-to-load-spec-rails/138086 "2008-05-20T03:44:39Z")

</div>

Re: What version of rails are you using? Rails 1.2.3 (I’m using an intermediate version of Hobo which is not ready for 2.0) Regards, Larry

---

## [Rspec fails at first run -- no such file to load -- spec/rails](https://www.ruby-forum.com/t/rspec-fails-at-first-run-no-such-file-to-load-spec-rails/138082)

<div class="topic-metadata">

**Author:** [@ldk2005](https://www.ruby-forum.com/u/ldk2005)\
**Replies:** 1\
**Last updated:** [May 20, 2008, 2:11am UTC](https://www.ruby-forum.com/t/rspec-fails-at-first-run-no-such-file-to-load-spec-rails/138082 "2008-05-20T02:11:36Z")

</div>

Hi, I newly downloaded rspec, rspec\_on\_rails and ran the command ruby script/generate rspec from the instructions http://rspec.info/documentation/rails/install.html I then created the directories in spec: controlle…

---

## [Using Hash to mock classes that respond to :\[\]](https://www.ruby-forum.com/t/using-hash-to-mock-classes-that-respond-to/137923)

<div class="topic-metadata">

**Author:** [@Ashley\_M](https://www.ruby-forum.com/u/Ashley_M)\
**Replies:** 2\
**Last updated:** [May 19, 2008, 11:03pm UTC](https://www.ruby-forum.com/t/using-hash-to-mock-classes-that-respond-to/137923 "2008-05-19T23:03:27Z")

</div>

Hi I’ve been doing this a while now. If I have a class that responds to : \[\], and all I’m interested in stubbing is that method, then instead of using a mock I just create a hash. (Similarly, you could create an ar…

---

## [Sharing: dont\_repeat\_yourself plugin custom RSpec matcher](https://www.ruby-forum.com/t/sharing-dont-repeat-yourself-plugin-custom-rspec-matcher/136198)

<div class="topic-metadata">

**Author:** [@21croissants](https://www.ruby-forum.com/u/21croissants)\
**Replies:** 5\
**Last updated:** [May 19, 2008, 9:53pm UTC](https://www.ruby-forum.com/t/sharing-dont-repeat-yourself-plugin-custom-rspec-matcher/136198 "2008-05-19T21:53:14Z")

</div>

I wrote a Rails plugin which uses simian to look for duplicates lines in your code and reports in html format, Textmate or Netbeans. I wrote it using RSpec and I have included a RSpec custom matcher: it { rails\_appli…

---

## [Spec a before\_destroy callback in Sequel](https://www.ruby-forum.com/t/spec-a-before-destroy-callback-in-sequel/137951)

<div class="topic-metadata">

**Author:** [@Ashley\_M](https://www.ruby-forum.com/u/Ashley_M)\
**Replies:** 0\
**Last updated:** [May 18, 2008, 8:48pm UTC](https://www.ruby-forum.com/t/spec-a-before-destroy-callback-in-sequel/137951 "2008-05-18T20:48:32Z")

</div>

Hi I’m struggling to find a neat way to spec this. The Sequel ORM doesn’t support automatically destroying dependent models. It’s easy enough to do in a callback though: class Changeset \< Sequel::Model has\_many :m…

---

## [Help needed](https://www.ruby-forum.com/t/help-needed/137891)

<div class="topic-metadata">

**Author:** [@Jens\_Carroll](https://www.ruby-forum.com/u/Jens_Carroll)\
**Replies:** 5\
**Last updated:** [May 18, 2008, 8:24pm UTC](https://www.ruby-forum.com/t/help-needed/137891 "2008-05-18T20:24:26Z")

</div>

Hi All, I am new to rspec and it seems that I don’t understand some basics. I need to have a XML import which should parse through XML data and saves all that in various mysql tables. The XML part works just fine and…

---

## [Test log](https://www.ruby-forum.com/t/test-log/137870)

<div class="topic-metadata">

**Author:** [@johanatan](https://www.ruby-forum.com/u/johanatan)\
**Replies:** 1\
**Last updated:** [May 17, 2008, 7:09am UTC](https://www.ruby-forum.com/t/test-log/137870 "2008-05-17T07:09:18Z")

</div>

Is there an easy way to inject each example text into test.log so I can isolate the log output per example?

---

## [Which rspec for rails 2.1RC1?](https://www.ruby-forum.com/t/which-rspec-for-rails-2-1rc1/137826)

<div class="topic-metadata">

**Author:** [@rykkers](https://www.ruby-forum.com/u/rykkers)\
**Replies:** 3\
**Last updated:** [May 17, 2008, 3:29am UTC](https://www.ruby-forum.com/t/which-rspec-for-rails-2-1rc1/137826 "2008-05-17T03:29:31Z")

</div>

I’m working on porting our app. Do I need to upgrade rspec from 1.1.3? If so which version. BTW the installation doc at http://rspec.info/documentation/rails/install.html seems to be stuck in the pre-git days. – Ri…

---

## [Description method and test failures](https://www.ruby-forum.com/t/description-method-and-test-failures/137570)

<div class="topic-metadata">

**Author:** [@EAW](https://www.ruby-forum.com/u/EAW)\
**Replies:** 3\
**Last updated:** [May 15, 2008, 12:28am UTC](https://www.ruby-forum.com/t/description-method-and-test-failures/137570 "2008-05-15T00:28:08Z")

</div>

Hi all, Hoping you can help. I have a project using rspec 1.1.3 and rails 2.0.2. I’ve run into a small problem. Said project has a method in application\_helper.rb named “description”. Whenever a spec test fails, …

---

## [Reuse steps like a method call](https://www.ruby-forum.com/t/reuse-steps-like-a-method-call/137622)

<div class="topic-metadata">

**Author:** [@bryan123](https://www.ruby-forum.com/u/bryan123)\
**Replies:** 4\
**Last updated:** [May 14, 2008, 10:19pm UTC](https://www.ruby-forum.com/t/reuse-steps-like-a-method-call/137622 "2008-05-14T22:19:34Z")

</div>

If I have a step matcher defined as so: Given “a user named $username” do |username| … end Is there a way to call it from another step? For example: Given "a user named $username with a blog post |username| given\_a…

---

## [Testing that named\_scope is defined](https://www.ruby-forum.com/t/testing-that-named-scope-is-defined/137533)

<div class="topic-metadata">

**Author:** [@helder](https://www.ruby-forum.com/u/helder)\
**Replies:** 6\
**Last updated:** [May 14, 2008, 8:33pm UTC](https://www.ruby-forum.com/t/testing-that-named-scope-is-defined/137533 "2008-05-14T20:33:26Z")

</div>

Hi guys, I’m just beginning to use RSpec and I ran into the issue of testing a named\_scope. I’m not actually trying to test its behavior, as it’s not my code, but I wanted to test at least that it’s defined. I tried …

---

## [User stories for load testing?](https://www.ruby-forum.com/t/user-stories-for-load-testing/137539)

<div class="topic-metadata">

**Author:** [@Rick\_Lee-Morlang](https://www.ruby-forum.com/u/Rick_Lee-Morlang)\
**Replies:** 1\
**Last updated:** [May 14, 2008, 7:43pm UTC](https://www.ruby-forum.com/t/user-stories-for-load-testing/137539 "2008-05-14T19:43:10Z")

</div>

Hi all, We’ve recently been kicking around different ideas for simulating user behaviour for the purposes of load testing our backend. We hit on the idea of having user stories do double duty for both verifying behavi…

---

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

<div class="topic-metadata">

**Author:** [@stevedogers](https://www.ruby-forum.com/u/stevedogers)\
**Replies:** 3\
**Last updated:** [May 14, 2008, 2:41am UTC](https://www.ruby-forum.com/t/rake-spec-rcov-failing/136344 "2008-05-14T02:41:06Z")

</div>

Trying to run the ‘spec:rcov’ task and failing with error below. I saw a post from last year with a different REXML error but it was a FixNum issue. Any help appreciated. S OS X Ruby 1.8.6 Rails 2.02 RSpec-1.1.3…

---

## [Rspec 1.1.3 +ZenTest 3.9.1= rspec tests not found](https://www.ruby-forum.com/t/rspec-1-1-3-zentest-3-9-1-rspec-tests-not-found/128575)

<div class="topic-metadata">

**Author:** [@itsterry](https://www.ruby-forum.com/u/itsterry)\
**Replies:** 1\
**Last updated:** [May 13, 2008, 7:26pm UTC](https://www.ruby-forum.com/t/rspec-1-1-3-zentest-3-9-1-rspec-tests-not-found/128575 "2008-05-13T19:26:15Z")

</div>

Hi there Have upgraded to Rspec 1.1.3 and ZenTest 3.9.1 and have --force re-installed rspec plugin in the relevant place, but am getting the following when I run rake spec:autotest spec --diff unified test/test\_helpe…

---

## [Problems running RSpec from w/in TextMate](https://www.ruby-forum.com/t/problems-running-rspec-from-w-in-textmate/137246)

<div class="topic-metadata">

**Author:** [@wemagor](https://www.ruby-forum.com/u/wemagor)\
**Replies:** 4\
**Last updated:** [May 13, 2008, 2:52am UTC](https://www.ruby-forum.com/t/problems-running-rspec-from-w-in-textmate/137246 "2008-05-13T02:52:18Z")

</div>

Hello everyone, I’m new to RSpec, and pretty much Ruby in general. I am trying to run RSpec from within TextMate to get the nice-looking GUI that lists my specs and whatnot. It runs fine from the command line, but w…

---

## [Are you writing "imperative" or "declarative" scenarios in your stories?](https://www.ruby-forum.com/t/are-you-writing-imperative-or-declarative-scenarios-in-your-stories/137316)

<div class="topic-metadata">

**Author:** [@glenatron](https://www.ruby-forum.com/u/glenatron)\
**Replies:** 5\
**Last updated:** [May 13, 2008, 1:11am UTC](https://www.ruby-forum.com/t/are-you-writing-imperative-or-declarative-scenarios-in-your-stories/137316 "2008-05-13T01:11:06Z")

</div>

Hey all, I just found Bryan H.'s (of webrat fame) slides on a presentation he did at GoRuCo 2008: http://www.brynary.com/2008/4/26/story-driven-development-slides-posted On slides 21-24 he talks about writing good s…

---

## [Newbie: lambda do...end.should change(Model, :count).by(1). Doesn't 	work](https://www.ruby-forum.com/t/newbie-lambda-do-end-should-change-model-count-by-1-doesnt-work/137237)

<div class="topic-metadata">

**Author:** [@carminem](https://www.ruby-forum.com/u/carminem)\
**Replies:** 4\
**Last updated:** [May 11, 2008, 5:17pm UTC](https://www.ruby-forum.com/t/newbie-lambda-do-end-should-change-model-count-by-1-doesnt-work/137237 "2008-05-11T17:17:22Z")

</div>

Hi to everyone, I’m an RSpec, and BDD in general, newbie so in order to learn I have chosen to use my personal website as a tesbed. I’m having difficulties juggling with mocks, and in particula with the following cod…

---

## [Rspec version to use with git](https://www.ruby-forum.com/t/rspec-version-to-use-with-git/137151)

<div class="topic-metadata">

**Author:** [@Mark\_HSWilkinson](https://www.ruby-forum.com/u/Mark_HSWilkinson)\
**Replies:** 3\
**Last updated:** [May 10, 2008, 2:55pm UTC](https://www.ruby-forum.com/t/rspec-version-to-use-with-git/137151 "2008-05-10T14:55:14Z")

</div>

I want to start using RSpec in an existing project that uses git for SCM, and I was planning on using git submodules to pull in known-stable releases of the rspec and rspec\_on\_rails plugins. The current repositories o…

---

## [Rspec Stories / Selenium Nightmare](https://www.ruby-forum.com/t/rspec-stories-selenium-nightmare/137038)

<div class="topic-metadata">

**Author:** [@joesniff](https://www.ruby-forum.com/u/joesniff)\
**Replies:** 7\
**Last updated:** [May 10, 2008, 5:46am UTC](https://www.ruby-forum.com/t/rspec-stories-selenium-nightmare/137038 "2008-05-10T05:46:08Z")

</div>

I have been using Rspec stories with Webrat feeling very productive and happy. Then I needed to do something with Selenium (Webrat could have done what I needed but it does not yet have the functionality). Selenium-c…

---

## [Testing render :text without has\_text](https://www.ruby-forum.com/t/testing-render-text-without-has-text/137112)

<div class="topic-metadata">

**Author:** [@marksbrain](https://www.ruby-forum.com/u/marksbrain)\
**Replies:** 2\
**Last updated:** [May 9, 2008, 1:43am UTC](https://www.ruby-forum.com/t/testing-render-text-without-has-text/137112 "2008-05-09T01:43:52Z")

</div>

A controller I’m trying to test simply delivers a text string to the client, which then demarshalls it to retrieve some objects. I want to test that the returned string is correct. I don’t want to compare the string c…

---

## [Fixtures not clearing tables?](https://www.ruby-forum.com/t/fixtures-not-clearing-tables/137090)

<div class="topic-metadata">

**Author:** [@stevedogers](https://www.ruby-forum.com/u/stevedogers)\
**Replies:** 0\
**Last updated:** [May 8, 2008, 10:14pm UTC](https://www.ruby-forum.com/t/fixtures-not-clearing-tables/137090 "2008-05-08T22:14:51Z")

</div>

I have a case where I’m loading fixtures and a row added to a table in a spec is around at the start of all subsequent specs. When I set config.use\_transactional\_fixtures = false the fixtures load/clear as expected. …

---

## [Hiding the passes](https://www.ruby-forum.com/t/hiding-the-passes/136996)

<div class="topic-metadata">

**Author:** [@ole](https://www.ruby-forum.com/u/ole)\
**Replies:** 4\
**Last updated:** [May 8, 2008, 8:40pm UTC](https://www.ruby-forum.com/t/hiding-the-passes/136996 "2008-05-08T20:40:51Z")

</div>

How do you hide all the green passing examples from the output? I don’t need to know what has passed and it means I have to scroll to see what has failed.

---

## [Can you use RSpec to test initializers?](https://www.ruby-forum.com/t/can-you-use-rspec-to-test-initializers/136857)

<div class="topic-metadata">

**Author:** [@erik](https://www.ruby-forum.com/u/erik)\
**Replies:** 2\
**Last updated:** [May 7, 2008, 5:11pm UTC](https://www.ruby-forum.com/t/can-you-use-rspec-to-test-initializers/136857 "2008-05-07T17:11:32Z")

</div>

Hi there! I’m trying to spec out some code that will set the smtp\_settings in a custom ActiveMailer object. Basically I want to check that if my configuration object has the right smtp\_server, that the ActiveMailer …

---

## ["Plugin not found" after RSpec install](https://www.ruby-forum.com/t/plugin-not-found-after-rspec-install/136758)

<div class="topic-metadata">

**Author:** [@eeby](https://www.ruby-forum.com/u/eeby)\
**Replies:** 2\
**Last updated:** [May 6, 2008, 11:47pm UTC](https://www.ruby-forum.com/t/plugin-not-found-after-rspec-install/136758 "2008-05-06T23:47:01Z")

</div>

I tried to install the RSpec Rails plugin as described here: http://rspec.info/documentation/rails/install.html After I run this… ruby script/plugin install http://rspec.rubyforge.org/svn/tags/CURRENT/rspec At the v…

---

## ["Plugin not found" after RSpec install](https://www.ruby-forum.com/t/plugin-not-found-after-rspec-install/196667)

<div class="topic-metadata">

**Author:** [@eeby](https://www.ruby-forum.com/u/eeby)\
**Replies:** 3\
**Last updated:** [May 6, 2008, 6:50pm UTC](https://www.ruby-forum.com/t/plugin-not-found-after-rspec-install/196667 "2008-05-06T18:50:21Z")

</div>

I tried to install the RSpec Rails plugin as described here: http://rspec.info/documentation/rails/install.html After I run this… ruby script/plugin install http://rspec.rubyforge.org/svn/tags/CURRENT/rspec At the v…

---

## [Another noob question about stubs](https://www.ruby-forum.com/t/another-noob-question-about-stubs/136187)

<div class="topic-metadata">

**Author:** [@patcito](https://www.ruby-forum.com/u/patcito)\
**Replies:** 5\
**Last updated:** [May 6, 2008, 7:13am UTC](https://www.ruby-forum.com/t/another-noob-question-about-stubs/136187 "2008-05-06T07:13:04Z")

</div>

I have this function in my controller: def open\_id\_authentication(openid\_url) authenticate\_with\_open\_id(openid\_url, :required =\> \[:nickname, :email\], :optional =\> \[:fullname\]) do |result, identity\_url, registration| …

---

## [Specifying output of render call](https://www.ruby-forum.com/t/specifying-output-of-render-call/136746)

<div class="topic-metadata">

**Author:** [@Matt\_McNeil](https://www.ruby-forum.com/u/Matt_McNeil)\
**Replies:** 1\
**Last updated:** [May 6, 2008, 4:48am UTC](https://www.ruby-forum.com/t/specifying-output-of-render-call/136746 "2008-05-06T04:48:36Z")

</div>

Hello again, First of all, thanks much for everyone’s input on my question last week about spec’ing an invocation of super. Here’s another question that seems resistant to my Google searching: With this helper method…

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

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