# RSpec

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

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

---

## [How to spec a around\_filter](https://www.ruby-forum.com/t/how-to-spec-a-around-filter/163882)

<div class="topic-metadata">

**Author:** [@alex](https://www.ruby-forum.com/u/alex)\
**Replies:** 3\
**Last updated:** [March 26, 2009, 9:04pm UTC](https://www.ruby-forum.com/t/how-to-spec-a-around-filter/163882 "2009-03-26T21:04:00Z")

</div>

Hi all, any of you guys had success specking out a around\_filter? I tried a few things like controller.should\_receive (:around\_filter\_method), controller.stub!(:around\_filter\_method) but without success. In fact, the …

---

## [\[ANN\] assert2-0.4.6 provides assert\_xhtml, an alternative to assert\_select](https://www.ruby-forum.com/t/ann-assert2-0-4-6-provides-assert-xhtml-an-alternative-to-assert-select/163957)

<div class="topic-metadata">

**Author:** [@Phlip](https://www.ruby-forum.com/u/Phlip)\
**Replies:** 0\
**Last updated:** [March 26, 2009, 1:56pm UTC](https://www.ruby-forum.com/t/ann-assert2-0-4-6-provides-assert-xhtml-an-alternative-to-assert-select/163957 "2009-03-26T13:56:59Z")

</div>

Rubyists: Consider the following monstrosity, coded using assert\_select: assert\_select “div#logo\_box img\[src=/0000/0001/logo.gif\]\[alt=My Company\]” Now, behold it rewritten to use assert\_xhtml: assert\_xhtml do div.l…

---

## [Re: what's the different between ( \[@weather\]) and (@weather)?](https://www.ruby-forum.com/t/re-whats-the-different-between-weather-and-weather/163932)

<div class="topic-metadata">

**Author:** [@codinggurl](https://www.ruby-forum.com/u/codinggurl)\
**Replies:** 0\
**Last updated:** [March 26, 2009, 8:46am UTC](https://www.ruby-forum.com/t/re-whats-the-different-between-weather-and-weather/163932 "2009-03-26T08:46:38Z")

</div>

Hi, Weather.find(1) returns an object: @weather Weather.find(:all) returns an array of objects : \[@weather\] look at the api of ActiveRecordBase. \[ActiveRecord::Base\] You have not specified a parameter for the find …

---

## [What's the different between (\[@weather\]) and (@weather)?](https://www.ruby-forum.com/t/whats-the-different-between-weather-and-weather/163926)

<div class="topic-metadata">

**Author:** [@rubyernewbie](https://www.ruby-forum.com/u/rubyernewbie)\
**Replies:** 0\
**Last updated:** [March 26, 2009, 7:23am UTC](https://www.ruby-forum.com/t/whats-the-different-between-weather-and-weather/163926 "2009-03-26T07:23:55Z")

</div>

before do @weather = mock\_model(Weather) Weather.stub!(:find).and\_return(\[@weather\]) end I saw this code on peepcode, but I’m a little confused the and\_return(\[@weather\]). mostly, we just and\_return(@weather), don’…

---

## [Cucumber and matcher](https://www.ruby-forum.com/t/cucumber-and-matcher/163904)

<div class="topic-metadata">

**Author:** [@epirsch](https://www.ruby-forum.com/u/epirsch)\
**Replies:** 3\
**Last updated:** [March 26, 2009, 5:28am UTC](https://www.ruby-forum.com/t/cucumber-and-matcher/163904 "2009-03-26T05:28:24Z")

</div>

Hi, Is there way to generate a better error messages when I have a matcher in my step like 1.should == 0 =\> would fail with expected 1, got 0 I would like to add more details to that error? Especially , in my case…

---

## [Spec::Rails, "model.should have(1).error\_on(:attribute)" passes when?](https://www.ruby-forum.com/t/spec-rails-model-should-have-1-error-on-attribute-passes-when/163692)

<div class="topic-metadata">

**Author:** [@bornboulder](https://www.ruby-forum.com/u/bornboulder)\
**Replies:** 3\
**Last updated:** [March 25, 2009, 9:33pm UTC](https://www.ruby-forum.com/t/spec-rails-model-should-have-1-error-on-attribute-passes-when/163692 "2009-03-25T21:33:29Z")

</div>

Spec::Rails people, I’m curious about: model.should have(1).error\_on(:attribute) displayed in the URL below: http://rspec.rubyforge.org/rspec-rails/1.2.2/classes/Spec/Rails/Extensions/ActiveRecord/InstanceMethods.ht…

---

## [Spec for view with Searchlogic](https://www.ruby-forum.com/t/spec-for-view-with-searchlogic/163858)

<div class="topic-metadata">

**Author:** [@codinggurl](https://www.ruby-forum.com/u/codinggurl)\
**Replies:** 0\
**Last updated:** [March 25, 2009, 3:50pm UTC](https://www.ruby-forum.com/t/spec-for-view-with-searchlogic/163858 "2009-03-25T15:50:19Z")

</div>

Hi, I’m using the Searchlogic plugin. Since I have added the search form in the index template, the view spec doesn’t work anymore. Controller def index @search = PlPlanning.new\_search(params\[:search\]) @search.ord…

---

## [Stricter routing specs with conditional routes](https://www.ruby-forum.com/t/stricter-routing-specs-with-conditional-routes/163793)

<div class="topic-metadata">

**Author:** [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Replies:** 0\
**Last updated:** [March 24, 2009, 11:14pm UTC](https://www.ruby-forum.com/t/stricter-routing-specs-with-conditional-routes/163793 "2009-03-24T23:14:41Z")

</div>

Hello, could you please advise me how to test conditional routes with rspec v1.2.0 ? I have something like the following in my application. map.with\_options(:namespace =\> “admin/”, :conditions =\> { :subdomain =\> /^ad…

---

## [Where do I find help about user roles?](https://www.ruby-forum.com/t/where-do-i-find-help-about-user-roles/163751)

<div class="topic-metadata">

**Author:** [@spiderware](https://www.ruby-forum.com/u/spiderware)\
**Replies:** 3\
**Last updated:** [March 24, 2009, 8:13pm UTC](https://www.ruby-forum.com/t/where-do-i-find-help-about-user-roles/163751 "2009-03-24T20:13:24Z")

</div>

I’m trying to create a scenario with a ‘given I am logged in’. I’m struggling to find good documentation about this, the rspec/cucumber book doesn’t have this chapter written yet. Could you point me in the right direc…

---

## [Rspec weird behaviour](https://www.ruby-forum.com/t/rspec-weird-behaviour/163627)

<div class="topic-metadata">

**Author:** [@andrea](https://www.ruby-forum.com/u/andrea)\
**Replies:** 5\
**Last updated:** [March 24, 2009, 2:10pm UTC](https://www.ruby-forum.com/t/rspec-weird-behaviour/163627 "2009-03-24T14:10:51Z")

</div>

Hi, I recently migrated from classic rails testing to Rspec, so I am pretty new to the framework and still learning. I am getting weird errors on an ActiveRecord model test, here is the basic class model definition: …

---

## [Problems with gem rdoc rspec](https://www.ruby-forum.com/t/problems-with-gem-rdoc-rspec/163693)

<div class="topic-metadata">

**Author:** [@arvliet](https://www.ruby-forum.com/u/arvliet)\
**Replies:** 0\
**Last updated:** [March 24, 2009, 12:30am UTC](https://www.ruby-forum.com/t/problems-with-gem-rdoc-rspec/163693 "2009-03-24T00:30:17Z")

</div>

My gems, e.g. rspec, gets installed in: /Library/Ruby/Gems/1.8/gems/rspec-1.2.2 (Note the extra /gems/ subdirectory) When I run “gem rdoc rspec” the output is empty and the Files section has errors: file not found -…

---

## [Spec Server Error on rake spec:server:start](https://www.ruby-forum.com/t/spec-server-error-on-rake-specstart/163666)

<div class="topic-metadata">

**Author:** [@charlesgreen](https://www.ruby-forum.com/u/charlesgreen)\
**Replies:** 3\
**Last updated:** [March 23, 2009, 8:54pm UTC](https://www.ruby-forum.com/t/spec-server-error-on-rake-specstart/163666 "2009-03-23T20:54:50Z")

</div>

Hi, I am following the directions for setting up autotest ( http://wiki.github.com/dchelimsky/rspec/spec\_server-autospec-nearly-pure-bdd-joy) and experienced an error when I run rake spec:server:start. $ rake spec:se…

---

## [Running two instances of autospec](https://www.ruby-forum.com/t/running-two-instances-of-autospec/163664)

<div class="topic-metadata">

**Author:** [@diabolist](https://www.ruby-forum.com/u/diabolist)\
**Replies:** 0\
**Last updated:** [March 23, 2009, 7:05pm UTC](https://www.ruby-forum.com/t/running-two-instances-of-autospec/163664 "2009-03-23T19:05:41Z")

</div>

Hi all, Got this silly idea that I’d like to run two instances of autospec - one for features the other for specs However I can’t work out how to run just the features on their own - can anyone help? TIA Andrew

---

## [Installing RSpec 1.2.2 and RSpec-Rails 1.2.2 As Plugins for Rails 2.0.5](https://www.ruby-forum.com/t/installing-rspec-1-2-2-and-rspec-rails-1-2-2-as-plugins-for-rails-2-0-5/163648)

<div class="topic-metadata">

**Author:** [@charlesgreen](https://www.ruby-forum.com/u/charlesgreen)\
**Replies:** 1\
**Last updated:** [March 23, 2009, 4:33pm UTC](https://www.ruby-forum.com/t/installing-rspec-1-2-2-and-rspec-rails-1-2-2-as-plugins-for-rails-2-0-5/163648 "2009-03-23T16:33:09Z")

</div>

Hi, I have read the Rspec-Rails page ( http://wiki.github.com/dchelimsky/rspec/rails) describing the different installation procedures for RSpec and Rails. Since I am running Rails 2.0.5, I followed the instructions…

---

## [\[ANN\] rspec-rails 1.2.2 Released](https://www.ruby-forum.com/t/ann-rspec-rails-1-2-2-released/163618)

<div class="topic-metadata">

**Author:** [@crucoba](https://www.ruby-forum.com/u/crucoba)\
**Replies:** 0\
**Last updated:** [March 23, 2009, 7:50am UTC](https://www.ruby-forum.com/t/ann-rspec-rails-1-2-2-released/163618 "2009-03-23T07:50:32Z")

</div>

rspec-rails version 1.2.2 has been released! http://rspec.info http://rubyforge.org/projects/rspec http://github.com/dchelimsky/rspec-rails http://wiki.github.com/dchelimsky/rspec/rails removed\_email\_address@domain.inv…

---

## [\[ANN\] rspec 1.2.2 Released](https://www.ruby-forum.com/t/ann-rspec-1-2-2-released/163616)

<div class="topic-metadata">

**Author:** [@crucoba](https://www.ruby-forum.com/u/crucoba)\
**Replies:** 0\
**Last updated:** [March 23, 2009, 7:49am UTC](https://www.ruby-forum.com/t/ann-rspec-1-2-2-released/163616 "2009-03-23T07:49:57Z")

</div>

rspec version 1.2.2 has been released! http://rspec.info http://rubyforge.org/projects/rspec http://github.com/dchelimsky/rspec/wikis removed\_email\_address@domain.invalid Behaviour Driven Development for Ruby. Change…

---

## [\[ANN\] rspec 1.2.1 Released](https://www.ruby-forum.com/t/ann-rspec-1-2-1-released/163612)

<div class="topic-metadata">

**Author:** [@crucoba](https://www.ruby-forum.com/u/crucoba)\
**Replies:** 0\
**Last updated:** [March 23, 2009, 6:09am UTC](https://www.ruby-forum.com/t/ann-rspec-1-2-1-released/163612 "2009-03-23T06:09:53Z")

</div>

rspec version 1.2.1 has been released! http://rspec.info http://rubyforge.org/projects/rspec http://github.com/dchelimsky/rspec/wikis removed\_email\_address@domain.invalid Behaviour Driven Development for Ruby. Change…

---

## [\[ANN\] rspec-rails 1.2.1 Released](https://www.ruby-forum.com/t/ann-rspec-rails-1-2-1-released/163608)

<div class="topic-metadata">

**Author:** [@crucoba](https://www.ruby-forum.com/u/crucoba)\
**Replies:** 0\
**Last updated:** [March 23, 2009, 6:08am UTC](https://www.ruby-forum.com/t/ann-rspec-rails-1-2-1-released/163608 "2009-03-23T06:08:42Z")

</div>

rspec-rails version 1.2.1 has been released! http://rspec.info http://rubyforge.org/projects/rspec http://github.com/dchelimsky/rspec-rails http://wiki.github.com/dchelimsky/rspec/rails removed\_email\_address@domain.inv…

---

## [Testing return value of a block argument](https://www.ruby-forum.com/t/testing-return-value-of-a-block-argument/162977)

<div class="topic-metadata">

**Author:** [@Yun\_Huang\_Y](https://www.ruby-forum.com/u/Yun_Huang_Y)\
**Replies:** 8\
**Last updated:** [March 22, 2009, 7:03pm UTC](https://www.ruby-forum.com/t/testing-return-value-of-a-block-argument/162977 "2009-03-22T19:03:07Z")

</div>

Hi, I’m using Log4r and one of its neat features is its handling of blocks such that you can do: log.debug { “Something bad happened” + some\_expensive\_method() } instead of: log.debug(“Something bad happened” + some…

---

## [Problem running autotest in rails 2.3](https://www.ruby-forum.com/t/problem-running-autotest-in-rails-2-3/163586)

<div class="topic-metadata">

**Author:** [@bornboulder](https://www.ruby-forum.com/u/bornboulder)\
**Replies:** 1\
**Last updated:** [March 22, 2009, 4:32pm UTC](https://www.ruby-forum.com/t/problem-running-autotest-in-rails-2-3/163586 "2009-03-22T16:32:54Z")

</div>

People, I’m trying to run autotest on rails 2.3 I get a NoMethodError. Here is what I see: Sat Mar 21 20:47 /b/tmp/myfc23 maco$ Sat Mar 21 20:47 /b/tmp/myfc23 maco$ autotest loading autotest/rails\_rspec ./vendor/p…

---

## [\[Cucumber\] LinkedIn group & cocktail recipe](https://www.ruby-forum.com/t/cucumber-linkedin-group-cocktail-recipe/163566)

<div class="topic-metadata">

**Author:** [@Ashley\_M](https://www.ruby-forum.com/u/Ashley_M)\
**Replies:** 0\
**Last updated:** [March 22, 2009, 2:24am UTC](https://www.ruby-forum.com/t/cucumber-linkedin-group-cocktail-recipe/163566 "2009-03-22T02:24:11Z")

</div>

Hi all For no other good reason than I wanted the Cucumber logo on my LinkedIn profile - and I’m addicted to creating stuff on LinkedIn - I created a Cucumber group\[1\]. Well there is one good reason - more and more p…

---

## [Expecting a block to return a specific value](https://www.ruby-forum.com/t/expecting-a-block-to-return-a-specific-value/163561)

<div class="topic-metadata">

**Author:** [@guilherme\_c](https://www.ruby-forum.com/u/guilherme_c)\
**Replies:** 1\
**Last updated:** [March 22, 2009, 1:47am UTC](https://www.ruby-forum.com/t/expecting-a-block-to-return-a-specific-value/163561 "2009-03-22T01:47:21Z")

</div>

Hi, I have the following method in a Rails view helper: def title content\_for(:title) do # some code which generates a title dynamically end end How can I spec that the code inside the block returns the correct ti…

---

## [New User Issues](https://www.ruby-forum.com/t/new-user-issues/163529)

<div class="topic-metadata">

**Author:** [@Scott\_LaBounty](https://www.ruby-forum.com/u/Scott_LaBounty)\
**Replies:** 2\
**Last updated:** [March 22, 2009, 1:36am UTC](https://www.ruby-forum.com/t/new-user-issues/163529 "2009-03-22T01:36:14Z")

</div>

I just found RSpec and was trying to do the example on the main page for RSpec (the bowling example). I’m using Ubuntu and did the normal “sudo gem install rspec” and then tried to create the bowling\_spec.rb file. Whe…

---

## [Are there any example specs for content importers to learn from](https://www.ruby-forum.com/t/are-there-any-example-specs-for-content-importers-to-learn-from/163543)

<div class="topic-metadata">

**Author:** [@Chris\_Adams](https://www.ruby-forum.com/u/Chris_Adams)\
**Replies:** 1\
**Last updated:** [March 21, 2009, 10:35pm UTC](https://www.ruby-forum.com/t/are-there-any-example-specs-for-content-importers-to-learn-from/163543 "2009-03-21T22:35:59Z")

</div>

Hi guys, This is my first post to the mailing list, so apologies if this kind of question comes up alot already. I’ve been working through the Peepcode screencasts on RSpec, and I’m trying to what I’ve been learning …

---

## [Mocking base class methods](https://www.ruby-forum.com/t/mocking-base-class-methods/160960)

<div class="topic-metadata">

**Author:** [@tobias](https://www.ruby-forum.com/u/tobias)\
**Replies:** 6\
**Last updated:** [March 21, 2009, 7:47pm UTC](https://www.ruby-forum.com/t/mocking-base-class-methods/160960 "2009-03-21T19:47:21Z")

</div>

Hi! I need to write some wrapper classes, that derive from SWIG generated proxy classes for some C/C++ extensions. The Ruby wrapper classes need to do a lot of ‘super’ calls to the base classes generated by SWIG. Th…

---

## [\[Cucumber\] Rails Upgrade Notes](https://www.ruby-forum.com/t/cucumber-rails-upgrade-notes/163538)

<div class="topic-metadata">

**Author:** [@cwd](https://www.ruby-forum.com/u/cwd)\
**Replies:** 1\
**Last updated:** [March 21, 2009, 6:14pm UTC](https://www.ruby-forum.com/t/cucumber-rails-upgrade-notes/163538 "2009-03-21T18:14:11Z")

</div>

In the history.txt for 0.2 is an “important note” toward the bottom of the announcement. (http://github.com/aslakhellesoy/cucumber/blob/d0555e4ca8a133f020efefd5a755da04bde3f57d/History.txt ). This is really, really im…

---

## [\[cucumber\] Sinatra "polyglot" app path error](https://www.ruby-forum.com/t/cucumber-sinatra-polyglot-app-path-error/163527)

<div class="topic-metadata">

**Author:** [@beenimble](https://www.ruby-forum.com/u/beenimble)\
**Replies:** 1\
**Last updated:** [March 21, 2009, 5:12pm UTC](https://www.ruby-forum.com/t/cucumber-sinatra-polyglot-app-path-error/163527 "2009-03-21T17:12:06Z")

</div>

In case of the following error when using Cucumber with Sinatra: No such file or directory - /usr/local/lib/ruby/gems/1.8/gems/ polyglot-0.2.4/lib/views/index.erb Implement env.rb as specified at the following link so…

---

## [OT: SIT - how to turn it off](https://www.ruby-forum.com/t/ot-sit-how-to-turn-it-off/163487)

<div class="topic-metadata">

**Author:** [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Replies:** 3\
**Last updated:** [March 21, 2009, 3:57pm UTC](https://www.ruby-forum.com/t/ot-sit-how-to-turn-it-off/163487 "2009-03-21T15:57:54Z")

</div>

Pardon the intrusion but if somebody knows how to turn off Rails special treatment of attributes ending in \_type and \_value I would dearly like to have this information. Workarounds are accepted too. I am trying to i…

---

## [Have\_tag and img's](https://www.ruby-forum.com/t/have-tag-and-imgs/163496)

<div class="topic-metadata">

**Author:** [@BJ\_Clark](https://www.ruby-forum.com/u/BJ_Clark)\
**Replies:** 1\
**Last updated:** [March 21, 2009, 3:24am UTC](https://www.ruby-forum.com/t/have-tag-and-imgs/163496 "2009-03-21T03:24:38Z")

</div>

I’m specing some xhtml (which I don’t normally do, so forgive me if this is basic). I’ve got the following spec: it "should build xhtml form pieces" do @captcha.should\_receive(:request\_image).and\_return @image…

---

## [Having a problem with new webrat matchers in cucumber 2](https://www.ruby-forum.com/t/having-a-problem-with-new-webrat-matchers-in-cucumber-2/163451)

<div class="topic-metadata">

**Author:** [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Replies:** 8\
**Last updated:** [March 20, 2009, 7:49pm UTC](https://www.ruby-forum.com/t/having-a-problem-with-new-webrat-matchers-in-cucumber-2/163451 "2009-03-20T19:49:30Z")

</div>

I ran script/generate cucumber and since then I am having a few difficulties. For instance, take this case: When /see (?:an|the) authori(?:s|z)ation required message/ do Then “I should see “You are not authori(?:s|z)…

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

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