# RSpec

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

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

---

## [There should be one test or two?](https://www.ruby-forum.com/t/there-should-be-one-test-or-two/193962)

<div class="topic-metadata">

**Author:** [@rubyernewbie](https://www.ruby-forum.com/u/rubyernewbie)\
**Replies:** 5\
**Last updated:** [August 28, 2010, 2:00am UTC](https://www.ruby-forum.com/t/there-should-be-one-test-or-two/193962 "2010-08-28T02:00:02Z")

</div>

in real world, when user deposit money into their bank, bank have money and can check deposit record. so what would it be in rspec? it ‘should be deposit $10’ user.bank.deposit(10) user.bank.deposit.saving.should == …

---

## [Stack level too deep](https://www.ruby-forum.com/t/stack-level-too-deep/194009)

<div class="topic-metadata">

**Author:** [@Daniel\_LidstrSSSSm](https://www.ruby-forum.com/u/Daniel_LidstrSSSSm)\
**Replies:** 1\
**Last updated:** [August 27, 2010, 11:48pm UTC](https://www.ruby-forum.com/t/stack-level-too-deep/194009 "2010-08-27T23:48:21Z")

</div>

Hello, I am trying to run my first integration tests of my rails 3 application. All tests fail with an error “stack level too deep”. The tests are intended to verify the link routes and look like this: daniel@ubuntu/…

---

## [Problem running "spec spec" or "rake spec" (does nothing)](https://www.ruby-forum.com/t/problem-running-spec-spec-or-rake-spec-does-nothing/194004)

<div class="topic-metadata">

**Author:** [@thelemcke](https://www.ruby-forum.com/u/thelemcke)\
**Replies:** 1\
**Last updated:** [August 27, 2010, 7:46pm UTC](https://www.ruby-forum.com/t/problem-running-spec-spec-or-rake-spec-does-nothing/194004 "2010-08-27T19:46:33Z")

</div>

I have an unusual problem. I’m adding test coverage to my project, and I’d like to be able to run “rake spec” to run all the tests in the /spec folder of the app, but whenever I use the commands “spec spec” or “rake …

---

## [Rspec can not be found](https://www.ruby-forum.com/t/rspec-can-not-be-found/193947)

<div class="topic-metadata">

**Author:** [@dwayne](https://www.ruby-forum.com/u/dwayne)\
**Replies:** 1\
**Last updated:** [August 27, 2010, 1:17am UTC](https://www.ruby-forum.com/t/rspec-can-not-be-found/193947 "2010-08-27T01:17:48Z")

</div>

Hi guys: I’m trying to get my RVM/Rails 2 and 3 mixed environment set up, and I’m still running into problems. Not sure if that’s related to rspec not being found, but here’s what’s happening: $ rake spec --trace (i…

---

## [Problem with spec\_helper](https://www.ruby-forum.com/t/problem-with-spec-helper/193914)

<div class="topic-metadata">

**Author:** [@Daniel\_LidstrSSSSm](https://www.ruby-forum.com/u/Daniel_LidstrSSSSm)\
**Replies:** 3\
**Last updated:** [August 26, 2010, 10:26pm UTC](https://www.ruby-forum.com/t/problem-with-spec-helper/193914 "2010-08-26T22:26:15Z")

</div>

Hello, I am a complete newbie to both ruby and rspec. I am following the steps in the railstutorial.org book to learn ruby on rails. The current step involves setting up rspec for the tests, and this is where I am st…

---

## [Rails3 subdomain constraints with Cucumber and RSpec2](https://www.ruby-forum.com/t/rails3-subdomain-constraints-with-cucumber-and-rspec2/193876)

<div class="topic-metadata">

**Author:** [@fannus](https://www.ruby-forum.com/u/fannus)\
**Replies:** 3\
**Last updated:** [August 26, 2010, 3:27pm UTC](https://www.ruby-forum.com/t/rails3-subdomain-constraints-with-cucumber-and-rspec2/193876 "2010-08-26T15:27:40Z")

</div>

How do I spec rails3 routing constraints? My Cucumber features pass whatever subdomain I pass in. Not sure where or how to spec the subdomain. Any help would be appreciated. I have something like the following: #fe…

---

## [Should raise\_error(ArgumentError) resulting in NoMethodError](https://www.ruby-forum.com/t/should-raise-error-argumenterror-resulting-in-nomethoderror/193884)

<div class="topic-metadata">

**Author:** [@parki](https://www.ruby-forum.com/u/parki)\
**Replies:** 4\
**Last updated:** [August 26, 2010, 3:21pm UTC](https://www.ruby-forum.com/t/should-raise-error-argumenterror-resulting-in-nomethoderror/193884 "2010-08-26T15:21:14Z")

</div>

Environment ruby 1.9.2p0 (2010-08-18 revision 29036) \[x86\_64-darwin10.4.0\] rspec (1.3.0) Code def currency\_to\_dollars(currency\_amount) raise ArgumentError("Currency amount can't be nil") if currency\_amount.nil? end …

---

## [RSpec ActionView released - simplifies creating specs for your View helpers](https://www.ruby-forum.com/t/rspec-actionview-released-simplifies-creating-specs-for-your-view-helpers/193867)

<div class="topic-metadata">

**Author:** [@kristianm](https://www.ruby-forum.com/u/kristianm)\
**Replies:** 0\
**Last updated:** [August 25, 2010, 8:58pm UTC](https://www.ruby-forum.com/t/rspec-actionview-released-simplifies-creating-specs-for-your-view-helpers/193867 "2010-08-25T20:58:18Z")

</div>

require ‘spec\_helper’ module MyView module Tab def tab\_for(clazz, &block) content = with\_output\_buffer(&block) content\_tag :li, content, :class =\> clazz end end module Say def hello(clazz, &block) content = …

---

## [Formatter failing\_examples option](https://www.ruby-forum.com/t/formatter-failing-examples-option/193834)

<div class="topic-metadata">

**Author:** [@rubyfox](https://www.ruby-forum.com/u/rubyfox)\
**Replies:** 1\
**Last updated:** [August 25, 2010, 3:10pm UTC](https://www.ruby-forum.com/t/formatter-failing-examples-option/193834 "2010-08-25T15:10:29Z")

</div>

In RSpec 1 there is formatter option which lets you output just failing examples (named failing\_examples) http://rspec.info/documentation/tools/spec.html I’ve been googling and looking for alternative for RSpec2 and …

---

## [Bundler and config/initializers/\* not loading](https://www.ruby-forum.com/t/bundler-and-config-initializers-not-loading/193812)

<div class="topic-metadata">

**Author:** [@pkoebbe](https://www.ruby-forum.com/u/pkoebbe)\
**Replies:** 2\
**Last updated:** [August 25, 2010, 3:09am UTC](https://www.ruby-forum.com/t/bundler-and-config-initializers-not-loading/193812 "2010-08-25T03:09:19Z")

</div>

I am trying to use Bundler on a Rails 2.3.8 project and am having a problem when trying to run my specs. This application was on 2.3.5 until yesterday, and I switched it to 2.3.8 and all specs passed. But after adding…

---

## [Testing my\_form\_for in a FormBuilder test](https://www.ruby-forum.com/t/testing-my-form-for-in-a-formbuilder-test/193805)

<div class="topic-metadata">

**Author:** [@Rafael\_UchSSSSa](https://www.ruby-forum.com/u/Rafael_UchSSSSa)\
**Replies:** 1\
**Last updated:** [August 25, 2010, 2:11am UTC](https://www.ruby-forum.com/t/testing-my-form-for-in-a-formbuilder-test/193805 "2010-08-25T02:11:57Z")

</div>

Hi there, I’m developing a FormBuilder (let’s say LabelledFormBuilder), and I created a helper called labelled\_form\_for to put the “:builder =\> LabelledFormBuilder” in options and call the original form\_for, like sug…

---

## [Spec\_helper por rails plugin](https://www.ruby-forum.com/t/spec-helper-por-rails-plugin/193807)

<div class="topic-metadata">

**Author:** [@Borja\_MartSSS\_n](https://www.ruby-forum.com/u/Borja_MartSSS_n)\
**Replies:** 1\
**Last updated:** [August 24, 2010, 9:43pm UTC](https://www.ruby-forum.com/t/spec-helper-por-rails-plugin/193807 "2010-08-24T21:43:43Z")

</div>

Hi, I’m trying to write the specs for a rails plugin. The thing is that I don’t want to include in my specs the spec\_helper generated for the rails application as it will load the whole application stack and will fo…

---

## [Upgrading rails 3.0.0.rc.2 and rspec 2.0.0.beta.20 breaks my view tests](https://www.ruby-forum.com/t/upgrading-rails-3-0-0-rc-2-and-rspec-2-0-0-beta-20-breaks-my-view-tests/193785)

<div class="topic-metadata">

**Author:** [@nathanvda](https://www.ruby-forum.com/u/nathanvda)\
**Replies:** 3\
**Last updated:** [August 24, 2010, 5:43pm UTC](https://www.ruby-forum.com/t/upgrading-rails-3-0-0-rc-2-and-rspec-2-0-0-beta-20-breaks-my-view-tests/193785 "2010-08-24T17:43:41Z")

</div>

I was using rails 3 rc and rspec beta 19, and everything worked fine. Today i updated and i get errors on the following methods: rendered.should contain(“bla”) rendered.should have\_xpath(//table//tr) rendered.should …

---

## [How do you enable verbose output from command line?](https://www.ruby-forum.com/t/how-do-you-enable-verbose-output-from-command-line/193596)

<div class="topic-metadata">

**Author:** [@George](https://www.ruby-forum.com/u/George)\
**Replies:** 2\
**Last updated:** [August 24, 2010, 4:26pm UTC](https://www.ruby-forum.com/t/how-do-you-enable-verbose-output-from-command-line/193596 "2010-08-24T16:26:57Z")

</div>

Using this command our specs run with the dot-dot-dot output: jruby -X-C -S rake spec SPEC=spec/models/trip\_spec.rb But how do we make the output verbose? (To see each spec description) Many thanks, George

---

## [Missing template in helper specs with a render](https://www.ruby-forum.com/t/missing-template-in-helper-specs-with-a-render/169551)

<div class="topic-metadata">

**Author:** [@beachguy82](https://www.ruby-forum.com/u/beachguy82)\
**Replies:** 10\
**Last updated:** [August 24, 2010, 3:30pm UTC](https://www.ruby-forum.com/t/missing-template-in-helper-specs-with-a-render/169551 "2010-08-24T15:30:09Z")

</div>

I have a helper method that does a “render :partial”. The method works fine within the app (Rails 2.3.2). In rspec (1.2.6) I get an error (“Missing template /comments/\_comment.erb in view path” It seems that rspec …

---

## [How do I write specs for Rails 3 view block helpers that use #with\_output\_buffer(&block)?](https://www.ruby-forum.com/t/how-do-i-write-specs-for-rails-3-view-block-helpers-that-use-with-output-buffer-block/193729)

<div class="topic-metadata">

**Author:** [@kristianm](https://www.ruby-forum.com/u/kristianm)\
**Replies:** 2\
**Last updated:** [August 23, 2010, 10:15pm UTC](https://www.ruby-forum.com/t/how-do-i-write-specs-for-rails-3-view-block-helpers-that-use-with-output-buffer-block/193729 "2010-08-23T22:15:39Z")

</div>

I found this: it ‘should do something’ do helper.some\_block\_helper { the\_block\_code }.should XXXX end but not sure how to use it I have a module which is extended on top of ActiveView::Base module MyViewExt def a…

---

## [Request specs flash](https://www.ruby-forum.com/t/request-specs-flash/193735)

<div class="topic-metadata">

**Author:** [@kettuvaloinen](https://www.ruby-forum.com/u/kettuvaloinen)\
**Replies:** 1\
**Last updated:** [August 23, 2010, 7:08pm UTC](https://www.ruby-forum.com/t/request-specs-flash/193735 "2010-08-23T19:08:51Z")

</div>

Hey, Is there a way to test for flash content on a request spec (other than to check the request body). I was trying to test something that redirects so testing the content is not possible. Toni

---

## [Rails View spec testing for content in \<head\>](https://www.ruby-forum.com/t/rails-view-spec-testing-for-content-in-head/193622)

<div class="topic-metadata">

**Author:** [@mrkohrea](https://www.ruby-forum.com/u/mrkohrea)\
**Replies:** 5\
**Last updated:** [August 23, 2010, 4:28pm UTC](https://www.ruby-forum.com/t/rails-view-spec-testing-for-content-in-head/193622 "2010-08-23T16:28:58Z")

</div>

Hi, Was trying to verify content in a title tag within a head tag using RSpec2/Rails3 and a view spec, but it seems that render/rendered API’s only return the html within the body tag. In my case the head tag is de…

---

## [Issue with parameterized shared example group on ruby 1.8.6](https://www.ruby-forum.com/t/issue-with-parameterized-shared-example-group-on-ruby-1-8-6/193590)

<div class="topic-metadata">

**Author:** [@Myron\_M](https://www.ruby-forum.com/u/Myron_M)\
**Replies:** 4\
**Last updated:** [August 22, 2010, 5:11am UTC](https://www.ruby-forum.com/t/issue-with-parameterized-shared-example-group-on-ruby-1-8-6/193590 "2010-08-22T05:11:50Z")

</div>

I’ve been refactoring the specs for my VCR gem\[1\] to take advantage of the new shared example group parameterization. VCR supports both FakeWeb and WebMock, with an appropriate adapter class implemented for each. Th…

---

## [Elegant way to configure rspec and capybara](https://www.ruby-forum.com/t/elegant-way-to-configure-rspec-and-capybara/193678)

<div class="topic-metadata">

**Author:** [@narwen](https://www.ruby-forum.com/u/narwen)\
**Replies:** 1\
**Last updated:** [August 22, 2010, 12:19am UTC](https://www.ruby-forum.com/t/elegant-way-to-configure-rspec-and-capybara/193678 "2010-08-22T00:19:12Z")

</div>

I’m wondering what is the elegant way to say to rspec to use capybara instead of webrat. Also, I’m not using cucumber. My project is using: rails (3.0.0.rc) rspec (2.0.0.beta.19) capybara (0.3.9) I had success crea…

---

## [Testing HAML views with RSpec](https://www.ruby-forum.com/t/testing-haml-views-with-rspec/193654)

<div class="topic-metadata">

**Author:** [@Rafael\_UchSSSSa](https://www.ruby-forum.com/u/Rafael_UchSSSSa)\
**Replies:** 1\
**Last updated:** [August 21, 2010, 6:43pm UTC](https://www.ruby-forum.com/t/testing-haml-views-with-rspec/193654 "2010-08-21T18:43:50Z")

</div>

Hi there, I’m using HAML for my views and I want to test them, but I got a ‘Missing template’ exception when I run it. I found this topic ( http://urele.com/ua6 ) where David tells to add a mapping to deal with haml,…

---

## [Rails 3 plugin development - recommended RSpec practices?](https://www.ruby-forum.com/t/rails-3-plugin-development-recommended-rspec-practices/193662)

<div class="topic-metadata">

**Author:** [@kristianm](https://www.ruby-forum.com/u/kristianm)\
**Replies:** 1\
**Last updated:** [August 21, 2010, 4:00pm UTC](https://www.ruby-forum.com/t/rails-3-plugin-development-recommended-rspec-practices/193662 "2010-08-21T16:00:32Z")

</div>

I have been thinking that there must be some better ways of doing Rails plugin development than my current approach. Currently I tend to have my plugin in one location as a gem and then link to it from some fresh Rail…

---

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

<div class="topic-metadata">

**Author:** [@bcardoso](https://www.ruby-forum.com/u/bcardoso)\
**Replies:** 0\
**Last updated:** [August 20, 2010, 7:43pm UTC](https://www.ruby-forum.com/t/testing-routes/193624 "2010-08-20T19:43:44Z")

</div>

Hi, I have this route configurated in my routes.rb map.resources :accounts do |account| account.resources :managers, :controller =\> ‘account\_managers’ end This works. Now, I want to test the update route in my spec…

---

## [Testing Email thriugh Rspec](https://www.ruby-forum.com/t/testing-email-thriugh-rspec/182068)

<div class="topic-metadata">

**Author:** [@tornado](https://www.ruby-forum.com/u/tornado)\
**Replies:** 11\
**Last updated:** [August 19, 2010, 5:48pm UTC](https://www.ruby-forum.com/t/testing-email-thriugh-rspec/182068 "2010-08-19T17:48:10Z")

</div>

Hi i am testing email through rspec but some problem occured. This is the whole scenario: What i want to do is when my user is created it should send mail to for activation. This is the code under user\_spec.rb requi…

---

## [Load dummy data using Factory girl](https://www.ruby-forum.com/t/load-dummy-data-using-factory-girl/193354)

<div class="topic-metadata">

**Author:** [@tornado](https://www.ruby-forum.com/u/tornado)\
**Replies:** 3\
**Last updated:** [August 19, 2010, 3:49pm UTC](https://www.ruby-forum.com/t/load-dummy-data-using-factory-girl/193354 "2010-08-19T15:49:30Z")

</div>

Hello, I wanted to know how to load dummy data in the application using Factory girl. I had done this using Fixtures.I had made a fixtures folder into the test folder and run the command “rake test fixtures:load” Cu…

---

## [Dynamic tests possible?](https://www.ruby-forum.com/t/dynamic-tests-possible/193494)

<div class="topic-metadata">

**Author:** [@rogerdpack](https://www.ruby-forum.com/u/rogerdpack)\
**Replies:** 2\
**Last updated:** [August 18, 2010, 7:34pm UTC](https://www.ruby-forum.com/t/dynamic-tests-possible/193494 "2010-08-18T19:34:33Z")

</div>

Sorry if this is a newbie question, but here goes. I was wondering if the following is somehow possible: for file in Dir\[’\*.bmp’\] it “should be able to parse #{file}” do p file # test this file end end Currently …

---

## [How do you turn colour on in autotest?](https://www.ruby-forum.com/t/how-do-you-turn-colour-on-in-autotest/193471)

<div class="topic-metadata">

**Author:** [@Ashley\_M](https://www.ruby-forum.com/u/Ashley_M)\
**Replies:** 2\
**Last updated:** [August 18, 2010, 5:01pm UTC](https://www.ruby-forum.com/t/how-do-you-turn-colour-on-in-autotest/193471 "2010-08-18T17:01:07Z")

</div>

Hi This may sound like a really dumb question (most likely because it is), but I have two RSpec 2 projects, and one of them gives me colour, but the other doesn’t. Nothing in spec\_helper.rb or my autotest files ment…

---

## [Autotest doesn't load up rspec (rspec2, rails3, ruby 1.9.2)](https://www.ruby-forum.com/t/autotest-doesnt-load-up-rspec-rspec2-rails3-ruby-1-9-2/193463)

<div class="topic-metadata">

**Author:** [@Nils\_Riedemann](https://www.ruby-forum.com/u/Nils_Riedemann)\
**Replies:** 4\
**Last updated:** [August 18, 2010, 3:29pm UTC](https://www.ruby-forum.com/t/autotest-doesnt-load-up-rspec-rspec2-rails3-ruby-1-9-2/193463 "2010-08-18T15:29:10Z")

</div>

Hi there, When i run rspec --drb spec everything works fine. Yet, when i want to use autotest it outputs the following: ~/code/ffr\[master\]% autotest /Users/nilsriedemann/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/ rub…

---

## [Difficulties install Rspec](https://www.ruby-forum.com/t/difficulties-install-rspec/193457)

<div class="topic-metadata">

**Author:** [@Craig\_Castelaz](https://www.ruby-forum.com/u/Craig_Castelaz)\
**Replies:** 0\
**Last updated:** [August 18, 2010, 2:21am UTC](https://www.ruby-forum.com/t/difficulties-install-rspec/193457 "2010-08-18T02:21:16Z")

</div>

I recently purchased the beta of the Rspec PragBook, and am really looking forward to diving in. Unfortunately, I’m having difficulty installing Rspec. I’m currently running Ruby 1.8.7 on Snow Leopard (10.6.4). Bot…

---

## [RSpec 2 matchers 'code-spec' and 'file-spec' released](https://www.ruby-forum.com/t/rspec-2-matchers-code-spec-and-file-spec-released/193379)

<div class="topic-metadata">

**Author:** [@kristianm](https://www.ruby-forum.com/u/kristianm)\
**Replies:** 0\
**Last updated:** [August 16, 2010, 8:27pm UTC](https://www.ruby-forum.com/t/rspec-2-matchers-code-spec-and-file-spec-released/193379 "2010-08-16T20:27:14Z")

</div>

Spec your generated Ruby code files code-spec at: GitHub - kristianmandrup/code-spec: RSpec matchers for Ruby code Spec your file structure (files, dirs, symlinks) file-spec at: GitHub - kristianmandrup/file-spec: RSp…

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

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