# RSpec

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

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

---

## [Rspec \_and\_ Rails test::unit tests](https://www.ruby-forum.com/t/rspec-and-rails-test-unit-tests/205809)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 1\
**Last updated:** [April 15, 2011, 11:14pm UTC](https://www.ruby-forum.com/t/rspec-and-rails-test-unit-tests/205809 "2011-04-15T23:14:11Z")

</div>

There’s so much different chatter about this issue and I was wondering if any of you could spare the time to assist. Start a new Rails3 project. Initialize rspec for the project. Now run autotest. Ok, great, “loading …

---

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

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 2\
**Last updated:** [April 15, 2011, 11:01pm UTC](https://www.ruby-forum.com/t/typeerror-cant-convert-rspec-mock-to-hash/203292 "2011-04-15T23:01:50Z")

</div>

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

---

## [Skipping callbacks that aren't necessary for what i'm testing](https://www.ruby-forum.com/t/skipping-callbacks-that-arent-necessary-for-what-im-testing/205688)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 1\
**Last updated:** [April 13, 2011, 1:21pm UTC](https://www.ruby-forum.com/t/skipping-callbacks-that-arent-necessary-for-what-im-testing/205688 "2011-04-13T13:21:08Z")

</div>

I have an Address model that has a before\_validation callback that goes off and geocodes the address. I’m concerned that for all the tests in my Address model I’m going to be triggering that callback, even when it’s n…

---

## [Need suggestions on how to test a class](https://www.ruby-forum.com/t/need-suggestions-on-how-to-test-a-class/205676)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 2\
**Last updated:** [April 13, 2011, 12:24pm UTC](https://www.ruby-forum.com/t/need-suggestions-on-how-to-test-a-class/205676 "2011-04-13T12:24:50Z")

</div>

Hi \*, the class I need to test is: I know my question is very generic, but I honestly fail to see how to test something that is so strictly procedural and so dependent to the platform/libraries. Should I mock/stub …

---

## [RSpec 2.5 not seeing MiniTests?](https://www.ruby-forum.com/t/rspec-2-5-not-seeing-minitests/205666)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [April 12, 2011, 10:37pm UTC](https://www.ruby-forum.com/t/rspec-2-5-not-seeing-minitests/205666 "2011-04-12T22:37:21Z")

</div>

I originally tried using the upgrade instructions on relish/core/upgrade but eventually stripped it down to a couple files and still cannot get RSpec to pick up my minitest tests. I don’t actually use describe/should…

---

## [Rspec-1.3.2 is released!](https://www.ruby-forum.com/t/rspec-1-3-2-is-released/205644)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [April 12, 2011, 5:12pm UTC](https://www.ruby-forum.com/t/rspec-1-3-2-is-released/205644 "2011-04-12T17:12:01Z")

</div>

rspec-1.3.2 is released! This is primarily a bug-fix release of the rspec-1.x series, and is recommended for all users who have not yet upgraded to rspec-2. === Version 1.3.2 / 2011-04-11 Enhancements Raise a mea…

---

## [Rspec-rails-1.3.4 is released!](https://www.ruby-forum.com/t/rspec-rails-1-3-4-is-released/205645)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 0\
**Last updated:** [April 12, 2011, 5:56am UTC](https://www.ruby-forum.com/t/rspec-rails-1-3-4-is-released/205645 "2011-04-12T05:56:57Z")

</div>

rspec-rails-1.3.4 is released! === Version 1.3.4 / 2011-04-11 No new code Depends on rspec ~\> 1.3.2 rspec-rails 1.3.3 depended on rspec-1.3.1 explicitly, so this release allows you to upgrade to rspec-1.3.2 with rsp…

---

## [Subdomain test](https://www.ruby-forum.com/t/subdomain-test/205631)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 2\
**Last updated:** [April 12, 2011, 4:36am UTC](https://www.ruby-forum.com/t/subdomain-test/205631 "2011-04-12T04:36:13Z")

</div>

Hi guys, I’m developing a app where each subdomain has a independent data set. I did a few tries to rewrite a test for this, but all were unsuccessful. Do someone has a example how I can do that? any reference will he…

---

## [Overriding Kernel#inspect just for tests](https://www.ruby-forum.com/t/overriding-kernel-inspect-just-for-tests/205531)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 3\
**Last updated:** [April 11, 2011, 8:12pm UTC](https://www.ruby-forum.com/t/overriding-kernel-inspect-just-for-tests/205531 "2011-04-11T20:12:41Z")

</div>

Hi all. Occasionally, I write specs that verify the order in which some ActiveRecord objects are returned. For example, in a toy project I do: Reply.stub :per\_page =\> 2 topic.replies\_on\_page(1).should == \[second, fi…

---

## [Metadata raises CompatibilityError when I try to inspect it](https://www.ruby-forum.com/t/metadata-raises-compatibilityerror-when-i-try-to-inspect-it/205417)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 3\
**Last updated:** [April 11, 2011, 11:08am UTC](https://www.ruby-forum.com/t/metadata-raises-compatibilityerror-when-i-try-to-inspect-it/205417 "2011-04-11T11:08:20Z")

</div>

Hi. When I try to inspect example metadata, for some reason it raises the encoding compatibility exception. describe RSpec::Core::Metadata do describe '#inspect' do it 'raises Encoding::CompatibilityError' do …

---

## [\[rspec-rails\] reload of objects in tests](https://www.ruby-forum.com/t/rspec-rails-reload-of-objects-in-tests/205549)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [April 8, 2011, 4:34pm UTC](https://www.ruby-forum.com/t/rspec-rails-reload-of-objects-in-tests/205549 "2011-04-08T16:34:27Z")

</div>

hi, I am kind of confused, why this code is behaving the way it does. In a test, I wrote something like this: it “should do something” do @some = Factory(:some) initial\_object = @some #do something with @some. e.g.…

---

## [Getting weird "no route matches" error, using rspec2 and rails3 (just migrated) but app works](https://www.ruby-forum.com/t/getting-weird-no-route-matches-error-using-rspec2-and-rails3-just-migrated-but-app-works/205493)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 3\
**Last updated:** [April 8, 2011, 3:35pm UTC](https://www.ruby-forum.com/t/getting-weird-no-route-matches-error-using-rspec2-and-rails3-just-migrated-but-app-works/205493 "2011-04-08T15:35:05Z")

</div>

Hi there, in my main view i have a link to the root\_path, which converts to {:controller =\> "home", :action =\> :index} In every spec i run, i get the error: No route matches {:controller=\>"home"} While if i run the …

---

## [RSpec is for the literate](https://www.ruby-forum.com/t/rspec-is-for-the-literate/205504)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 0\
**Last updated:** [April 7, 2011, 7:34pm UTC](https://www.ruby-forum.com/t/rspec-is-for-the-literate/205504 "2011-04-07T19:34:58Z")

</div>

I posted an article on RSpec this morning, I thought it might be of interest to this list:

---

## [No output from rspec](https://www.ruby-forum.com/t/no-output-from-rspec/197644)

<div class="topic-metadata">

**Author:** [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Replies:** 3\
**Last updated:** [April 5, 2011, 6:27pm UTC](https://www.ruby-forum.com/t/no-output-from-rspec/197644 "2011-04-05T18:27:41Z")

</div>

At one point, I had rspec working with my system and I’ve must have changed the configuration because now I don’t see anything in the output using rspec 1.3. Just to be clear, I see nothing when I type spec spec r…

---

## [Ruby 1.9.2 confusion](https://www.ruby-forum.com/t/ruby-1-9-2-confusion/205314)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [April 4, 2011, 6:12am UTC](https://www.ruby-forum.com/t/ruby-1-9-2-confusion/205314 "2011-04-04T06:12:00Z")

</div>

I’m wondering if someone could shed a little light on something for me. I’m trying to get a Rails 2.3.11 project running on Ruby 1.9.2-p180, and the same specs that pass on 1.8.7-p302 don’t pass on 1.9.2-p180 if I run …

---

## [Error running rspec on Debian](https://www.ruby-forum.com/t/error-running-rspec-on-debian/205286)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 2\
**Last updated:** [April 3, 2011, 6:48pm UTC](https://www.ruby-forum.com/t/error-running-rspec-on-debian/205286 "2011-04-03T18:48:33Z")

</div>

I’m new to Rails and I was planning on trying out RSpec. When I try to execute the rspec command on Debian v6.0.1, I get the output below: k4ru050@DebianBox:~/Desktop/rails\_projects/sample\_app/spec$ bundle exec rspec …

---

## [Bundler and Setting up RSpec](https://www.ruby-forum.com/t/bundler-and-setting-up-rspec/205287)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [April 3, 2011, 5:48pm UTC](https://www.ruby-forum.com/t/bundler-and-setting-up-rspec/205287 "2011-04-03T17:48:01Z")

</div>

Hi there, Does RSpec acknowledge bundler, and use the groups? Also is there any good example of what is required for a function spec rake task… I’ve had issues trying to create my own. require ‘rubygems’ require ‘b…

---

## [Can't put shared example group in its own file](https://www.ruby-forum.com/t/cant-put-shared-example-group-in-its-own-file/205083)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 2\
**Last updated:** [April 3, 2011, 5:42pm UTC](https://www.ruby-forum.com/t/cant-put-shared-example-group-in-its-own-file/205083 "2011-04-03T17:42:27Z")

</div>

Any ideas? All I’d like to do is have two specs in different files use the same shared example group. I saw a similar thread about autotest, but I am not using that. \[Sorry for the double post on Google G.; didn’t rea…

---

## [Autotest Parallel Support](https://www.ruby-forum.com/t/autotest-parallel-support/205284)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [April 3, 2011, 12:44am UTC](https://www.ruby-forum.com/t/autotest-parallel-support/205284 "2011-04-03T00:44:04Z")

</div>

I have a commit to add support for the -p (parallel) option to autotest, which is a feature provided by @grosser’s autotest fork. The discussion is here: The commit is here: Being that this adds a feature only supp…

---

## [Spec\_helper aware of full test suite being run? After hook to run code after running all specs?](https://www.ruby-forum.com/t/spec-helper-aware-of-full-test-suite-being-run-after-hook-to-run-code-after-running-all-specs/205291)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 0\
**Last updated:** [April 3, 2011, 12:06am UTC](https://www.ruby-forum.com/t/spec-helper-aware-of-full-test-suite-being-run-after-hook-to-run-code-after-running-all-specs/205291 "2011-04-03T00:06:35Z")

</div>

I use VCR to record interactions, and when the recordings change filenames, and directory structure, over time, as the test suite evolves, the old recordings, no longer used, are rarely pruned. I would like to have th…

---

## [Spec\_helper aware of full test suite being run? After hook to run code after running all specs?](https://www.ruby-forum.com/t/spec-helper-aware-of-full-test-suite-being-run-after-hook-to-run-code-after-running-all-specs/205290)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 0\
**Last updated:** [April 2, 2011, 11:57pm UTC](https://www.ruby-forum.com/t/spec-helper-aware-of-full-test-suite-being-run-after-hook-to-run-code-after-running-all-specs/205290 "2011-04-02T23:57:59Z")

</div>

I use VCR to record interactions, and when the recordings change filenames, and directory structure, over time, as the test suite evolves, the old recordings, no longer used, are rarely pruned. I would like to have t…

---

## [Rack application timed out during boot](https://www.ruby-forum.com/t/rack-application-timed-out-during-boot/205289)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 0\
**Last updated:** [April 2, 2011, 11:55pm UTC](https://www.ruby-forum.com/t/rack-application-timed-out-during-boot/205289 "2011-04-02T23:55:31Z")

</div>

Hi, I’m using Rspec + Capybara in Rails3. My integration tests went well today until I couldn’t even access a page with simple requests such as: visit root\_path With error: Rack application timed out during boot A…

---

## [Rails Rspec Capybara Testing Javascript](https://www.ruby-forum.com/t/rails-rspec-capybara-testing-javascript/205288)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 0\
**Last updated:** [April 2, 2011, 11:51pm UTC](https://www.ruby-forum.com/t/rails-rspec-capybara-testing-javascript/205288 "2011-04-02T23:51:13Z")

</div>

I’m testing a Rails 3 app with Rspec and Capybara. For my integration tests, I need to test javascript. Of course, I watched #257 Request Specs and Capybara - RailsCasts which presents the basics very well. Unfortuna…

---

## [Rake generate - not generating spec files](https://www.ruby-forum.com/t/rake-generate-not-generating-spec-files/203569)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 3\
**Last updated:** [April 2, 2011, 11:50pm UTC](https://www.ruby-forum.com/t/rake-generate-not-generating-spec-files/203569 "2011-04-02T23:50:36Z")

</div>

Howdy, I’m running the following stack: rails 3.0.4 rake (0.8.7) rspec 2.5.0 rspec-rails 2.5.0 I created the rails app, and I didn’t tell rails to exclude the default Test mechanisms. I installed it using rails…

---

## [\[module announcement\] Equivalency testing for XML](https://www.ruby-forum.com/t/module-announcement-equivalency-testing-for-xml/205285)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 0\
**Last updated:** [April 2, 2011, 11:48pm UTC](https://www.ruby-forum.com/t/module-announcement-equivalency-testing-for-xml/205285 "2011-04-02T23:48:45Z")

</div>

Hello all, I recently released a gem that assists in testing XML nodes for equivalency, and thought it might be of interest to the RSpec community. It can normalize whitespace (or not), ignore element order (or not),…

---

## [Can't put shared example group in its own file](https://www.ruby-forum.com/t/cant-put-shared-example-group-in-its-own-file/205282)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 0\
**Last updated:** [April 2, 2011, 11:45pm UTC](https://www.ruby-forum.com/t/cant-put-shared-example-group-in-its-own-file/205282 "2011-04-02T23:45:40Z")

</div>

Any ideas? All I’d like to do is have two specs in different files use the same shared example group. I saw a similar thread about autotest, but I am not using that. \[Sorry for the double post on Google G.; didn’t rea…

---

## [Stubbing directly vs using stub method](https://www.ruby-forum.com/t/stubbing-directly-vs-using-stub-method/205274)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 3\
**Last updated:** [April 2, 2011, 9:34pm UTC](https://www.ruby-forum.com/t/stubbing-directly-vs-using-stub-method/205274 "2011-04-02T21:34:56Z")

</div>

I use RSpec mock and stub like this: hit = mock(“hit”, :stored =\> 5) This works fine, but when using this instead: hit = mock(“hit”).stub(:stored) { 5 } then I get undefined method \`stored’ for #\<RSpec::Mocks::Messa…

---

## [\[HOOKS\] spec\_helper aware of full test suite being run? After hook to run code after running all spe](https://www.ruby-forum.com/t/hooks-spec-helper-aware-of-full-test-suite-being-run-after-hook-to-run-code-after-running-all-spe/205151)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 7\
**Last updated:** [April 1, 2011, 6:57pm UTC](https://www.ruby-forum.com/t/hooks-spec-helper-aware-of-full-test-suite-being-run-after-hook-to-run-code-after-running-all-spe/205151 "2011-04-01T18:57:18Z")

</div>

Sorry if multiple postings of this show up. I had to RTFM a few times before I figured out how to post correctly. I use VCR to record interactions, and when the recordings change filenames, and directory structure, …

---

## [Test Design Question #1](https://www.ruby-forum.com/t/test-design-question-1/205149)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 1\
**Last updated:** [March 31, 2011, 10:03am UTC](https://www.ruby-forum.com/t/test-design-question-1/205149 "2011-03-31T10:03:32Z")

</div>

I have an model in rails with an after\_create that generates another object (for the purpose of making an audit trail). In the unit test - i want to verify this behavior. This behaviour - in other tests is breaking so…

---

## [Test Design Question #2](https://www.ruby-forum.com/t/test-design-question-2/205148)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [March 31, 2011, 10:03am UTC](https://www.ruby-forum.com/t/test-design-question-2/205148 "2011-03-31T10:03:32Z")

</div>

I am designing a test around a class that interacts with TCPSocket - I have used a mock and have asserted as minimal an interface as I can - centered around the IO methods. Should i be using a stub instead and stub on…

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

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