# RSpec

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

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

---

## [Webrat bugs](https://www.ruby-forum.com/t/webrat-bugs/133923)

<div class="topic-metadata">

**Author:** [@joe-dumoulin](https://www.ruby-forum.com/u/joe-dumoulin)\
**Replies:** 2\
**Last updated:** [April 5, 2008, 7:04am UTC](https://www.ruby-forum.com/t/webrat-bugs/133923 "2008-04-05T07:04:21Z")

</div>

Where do I report webrat bugs? Seems that when there’s a parenthesis in the link text, doing: session.clicks\_link(“link with (parens)”) fails to find the link text.

---

## [Laziness plugin](https://www.ruby-forum.com/t/laziness-plugin/133932)

<div class="topic-metadata">

**Author:** [@combray](https://www.ruby-forum.com/u/combray)\
**Replies:** 1\
**Last updated:** [April 5, 2008, 6:53am UTC](https://www.ruby-forum.com/t/laziness-plugin/133932 "2008-04-05T06:53:50Z")

</div>

Just for general entertainment, apparently you can get Rails to write your unit tests now: “Laziness isn’t just helpful in development mode, though - it also comes into play in production. If you’ve installed the exc…

---

## [Changes to RSpec Bundle](https://www.ruby-forum.com/t/changes-to-rspec-bundle/133924)

<div class="topic-metadata">

**Author:** [@timhunter](https://www.ruby-forum.com/u/timhunter)\
**Replies:** 4\
**Last updated:** [April 5, 2008, 4:59am UTC](https://www.ruby-forum.com/t/changes-to-rspec-bundle/133924 "2008-04-05T04:59:20Z")

</div>

Hi, I forked the rspec bundle on github and added a new command to it (an Update RSpec Bundle command). I sent a pull request, but haven’t heard back from anyone on it. David, did you get my pull request? Or did it…

---

## [Attachment-fu + Story Runner](https://www.ruby-forum.com/t/attachment-fu-story-runner/122737)

<div class="topic-metadata">

**Author:** [@datorrey](https://www.ruby-forum.com/u/datorrey)\
**Replies:** 14\
**Last updated:** [April 5, 2008, 1:13am UTC](https://www.ruby-forum.com/t/attachment-fu-story-runner/122737 "2008-04-05T01:13:02Z")

</div>

Hi all, I’m trying to run a Story Runner integration test that uploads a file through Attachment-fu. I’ve tried various ways of specifying the file data, from custom mocks: class MockFile \< Struct.new (:original\_fil…

---

## [Spec'ing validates\_uniqueness\_of :whatever](https://www.ruby-forum.com/t/specing-validates-uniqueness-of-whatever/133650)

<div class="topic-metadata">

**Author:** [@jmcervera](https://www.ruby-forum.com/u/jmcervera)\
**Replies:** 9\
**Last updated:** [April 4, 2008, 1:39pm UTC](https://www.ruby-forum.com/t/specing-validates-uniqueness-of-whatever/133650 "2008-04-04T13:39:24Z")

</div>

Hello I am learning rspec and trying to especify the activerecord validations of my models. How would I make a require\_uniqueness\_of specification for a field. Can I make this with mocks, without touching the databas…

---

## [\[ANN\] rspec\_hpricot\_matchers 1.0: have\_tag on hpricot](https://www.ruby-forum.com/t/ann-rspec-hpricot-matchers-1-0-have-tag-on-hpricot/133022)

<div class="topic-metadata">

**Author:** [@kyleh](https://www.ruby-forum.com/u/kyleh)\
**Replies:** 15\
**Last updated:** [April 4, 2008, 6:23am UTC](https://www.ruby-forum.com/t/ann-rspec-hpricot-matchers-1-0-have-tag-on-hpricot/133022 "2008-04-04T06:23:43Z")

</div>

Hello everyone, A few weeks ago, I put together a little project that provides a have\_tag() matcher look-alike that can be used outside of Rails projects, backed by Hpricot, which I very creatively named rspec\_hprico…

---

## [Tags/categories for specs](https://www.ruby-forum.com/t/tags-categories-for-specs/133780)

<div class="topic-metadata">

**Author:** [@mroths](https://www.ruby-forum.com/u/mroths)\
**Replies:** 1\
**Last updated:** [April 3, 2008, 6:08pm UTC](https://www.ruby-forum.com/t/tags-categories-for-specs/133780 "2008-04-03T18:08:10Z")

</div>

Many thanks to David C. for answering my question about :type & :behaviour\_type hash key: http://groups.google.com/group/comp.lang.ruby/browse\_thread/thread/4b76e2c5a1a8918d It has made me curious to know whether tagg…

---

## [Anyone experienced RSpec/Autotest forgetting models?](https://www.ruby-forum.com/t/anyone-experienced-rspec-autotest-forgetting-models/133762)

<div class="topic-metadata">

**Author:** [@Ashley\_M](https://www.ruby-forum.com/u/Ashley_M)\
**Replies:** 1\
**Last updated:** [April 3, 2008, 2:57pm UTC](https://www.ruby-forum.com/t/anyone-experienced-rspec-autotest-forgetting-models/133762 "2008-04-03T14:57:13Z")

</div>

Hi Saving a controller spec frequently gives me this error: LoadError in ‘UsersController GET /users with basic request params should find all the user types’ Expected /home/amoran/Documents/becta/apps/Backend/…

---

## [Newb q: Can story steps report a view rendering error?](https://www.ruby-forum.com/t/newb-q-can-story-steps-report-a-view-rendering-error/133729)

<div class="topic-metadata">

**Author:** [@timhunter](https://www.ruby-forum.com/u/timhunter)\
**Replies:** 5\
**Last updated:** [April 3, 2008, 2:16pm UTC](https://www.ruby-forum.com/t/newb-q-can-story-steps-report-a-view-rendering-error/133729 "2008-04-03T14:16:29Z")

</div>

Hi’ya I have a When step that calls get game\_url. It turns out that calling this page is resulting in a render error, which explains my failing Then steps. It would help me if the story told me there was a problem …

---

## [Problem rendering template with story](https://www.ruby-forum.com/t/problem-rendering-template-with-story/133630)

<div class="topic-metadata">

**Author:** [@timhunter](https://www.ruby-forum.com/u/timhunter)\
**Replies:** 3\
**Last updated:** [April 3, 2008, 2:38am UTC](https://www.ruby-forum.com/t/problem-rendering-template-with-story/133630 "2008-04-03T02:38:31Z")

</div>

Hi y’all The problem is probably because I’m a newb. I have a home controller in the admin namespace. My controller spec is working as expected, and the following example is passing: it “should show the home page …

---

## [Given Logged In](https://www.ruby-forum.com/t/given-logged-in/133637)

<div class="topic-metadata">

**Author:** [@timhunter](https://www.ruby-forum.com/u/timhunter)\
**Replies:** 3\
**Last updated:** [April 2, 2008, 10:22pm UTC](https://www.ruby-forum.com/t/given-logged-in/133637 "2008-04-02T22:22:52Z")

</div>

Hi there, Given my recent problems with .should render\_template after a second post, I’m wondering if there’s a way I set the state as logged in inside a given step without posting to sessions/create? I can’t seem …

---

## [Stub an instance method for every new instance of a class](https://www.ruby-forum.com/t/stub-an-instance-method-for-every-new-instance-of-a-class/133498)

<div class="topic-metadata">

**Author:** [@meekish](https://www.ruby-forum.com/u/meekish)\
**Replies:** 8\
**Last updated:** [April 2, 2008, 4:29pm UTC](https://www.ruby-forum.com/t/stub-an-instance-method-for-every-new-instance-of-a-class/133498 "2008-04-02T16:29:46Z")

</div>

Is there an easy way to stub an instance method for every new instance of a given class? I suppose I could just redefine the method, but I’m wondering if the RSpec mocking framework has this built in.

---

## [Tabs in the TextMate Bundle](https://www.ruby-forum.com/t/tabs-in-the-textmate-bundle/133555)

<div class="topic-metadata">

**Author:** [@ole](https://www.ruby-forum.com/u/ole)\
**Replies:** 1\
**Last updated:** [April 1, 2008, 5:09pm UTC](https://www.ruby-forum.com/t/tabs-in-the-textmate-bundle/133555 "2008-04-01T17:09:28Z")

</div>

I tried to post this to the devel list but it never seemed to get through. So I’m posting it here in the hope that someone from the development team will notice: Hello, I noticed that you are using spaces in all the …

---

## [Spec'ing models](https://www.ruby-forum.com/t/specing-models/133493)

<div class="topic-metadata">

**Author:** [@timhunter](https://www.ruby-forum.com/u/timhunter)\
**Replies:** 5\
**Last updated:** [April 1, 2008, 2:44am UTC](https://www.ruby-forum.com/t/specing-models/133493 "2008-04-01T02:44:25Z")

</div>

Hi there, A couple of complete newb questions here. Should I be spec’ing the existence of attributes on models? While reading through the docs and googling I haven’t seen any example that checks if attributes exist…

---

## [Re: spec'ing models](https://www.ruby-forum.com/t/re-specing-models/133494)

<div class="topic-metadata">

**Author:** [@anthonybaker](https://www.ruby-forum.com/u/anthonybaker)\
**Replies:** 0\
**Last updated:** [April 1, 2008, 2:40am UTC](https://www.ruby-forum.com/t/re-specing-models/133494 "2008-04-01T02:40:54Z")

</div>

It looks like my first note didn’t go through … so I apologize if it is delayed and this is a duplicate. My colleagues and I have been testing associations like this … it “should have one account” do Profile.should\_…

---

## [Given .. and .. - And requires capitalisation](https://www.ruby-forum.com/t/given-and-and-requires-capitalisation/133480)

<div class="topic-metadata">

**Author:** [@timhunter](https://www.ruby-forum.com/u/timhunter)\
**Replies:** 5\
**Last updated:** [April 1, 2008, 2:02am UTC](https://www.ruby-forum.com/t/given-and-and-requires-capitalisation/133480 "2008-04-01T02:02:13Z")

</div>

Hi Guys, Just writing out a plain English story and was surprised to see one of my steps wasn’t listed as pending. It turned out it was because I had started the line with and instead of And. Is there any reason w…

---

## [Can you add simple argument-baesd logic to stubs?](https://www.ruby-forum.com/t/can-you-add-simple-argument-baesd-logic-to-stubs/133446)

<div class="topic-metadata">

**Author:** [@Ashley\_M](https://www.ruby-forum.com/u/Ashley_M)\
**Replies:** 0\
**Last updated:** [March 31, 2008, 6:26pm UTC](https://www.ruby-forum.com/t/can-you-add-simple-argument-baesd-logic-to-stubs/133446 "2008-03-31T18:26:56Z")

</div>

Hi Is there any way to do the following with stubs? template.should\_receive(:formatted\_last\_login). with(duck\_type(:last\_login\_date)). any\_number\_of\_times. and\_return { |user| "las…

---

## [Confusing error with GivenStory](https://www.ruby-forum.com/t/confusing-error-with-givenstory/133436)

<div class="topic-metadata">

**Author:** [@Glenn\_F](https://www.ruby-forum.com/u/Glenn_F)\
**Replies:** 2\
**Last updated:** [March 31, 2008, 5:57pm UTC](https://www.ruby-forum.com/t/confusing-error-with-givenstory/133436 "2008-03-31T17:57:13Z")

</div>

Hey all! I’m loving Stories so far, but I ran across a difficult error today that I felt should have resulted in a “PENDING” message. Here’s what I got: /Users/Malohkan/Sites/blog/vendor/plugins/rspec\_on\_rails/lib/sp…

---

## [Wrong story step running](https://www.ruby-forum.com/t/wrong-story-step-running/133200)

<div class="topic-metadata">

**Author:** [@Ashley\_M](https://www.ruby-forum.com/u/Ashley_M)\
**Replies:** 2\
**Last updated:** [March 31, 2008, 3:13pm UTC](https://www.ruby-forum.com/t/wrong-story-step-running/133200 "2008-03-31T15:13:17Z")

</div>

Hi I have three steps like this: Given ‘a user called “$name” of type $user\_type and status $user\_state in organisation “$organisation\_name”’ do |name, user\_type, user\_state, organisation\_name| $runs ||= 1 puts “M…

---

## [My argument constraints are not working](https://www.ruby-forum.com/t/my-argument-constraints-are-not-working/133318)

<div class="topic-metadata">

**Author:** [@david](https://www.ruby-forum.com/u/david)\
**Replies:** 7\
**Last updated:** [March 31, 2008, 5:38am UTC](https://www.ruby-forum.com/t/my-argument-constraints-are-not-working/133318 "2008-03-31T05:38:28Z")

</div>

describe “pretending to crawl craigslist.” do before do @html\_start = File.read( RAILS\_ROOT + “/spec/fixtures/feeds/ start\_page.html” ) @response\_start = mock\_model( Net::HTTP, :body =\> @html\_start, :nil? =\> false ) …

---

## [Parameterized shared specs: good or bad idea?](https://www.ruby-forum.com/t/parameterized-shared-specs-good-or-bad-idea/133291)

<div class="topic-metadata">

**Author:** [@Nick\_C](https://www.ruby-forum.com/u/Nick_C)\
**Replies:** 4\
**Last updated:** [March 30, 2008, 10:48pm UTC](https://www.ruby-forum.com/t/parameterized-shared-specs-good-or-bad-idea/133291 "2008-03-30T22:48:11Z")

</div>

Hi, I’ve come across a couple of cases recently in which I was wishing it was possible to parameterize shared specs. An example: I have defined a number of rails resources, and it seems wasteful to have tens of gener…

---

## [What is SpecServer?](https://www.ruby-forum.com/t/what-is-specserver/131776)

<div class="topic-metadata">

**Author:** [@Mikel\_L](https://www.ruby-forum.com/u/Mikel_L)\
**Replies:** 6\
**Last updated:** [March 30, 2008, 8:57am UTC](https://www.ruby-forum.com/t/what-is-specserver/131776 "2008-03-30T08:57:01Z")

</div>

I have looked through the docs, looked at the code, even gave a cursory (2 page) glance at google, and it is not clear to me what SpecServer is or what it is for. Is it meant to speed up the execution of specs in a ra…

---

## [Getting autotest to monitor changes in lib directory](https://www.ruby-forum.com/t/getting-autotest-to-monitor-changes-in-lib-directory/133237)

<div class="topic-metadata">

**Author:** [@joe-dumoulin](https://www.ruby-forum.com/u/joe-dumoulin)\
**Replies:** 1\
**Last updated:** [March 29, 2008, 1:23pm UTC](https://www.ruby-forum.com/t/getting-autotest-to-monitor-changes-in-lib-directory/133237 "2008-03-29T13:23:38Z")

</div>

Autotest monitors changes in app/models. How can I get autotest to monitor changes in lib? So that whenever something changes in lib or specs/lib, it runs the appropriate spec? Joe

---

## [Help Steven Baker get to Scotland on Rails](https://www.ruby-forum.com/t/help-steven-baker-get-to-scotland-on-rails/133180)

<div class="topic-metadata">

**Author:** [@crucoba](https://www.ruby-forum.com/u/crucoba)\
**Replies:** 1\
**Last updated:** [March 29, 2008, 5:21am UTC](https://www.ruby-forum.com/t/help-steven-baker-get-to-scotland-on-rails/133180 "2008-03-29T05:21:37Z")

</div>

Hi all, Warning - this is a request for money to help do something nice for someone. If this offends you in any way, please stop reading now and just delete this email. Steven B., the guy who actually wrote RSpec to …

---

## [How do you mock an object that you don't have access to?](https://www.ruby-forum.com/t/how-do-you-mock-an-object-that-you-dont-have-access-to/133209)

<div class="topic-metadata">

**Author:** [@david](https://www.ruby-forum.com/u/david)\
**Replies:** 5\
**Last updated:** [March 28, 2008, 8:24pm UTC](https://www.ruby-forum.com/t/how-do-you-mock-an-object-that-you-dont-have-access-to/133209 "2008-03-28T20:24:36Z")

</div>

Hi, How can I mock the “go” method of class B so that it returns the string “fudge” in this situation? class A private def start @b = B.new end end class B def go puts “This is fun.” end end Also, is it pos…

---

## [\[Q\] bug in mocks or user error?](https://www.ruby-forum.com/t/q-bug-in-mocks-or-user-error/133206)

<div class="topic-metadata">

**Author:** [@cremes](https://www.ruby-forum.com/u/cremes)\
**Replies:** 4\
**Last updated:** [March 28, 2008, 7:48pm UTC](https://www.ruby-forum.com/t/q-bug-in-mocks-or-user-error/133206 "2008-03-28T19:48:51Z")

</div>

I’m trying to use a mock to return a hash so that #each\_pair can process it. I can’t get it to work. Whatever I return to #each\_pair is ignored and the block never gets executed. Here’s an example illustrating the pro…

---

## [Why does nesting this spec fail?](https://www.ruby-forum.com/t/why-does-nesting-this-spec-fail/133094)

<div class="topic-metadata">

**Author:** [@Ashley\_M](https://www.ruby-forum.com/u/Ashley_M)\
**Replies:** 3\
**Last updated:** [March 27, 2008, 6:48pm UTC](https://www.ruby-forum.com/t/why-does-nesting-this-spec-fail/133094 "2008-03-27T18:48:49Z")

</div>

Hi, This fails: describe UsersController::QuickSearch do controller\_name “users” describe “created with search text” do before(:each) do @quick\_search = UsersController::QuickSearch.new(“quick\_search\[search\_text\]”…

---

## [Checking for response =\> head :ok in a story](https://www.ruby-forum.com/t/checking-for-response-head-ok-in-a-story/133068)

<div class="topic-metadata">

**Author:** [@bartz](https://www.ruby-forum.com/u/bartz)\
**Replies:** 3\
**Last updated:** [March 27, 2008, 1:59pm UTC](https://www.ruby-forum.com/t/checking-for-response-head-ok-in-a-story/133068 "2008-03-27T13:59:02Z")

</div>

Hey gang, I’m writing a story in which I update a model via XML. So far, so good. But, I want to test the outcome of the controller, namely the following code: format.xml { head :ok } How can I test this in a story…

---

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

<div class="topic-metadata">

**Author:** [@Eric\_Harris-Braun](https://www.ruby-forum.com/u/Eric_Harris-Braun)\
**Replies:** 1\
**Last updated:** [March 27, 2008, 10:28am UTC](https://www.ruby-forum.com/t/newbie-first-run-question/132932 "2008-03-27T10:28:09Z")

</div>

Hi folks, RSpec 1.1.3 is failing for me out of the box. I installed both rspec and rspec\_on\_rails using svn following the instructions on the site. Then I used the rspec generate script, created a very simple test e…

---

## [Story runner output](https://www.ruby-forum.com/t/story-runner-output/133015)

<div class="topic-metadata">

**Author:** [@joe-dumoulin](https://www.ruby-forum.com/u/joe-dumoulin)\
**Replies:** 2\
**Last updated:** [March 27, 2008, 12:46am UTC](https://www.ruby-forum.com/t/story-runner-output/133015 "2008-03-27T00:46:34Z")

</div>

Is it possible to optionally reduce the story runner output to just dots or something? Lots of stories makes it difficult to see previous test results. Joe

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

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