# RSpec

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

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

---

## [Ordering dependency in tests?](https://www.ruby-forum.com/t/ordering-dependency-in-tests/203669)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 10\
**Last updated:** [February 24, 2011, 8:24pm UTC](https://www.ruby-forum.com/t/ordering-dependency-in-tests/203669 "2011-02-24T20:24:19Z")

</div>

I’m baffled. If I do: $ bundle exec ruby -S rspec --tty A\_spec.rb $ bundle exec ruby -S rspec --tty B\_spec.rb I get no errors. But then if I do: $ bundle exec ruby -S rspec --tty A\_spec.rb B\_spec.rb I get an er…

---

## [Error Testing a view in RSpec 2](https://www.ruby-forum.com/t/error-testing-a-view-in-rspec-2/197340)

<div class="topic-metadata">

**Author:** [@okkezSS](https://www.ruby-forum.com/u/okkezSS)\
**Replies:** 8\
**Last updated:** [February 23, 2011, 2:23pm UTC](https://www.ruby-forum.com/t/error-testing-a-view-in-rspec-2/197340 "2011-02-23T14:23:03Z")

</div>

Well, I’be looking for test my views with rspec, looking the documentation at http://rspec.info/rails/writing/views.html we see some examples, in RSpec 2 the response was deprecated and now I’m using the rendered inst…

---

## [Stubbing Sleep](https://www.ruby-forum.com/t/stubbing-sleep/203535)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 2\
**Last updated:** [February 23, 2011, 4:24am UTC](https://www.ruby-forum.com/t/stubbing-sleep/203535 "2011-02-23T04:24:58Z")

</div>

I’ve recently been playing around with some code that re-runs a block until either the block returns a non-false value, or a timeout expires: At first, I thought this was working, as I was just checking the timing …

---

## [Stubbed static methods are bleeding over into other specs and making them fail](https://www.ruby-forum.com/t/stubbed-static-methods-are-bleeding-over-into-other-specs-and-making-them-fail/203539)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 0\
**Last updated:** [February 22, 2011, 4:19pm UTC](https://www.ruby-forum.com/t/stubbed-static-methods-are-bleeding-over-into-other-specs-and-making-them-fail/203539 "2011-02-22T16:19:07Z")

</div>

rspec (1.3.1) rspec-rails (1.3.3) rails (2.3.3) Hi, there was another thread with this topic but with rspec 2.0 so I’ll start a new one for the “old” branch. I have a workling class (working with method missing on …

---

## [Rspec not loading rails files- uninitialized constant error](https://www.ruby-forum.com/t/rspec-not-loading-rails-files-uninitialized-constant-error/203469)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 4\
**Last updated:** [February 21, 2011, 7:29pm UTC](https://www.ruby-forum.com/t/rspec-not-loading-rails-files-uninitialized-constant-error/203469 "2011-02-21T19:29:54Z")

</div>

I am new to rspec. I followed a few tutorials and set it up to test my existing rails project. I ran the rspec generators and created spec/user\_spec.rb to test my user.rb model. The user.rb file starts with: class Us…

---

## [What are all available config options?](https://www.ruby-forum.com/t/what-are-all-available-config-options/203466)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 1\
**Last updated:** [February 20, 2011, 11:37pm UTC](https://www.ruby-forum.com/t/what-are-all-available-config-options/203466 "2011-02-20T23:37:00Z")

</div>

Hello everyone, what are all the configuration options available for the .rspec file? Currently I only know --colour. Thanks! Rodrigo Alves V. http://rodrigo3n.com | rodrigo3n (Mudou @rodrigoalvesvieira) · GitHub | h…

---

## [\[rspec-rails\] Exception catching in controller](https://www.ruby-forum.com/t/rspec-rails-exception-catching-in-controller/203290)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 4\
**Last updated:** [February 19, 2011, 8:26am UTC](https://www.ruby-forum.com/t/rspec-rails-exception-catching-in-controller/203290 "2011-02-19T08:26:21Z")

</div>

Hi folks. I’m currently using rspec-2.4.0 and rspec-rails-2.4.1. In the controller I have the code like this (at least at two different places): def some\_action raise Exception if some\_falsy\_value rescue @message =…

---

## [Order of execution of specs](https://www.ruby-forum.com/t/order-of-execution-of-specs/203278)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 1\
**Last updated:** [February 17, 2011, 10:24pm UTC](https://www.ruby-forum.com/t/order-of-execution-of-specs/203278 "2011-02-17T22:24:33Z")

</div>

…trying to debug some interaction between my model specs, a particular spec passes by itself but fails when I run all my model specs. I can’t figure out how the execution sequence is performed when I do spec spec/mode…

---

## [It\_behaves\_like and running single examples](https://www.ruby-forum.com/t/it-behaves-like-and-running-single-examples/203291)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 2\
**Last updated:** [February 17, 2011, 8:15pm UTC](https://www.ruby-forum.com/t/it-behaves-like-and-running-single-examples/203291 "2011-02-17T20:15:55Z")

</div>

Hello, I am running rspec 2 and rails 3 in a project. When I have a shared example being used in a spec file, I loose the ability to run a single test in that file. rspec spec/controllers/proposals\_controller\_spec.rb…

---

## [TypeError: can't convert RSpec::Mocks::Mock to Hash](https://www.ruby-forum.com/t/typeerror-cant-convert-rspec-mock-to-hash/203279)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 0\
**Last updated:** [February 16, 2011, 11:11pm UTC](https://www.ruby-forum.com/t/typeerror-cant-convert-rspec-mock-to-hash/203279 "2011-02-16T23:11:22Z")

</div>

controller def create @money\_order = current\_user.money\_orders.build(params\[:money\_order\]) if @money\_order.save @money\_orders = current\_user.money\_orders.staged flash.now\[:msg\_ok\] = “Added money order for: #{number\_…

---

## [Stubbing gets undone?](https://www.ruby-forum.com/t/stubbing-gets-undone/203245)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 3\
**Last updated:** [February 16, 2011, 8:37pm UTC](https://www.ruby-forum.com/t/stubbing-gets-undone/203245 "2011-02-16T20:37:45Z")

</div>

I’m looking at an example where a stub seems to work sometimes, and sometimes appears to become “unstubbed”. I haven’t boiled it down to a minimal example, but it goes something like this: ---- the model: class Prem…

---

## [RSpec Error - "Invalid Option"](https://www.ruby-forum.com/t/rspec-error-invalid-option/203240)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [February 16, 2011, 9:22am UTC](https://www.ruby-forum.com/t/rspec-error-invalid-option/203240 "2011-02-16T09:22:44Z")

</div>

I keep getting an issue when running RSpec with Autotest. My ~/.autotest file looks like this: ==FILE BEGINS== require ‘autotest/growl’ require ‘autotest/fsevent’ Autotest.add\_hook :initialize do |autotest| autotes…

---

## [Tcmalloc error running rspec spec using ree](https://www.ruby-forum.com/t/tcmalloc-error-running-rspec-spec-using-ree/203209)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 0\
**Last updated:** [February 15, 2011, 5:07pm UTC](https://www.ruby-forum.com/t/tcmalloc-error-running-rspec-spec-using-ree/203209 "2011-02-15T17:07:09Z")

</div>

I’m using ree via rvm. Everything was just installed. In autotest, the tests won’t even start to run. When I run rspec spec, the tests will run, but will crash at some point here: src/tcmalloc.cc:390\] Attempt to fre…

---

## [Not loading RSpec::Rails::MailerExampleGroup](https://www.ruby-forum.com/t/not-loading-rspec-mailerexamplegroup/203201)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 2\
**Last updated:** [February 15, 2011, 3:19pm UTC](https://www.ruby-forum.com/t/not-loading-rspec-mailerexamplegroup/203201 "2011-02-15T15:19:59Z")

</div>

Hi all, I’m working on Rails 3 application with ActiveRecord and ActionMailer stripped out (I’ve commented out the respective lines in config/application.rb), but I’m running into some problems when I’m running the s…

---

## [(Bad) Memory Leak in RSpec 2](https://www.ruby-forum.com/t/bad-memory-leak-in-rspec-2/203177)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 6\
**Last updated:** [February 15, 2011, 2:33am UTC](https://www.ruby-forum.com/t/bad-memory-leak-in-rspec-2/203177 "2011-02-15T02:33:53Z")

</div>

We have had a really great integrated javascripting testing in our very large, very javascripty Sinatra application. Our testing setup uses a custom version of harmony (GitHub - baccigalupi/harmony: Javascript + DOM in…

---

## [Stubbing out after\_create AR method?](https://www.ruby-forum.com/t/stubbing-out-after-create-ar-method/203168)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 3\
**Last updated:** [February 15, 2011, 12:01am UTC](https://www.ruby-forum.com/t/stubbing-out-after-create-ar-method/203168 "2011-02-15T00:01:36Z")

</div>

I have a Premise model with an after\_create method, along the lines of: class Premise \< ActiveRecord::Base … after\_create :etl\_attributes … end In production code, etl\_attributes accesses the web. For testing I’m …

---

## [Feedback on feature request requested](https://www.ruby-forum.com/t/feedback-on-feature-request-requested/203143)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 0\
**Last updated:** [February 14, 2011, 5:23am UTC](https://www.ruby-forum.com/t/feedback-on-feature-request-requested/203143 "2011-02-14T05:23:51Z")

</div>

Hey all, There is a feature request that would break compatibility for some rspec suites using older conventions. I’m in favor of adding the feature in 3.0 release when we get there, but would appreciate hearing from …

---

## [Problem with rendering JSON](https://www.ruby-forum.com/t/problem-with-rendering-json/203067)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 3\
**Last updated:** [February 13, 2011, 12:58pm UTC](https://www.ruby-forum.com/t/problem-with-rendering-json/203067 "2011-02-13T12:58:15Z")

</div>

You are my last resort for solving this issue as I have tried and tried to solve it myself but can’t. I’m not even sure if it’s an RSpec issue but the thing is, if I run the request from the browser, it works. Sadly,…

---

## [Hash form of stub\_chain returning nil for chains with shared first message](https://www.ruby-forum.com/t/hash-form-of-stub-chain-returning-nil-for-chains-with-shared-first-message/203026)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 5\
**Last updated:** [February 13, 2011, 9:39am UTC](https://www.ruby-forum.com/t/hash-form-of-stub-chain-returning-nil-for-chains-with-shared-first-message/203026 "2011-02-13T09:39:58Z")

</div>

I’m new using rspec, so please forgive me if I’m barking up the wrong tree, but… I’d expect this to pass (using rspec 2.5.1) describe ‘stub\_chain’ do it “returns expected value from two chains with hash” do subject …

---

## [Controller Specs - undefined local variable or method 'app'](https://www.ruby-forum.com/t/controller-specs-undefined-local-variable-or-method-app/203085)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 2\
**Last updated:** [February 12, 2011, 11:39pm UTC](https://www.ruby-forum.com/t/controller-specs-undefined-local-variable-or-method-app/203085 "2011-02-12T23:39:07Z")

</div>

On one of my projects using rspec 2.5 & rails 3.0.4, I recently moved from postgres to mongo and am using mongoid as the persistence library. I ported all the models over to the mongoid way of doing things and now ha…

---

## [Using before(:all) for cheap benchmark?](https://www.ruby-forum.com/t/using-before-all-for-cheap-benchmark/203102)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 1\
**Last updated:** [February 12, 2011, 10:30pm UTC](https://www.ruby-forum.com/t/using-before-all-for-cheap-benchmark/203102 "2011-02-12T22:30:52Z")

</div>

I’m a new (and complete) convert to RSpec, especially when coupled with autotest. I notice when automate processes my entire spec directory it takes about eight minutes. I have many more tests to add before I’m done,…

---

## [Control order of spec files for an integration test?](https://www.ruby-forum.com/t/control-order-of-spec-files-for-an-integration-test/203103)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 0\
**Last updated:** [February 12, 2011, 9:18pm UTC](https://www.ruby-forum.com/t/control-order-of-spec-files-for-an-integration-test/203103 "2011-02-12T21:18:14Z")

</div>

Hi, I’m using RSpec2 with Capybara and Celerity for an integration test. I’d like to use some of the tests (e.g. user registration) to run as a prerequisite to other steps. I was hoping that by naming files in the c…

---

## [Mocking an AR: ActiveRecord::AssociationTypeMismatch error](https://www.ruby-forum.com/t/mocking-an-ar-activerecord-associationtypemismatch-error/203088)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 2\
**Last updated:** [February 12, 2011, 5:14pm UTC](https://www.ruby-forum.com/t/mocking-an-ar-activerecord-associationtypemismatch-error/203088 "2011-02-12T17:14:21Z")

</div>

I have a Premise model with lots of validations and somewhat complex callbacks. I’ve already written tests for those (and they pass). I also have a MeteredService model for which premise :has\_many metered\_services an…

---

## [Current test failing?](https://www.ruby-forum.com/t/current-test-failing/203058)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [February 12, 2011, 1:01am UTC](https://www.ruby-forum.com/t/current-test-failing/203058 "2011-02-12T01:01:44Z")

</div>

Is there any way, within a test (e.g., in an after block), to see whether the test is currently passing, failing, or pending? Even a hack-ish kind of way? I’m just curious.

---

## [Re: testing a collection](https://www.ruby-forum.com/t/re-testing-a-collection/203073)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 0\
**Last updated:** [February 11, 2011, 7:21pm UTC](https://www.ruby-forum.com/t/re-testing-a-collection/203073 "2011-02-11T19:21:04Z")

</div>

\---- Jay McGaffigan removed\_email\_address@domain.invalid wrote: Have you looked at JTestR? I’m not sure how active it is being developed and it might not do what you are looking for… but it might be worth a shot. Y…

---

## [Testing a collection](https://www.ruby-forum.com/t/testing-a-collection/203066)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [February 11, 2011, 5:45pm UTC](https://www.ruby-forum.com/t/testing-a-collection/203066 "2011-02-11T17:45:08Z")

</div>

All, Is there away to test a collection with rspec 1.3? I’ve seen Jim Weirich’s rspec-collection, but it requires rspec 2.0. I’d like to go to rspec 2.0, but have another dependency that will not work with rspec 2.…

---

## [Excluding a spec subdirectory from rake spec](https://www.ruby-forum.com/t/excluding-a-spec-subdirectory-from-rake-spec/203045)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [February 11, 2011, 6:50am UTC](https://www.ruby-forum.com/t/excluding-a-spec-subdirectory-from-rake-spec/203045 "2011-02-11T06:50:28Z")

</div>

Best way? Is it for specs that make live api calls? Here is an alternative to have a “remote” directory: gist:812278 · GitHub No, it is a directory that I want to run without loading rails. It has its own spec\_he…

---

## [Pull requests via Github - To Fork or Not? That is the Question](https://www.ruby-forum.com/t/pull-requests-via-github-to-fork-or-not-that-is-the-question/203039)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 2\
**Last updated:** [February 11, 2011, 4:26am UTC](https://www.ruby-forum.com/t/pull-requests-via-github-to-fork-or-not-that-is-the-question/203039 "2011-02-11T04:26:21Z")

</div>

Hi, I’ve been coming up with some documentation examples, which I’d like to contribute as Cucumber features to go into the relishapp. I started following the contribute instructions on the rspec-dev README\[1\] but hav…

---

## [Opinions sought on feature/pull request](https://www.ruby-forum.com/t/opinions-sought-on-feature-pull-request/203008)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 0\
**Last updated:** [February 10, 2011, 2:11pm UTC](https://www.ruby-forum.com/t/opinions-sought-on-feature-pull-request/203008 "2011-02-10T14:11:54Z")

</div>

Hey all, Looking for thoughts on a feature/pull request: Arguments passed to its by knzconnor · Pull Request #306 · rspec/rspec-core · GitHub. Cheers, David

---

## [Excluding a spec subdirectory from rake spec](https://www.ruby-forum.com/t/excluding-a-spec-subdirectory-from-rake-spec/202925)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [February 9, 2011, 3:52am UTC](https://www.ruby-forum.com/t/excluding-a-spec-subdirectory-from-rake-spec/202925 "2011-02-09T03:52:38Z")

</div>

I have a directory in my spec directory that I want to exclude from rake spec That is, I have spec/lib\_no\_rails And I don’t want it to run when I do rake spec Best way? Thanks. -Corey

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

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