# RSpec

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

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

---

## [Writing a spec for HTTP OPTIONS verb](https://www.ruby-forum.com/t/writing-a-spec-for-http-options-verb/207359)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 6\
**Last updated:** [May 24, 2011, 10:15pm UTC](https://www.ruby-forum.com/t/writing-a-spec-for-http-options-verb/207359 "2011-05-24T22:15:42Z")

</div>

Hi I am new to rails and rspec. I am trying to write specs for a web service written in rails and found that firefox 3.6 makes an OPTIONS call to the server before making a POST. I want to write a spec for this beha…

---

## [Problems installing rspec 2.6](https://www.ruby-forum.com/t/problems-installing-rspec-2-6/207357)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 2\
**Last updated:** [May 24, 2011, 7:58pm UTC](https://www.ruby-forum.com/t/problems-installing-rspec-2-6/207357 "2011-05-24T19:58:56Z")

</div>

Hi, I’ve tried to install rspec on Mac OS X. I’m on Ruby 1.9.2p180. After gem install rspec and then rspec --help I get the following messages: lily:BDD berndblume-o$ rspec --help Invalid gemspec in \[/Users/ber…

---

## [How to spec Rails view partials in shared folders](https://www.ruby-forum.com/t/how-to-spec-rails-view-partials-in-shared-folders/207142)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 2\
**Last updated:** [May 24, 2011, 2:20am UTC](https://www.ruby-forum.com/t/how-to-spec-rails-view-partials-in-shared-folders/207142 "2011-05-24T02:20:42Z")

</div>

Hi all Would very much appreciate any assistance with this. Have Googled it but can’t find an answer to it. I’m using Rails3/Rspec2 I’m spec’ing a view which is a partial called ‘shared/\_panels’. When I try to spec …

---

## [Bypass db:test:prepare but still load test db](https://www.ruby-forum.com/t/bypass-dbprepare-but-still-load-test-db/207323)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 6\
**Last updated:** [May 24, 2011, 12:02am UTC](https://www.ruby-forum.com/t/bypass-dbprepare-but-still-load-test-db/207323 "2011-05-24T00:02:13Z")

</div>

We have a development database that has quite a few non-Rails convention names for tables and fields. Also we have quite a few primary-foreign key relationships. This database has been inherited from a legacy system…

---

## [Get detailed info about error](https://www.ruby-forum.com/t/get-detailed-info-about-error/207294)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [May 22, 2011, 11:21pm UTC](https://www.ruby-forum.com/t/get-detailed-info-about-error/207294 "2011-05-22T23:21:48Z")

</div>

Hello ! I just got this RSpec message: Failures: Position just created should unmake correctly Failure/Error: lambda { @p.unmake }.should\_not raise\_error expected no Exception, got #\<NoMethodError: undefined method…

---

## [Trying to get rspec-rails working](https://www.ruby-forum.com/t/trying-to-get-rspec-rails-working/207275)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 0\
**Last updated:** [May 22, 2011, 4:17pm UTC](https://www.ruby-forum.com/t/trying-to-get-rspec-rails-working/207275 "2011-05-22T16:17:41Z")

</div>

Hi, I have a rails 2.3.3 app I am migrating to 2.3.11. In the process I am adding bundler support. When I add rspec and rspec rails (1.3.4) to my gemfile, then try to install rspec-rails per the instructions (here G…

---

## [Getting color to work with jruby](https://www.ruby-forum.com/t/getting-color-to-work-with-jruby/200074)

<div class="topic-metadata">

**Author:** [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Replies:** 1\
**Last updated:** [May 21, 2011, 1:21pm UTC](https://www.ruby-forum.com/t/getting-color-to-work-with-jruby/200074 "2011-05-21T13:21:16Z")

</div>

I’m having issues getting color to work when I’m running my tests. I’m writing a gem and using RSpec 2.1.0. I’m using JRuby-1.5.3 installed by RVM on OSX10.6 I have a rake task defined like so: Rspec::Core::RakeTask…

---

## [Controller testing - it doesn't print if given some print value](https://www.ruby-forum.com/t/controller-testing-it-doesnt-print-if-given-some-print-value/207249)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [May 21, 2011, 1:17pm UTC](https://www.ruby-forum.com/t/controller-testing-it-doesnt-print-if-given-some-print-value/207249 "2011-05-21T13:17:34Z")

</div>

I am working on Rspec2.5.0 with rails 3.0.6 . And I was successfully able to complete model testing. But when I come to controller part I wanted to see whether some variable getting generated & I have given My Control…

---

## [Rspec help for create user test](https://www.ruby-forum.com/t/rspec-help-for-create-user-test/207169)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 1\
**Last updated:** [May 19, 2011, 10:22pm UTC](https://www.ruby-forum.com/t/rspec-help-for-create-user-test/207169 "2011-05-19T22:22:30Z")

</div>

My user controllers ‘create’ action looks like: def create @user = User.new(params\[:user\]) @user.user\_name = params\[:user\]\[:user\_name\] @user.email = params\[:user\]\[:email\] if @user.is\_valid? @user.status = 2 @user.…

---

## [JSON matcher](https://www.ruby-forum.com/t/json-matcher/164891)

<div class="topic-metadata">

**Author:** [@wickie](https://www.ruby-forum.com/u/wickie)\
**Replies:** 3\
**Last updated:** [May 19, 2011, 10:03pm UTC](https://www.ruby-forum.com/t/json-matcher/164891 "2011-05-19T22:03:17Z")

</div>

Curiously, there doesn’t seem to be a matcher around that matches a JSON string against an expected ruby object. Below is what I’ve come up with, including some Rails idiosyncrasies. Any suggestions for improvements? …

---

## [Rake spec fails where rake spec:(models|controllers|views) pass](https://www.ruby-forum.com/t/rake-spec-fails-where-rake-spec-models-controllers-views-pass/206146)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [May 19, 2011, 8:08pm UTC](https://www.ruby-forum.com/t/rake-spec-fails-where-rake-spec-models-controllers-views-pass/206146 "2011-05-19T20:08:22Z")

</div>

I’m still trying to work into Ruby 1.9.2 and am now experiencing something that makes no sense to me. Using rspec 1.3.2 and rspec-rails 1.3.4 with rails 2.3.11 on ruby 1.9.2-p180, when I $ rake spec:models they all p…

---

## [Rspec-core-2.6.1 is released!](https://www.ruby-forum.com/t/rspec-core-2-6-1-is-released/207160)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 0\
**Last updated:** [May 19, 2011, 5:36pm UTC](https://www.ruby-forum.com/t/rspec-core-2-6-1-is-released/207160 "2011-05-19T17:36:21Z")

</div>

rspec-core-2.6.1 is released! This is a bug fix release, restoring integration with with rcov. full changelog: Bug fixes Don’t extend nil when filters are nil require 'rspec/autorun' when running rcov.

---

## [Reusing Spec's](https://www.ruby-forum.com/t/reusing-specs/207114)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 6\
**Last updated:** [May 19, 2011, 4:05am UTC](https://www.ruby-forum.com/t/reusing-specs/207114 "2011-05-19T04:05:49Z")

</div>

Hello, Is there any way to reuse spec definitions, perhaps through some kind of inheritance? For example, in rails, every time it generates a Spec I must tell it to Include Devise::TestHelpers Log the user in, so th…

---

## [RSpec stub question](https://www.ruby-forum.com/t/rspec-stub-question/207087)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 1\
**Last updated:** [May 18, 2011, 6:12am UTC](https://www.ruby-forum.com/t/rspec-stub-question/207087 "2011-05-18T06:12:59Z")

</div>

Hi I am using Mongoid. In Mongoid while saving a record we typically give like in the controller @post.safely.save For a model class Post I am writing rspecs for my controller and want to mock the model. So what I …

---

## [Adding Heckle Support](https://www.ruby-forum.com/t/adding-heckle-support/207089)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 0\
**Last updated:** [May 18, 2011, 5:54am UTC](https://www.ruby-forum.com/t/adding-heckle-support/207089 "2011-05-18T05:54:29Z")

</div>

Hi Everyone, I read in an earlier thread \[1\] that there are no plans at this time to add official support for Heckle in RSpec 2. I was thinking that perhaps there might be room for an unofficial extension to add supp…

---

## [Rspec2 - have\_rjs](https://www.ruby-forum.com/t/rspec2-have-rjs/207038)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [May 16, 2011, 8:31pm UTC](https://www.ruby-forum.com/t/rspec2-have-rjs/207038 "2011-05-16T20:31:59Z")

</div>

Hi, Updating a rails app to Rails3/rspec2 and have a spec using “have\_rjs” or “has\_rjs?” - is there an rspec2 version or alternative? Have found no useful answer from usual searches. Thanks,

---

## [Using rspec and factory\_girl, how to get around attributes that can't be set b/c of attr\_accessible](https://www.ruby-forum.com/t/using-rspec-and-factory-girl-how-to-get-around-attributes-that-cant-be-set-b-c-of-attr-accessible/207034)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [May 16, 2011, 6:44pm UTC](https://www.ruby-forum.com/t/using-rspec-and-factory-girl-how-to-get-around-attributes-that-cant-be-set-b-c-of-attr-accessible/207034 "2011-05-16T18:44:27Z")

</div>

class User \< ActiveRecord::Base attr\_accessor :password, :password\_confirmation attr\_accessible :password, :password\_confirmation, … validates :password, :presence =\> true, :confirmation =\> true, :length =\> { :with…

---

## [Shared context styles](https://www.ruby-forum.com/t/shared-context-styles/206888)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 0\
**Last updated:** [May 12, 2011, 4:30pm UTC](https://www.ruby-forum.com/t/shared-context-styles/206888 "2011-05-12T16:30:37Z")

</div>

Hi, I was taking a look at the shared contexts in the release of RSpec (2.6.0) and thought a nested style might be a nice way of expressing the same thing. Like how describes and contexts can be nested: I’m not com…

---

## [Re-executing rspec tests in existing JRuby container](https://www.ruby-forum.com/t/re-executing-rspec-tests-in-existing-jruby-container/206676)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 4\
**Last updated:** [May 11, 2011, 9:59pm UTC](https://www.ruby-forum.com/t/re-executing-rspec-tests-in-existing-jruby-container/206676 "2011-05-11T21:59:29Z")

</div>

I have a JRuby Servlet environment very much like the “Parse Once, Eval Many Times on Servlet” example at http://kenai.com/projects/jruby/pages/RedBridgeServletExamples. What I am trying to do is execute an rspec test…

---

## [Cucumber and rspec, do cucumber step definitions use rspec?](https://www.ruby-forum.com/t/cucumber-and-rspec-do-cucumber-step-definitions-use-rspec/206764)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 6\
**Last updated:** [May 10, 2011, 7:14pm UTC](https://www.ruby-forum.com/t/cucumber-and-rspec-do-cucumber-step-definitions-use-rspec/206764 "2011-05-10T19:14:22Z")

</div>

I’m a bit confused as to how cucumber and rspec integrate (if they d at all?). You write a cucumber feature, and step definitions. Now in the step definitions, do you write rspec in the step definitions or do they s…

---

## [Rails3: setting session\[:session\_id\] for requests testing](https://www.ruby-forum.com/t/rails3-setting-session-session-id-for-requests-testing/206786)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 1\
**Last updated:** [May 10, 2011, 3:49am UTC](https://www.ruby-forum.com/t/rails3-setting-session-session-id-for-requests-testing/206786 "2011-05-10T03:49:49Z")

</div>

My app has some logic that permits some actions before the user logs in, and I depend upon session\[:session\_id\] as a handle for some state. My requests testing fails because session\[:session\_id\] is null. I attempted …

---

## [When mocking, does it scan the method being tested for outside calls?](https://www.ruby-forum.com/t/when-mocking-does-it-scan-the-method-being-tested-for-outside-calls/206679)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 1\
**Last updated:** [May 7, 2011, 5:02pm UTC](https://www.ruby-forum.com/t/when-mocking-does-it-scan-the-method-being-tested-for-outside-calls/206679 "2011-05-07T17:02:01Z")

</div>

Say I want to test this method: def modify\_user\_status(user\_id) … … user = User.find(user\_id) … … end Now could I mock the call to User.find()? I’m just trying to understand, when I run the test, and say I mocke…

---

## [Best way to test validates\_acceptance\_of](https://www.ruby-forum.com/t/best-way-to-test-validates-acceptance-of/206674)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [May 7, 2011, 4:31pm UTC](https://www.ruby-forum.com/t/best-way-to-test-validates-acceptance-of/206674 "2011-05-07T16:31:43Z")

</div>

Hello, I am trying to write a test to make sure that the property validates\_acceptance\_of is present on a model. In my exploration, I can’t seem to make a test that fails when this property is absent, then passes wh…

---

## [Am I speccing it wrong?](https://www.ruby-forum.com/t/am-i-speccing-it-wrong/206678)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 1\
**Last updated:** [May 7, 2011, 4:24pm UTC](https://www.ruby-forum.com/t/am-i-speccing-it-wrong/206678 "2011-05-07T16:24:19Z")

</div>

I consider myself an intermediate-to-advanced rubyist and rails programmer. I’ve embraced TDD but sometimes wonder if I’m just doing it wrong. I feel like it can take me longer to get the specs done then should be n…

---

## [Rspec-2.6.0.rc6 is released!](https://www.ruby-forum.com/t/rspec-2-6-0-rc6-is-released/206640)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 0\
**Last updated:** [May 6, 2011, 2:02pm UTC](https://www.ruby-forum.com/t/rspec-2-6-0-rc6-is-released/206640 "2011-05-06T14:02:34Z")

</div>

We’re doing one more release candidate to update rspec-rails to work with rails-3.1.0.beta1. This will hopefully be the last release candidate, with a final release coming in just a few days. rspec-rails-2.6.0.rc6 fu…

---

## [Cucumber in Spanish?](https://www.ruby-forum.com/t/cucumber-in-spanish/206526)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 2\
**Last updated:** [May 6, 2011, 1:15am UTC](https://www.ruby-forum.com/t/cucumber-in-spanish/206526 "2011-05-06T01:15:34Z")

</div>

Hi All I’m trying to write test scenarios in Spanish with cucumber. But all my test are passing :frowning: I haven’t really used cucumber that much. Is there any setting that I’m missing. Where do I need to set that…

---

## [Api (class/method) renaming, will a simple controller test verify this?](https://www.ruby-forum.com/t/api-class-method-renaming-will-a-simple-controller-test-verify-this/206608)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [May 6, 2011, 1:14am UTC](https://www.ruby-forum.com/t/api-class-method-renaming-will-a-simple-controller-test-verify-this/206608 "2011-05-06T01:14:55Z")

</div>

I want my tests to fail if I rename a method in my /lib folder in a rails app. Say I have a class like: /lib /lib/formatter.rb class Formatter def self.do\_transforms(text) text end end And say I reference this…

---

## [Jruby PATH and RUBYOPTS integration](https://www.ruby-forum.com/t/jruby-path-and-rubyopts-integration/206609)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 0\
**Last updated:** [May 5, 2011, 8:51pm UTC](https://www.ruby-forum.com/t/jruby-path-and-rubyopts-integration/206609 "2011-05-05T20:51:21Z")

</div>

Hi, I download the last jruby version and install the rspec gem using jgem to install. After it, I export RUBYOPT=rubygems to guarantee that the spec can be found. Trying to run the spec by normal mode I got: jonat…

---

## [Distinguishing failed specs from failing to run the specs](https://www.ruby-forum.com/t/distinguishing-failed-specs-from-failing-to-run-the-specs/206552)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 0\
**Last updated:** [May 4, 2011, 6:39pm UTC](https://www.ruby-forum.com/t/distinguishing-failed-specs-from-failing-to-run-the-specs/206552 "2011-05-04T18:39:39Z")

</div>

Hi all, is it possible to find out if rspec failed to run the specs? I would like to add a notification to guard-rspec (an autospec replacement) that tells me something along the lines of “I could not run the specs be…

---

## [How can I execute rspec directly from ruby code?](https://www.ruby-forum.com/t/how-can-i-execute-rspec-directly-from-ruby-code/206351)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 2\
**Last updated:** [May 3, 2011, 9:05pm UTC](https://www.ruby-forum.com/t/how-can-i-execute-rspec-directly-from-ruby-code/206351 "2011-05-03T21:05:18Z")

</div>

Hi Can I execute rspec directly from ruby code? I would like to do it similar I can do using Test::Unit Test::Unit::UI::Console::TestRunner.run(MySuite.new(MyTestCase)) I was looking on internet how to execute it, bu…

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

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