# RSpec

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

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

---

## [Re: Where do a set the description on a should satisfy](https://www.ruby-forum.com/t/re-where-do-a-set-the-description-on-a-should-satisfy/195650)

<div class="topic-metadata">

**Author:** [@destiney](https://www.ruby-forum.com/u/destiney)\
**Replies:** 0\
**Last updated:** [September 27, 2010, 4:00pm UTC](https://www.ruby-forum.com/t/re-where-do-a-set-the-description-on-a-should-satisfy/195650 "2010-09-27T16:00:41Z")

</div>

\---- David C. removed\_email\_address@domain.invalid wrote: in spec/spec\_helper.rb RSpec.configure do |c| c.include CustomMatchers end Make sense? Yes. Thanks. GregD

---

## [Cucumber generator error in rails 3](https://www.ruby-forum.com/t/cucumber-generator-error-in-rails-3/195623)

<div class="topic-metadata">

**Author:** [@Senthil\_kumar\_L](https://www.ruby-forum.com/u/Senthil_kumar_L)\
**Replies:** 3\
**Last updated:** [September 27, 2010, 10:31am UTC](https://www.ruby-forum.com/t/cucumber-generator-error-in-rails-3/195623 "2010-09-27T10:31:36Z")

</div>

I have my Gem file as mentioned in the github gem ‘capybara’ gem ‘database\_cleaner’ gem ‘cucumber-rails’ gem ‘cucumber’ gem ‘rspec-rails’ gem ‘spork’ gem 'launchy but when i give rails generate cucumber:install, …

---

## [Rspec runner setting $KCODE considered harmful?](https://www.ruby-forum.com/t/rspec-runner-setting-kcode-considered-harmful/195428)

<div class="topic-metadata">

**Author:** [@Josh\_Whiting](https://www.ruby-forum.com/u/Josh_Whiting)\
**Replies:** 2\
**Last updated:** [September 24, 2010, 12:25am UTC](https://www.ruby-forum.com/t/rspec-runner-setting-kcode-considered-harmful/195428 "2010-09-24T00:25:42Z")

</div>

I ran across a problem today in which some code ran fine in regular operation but failed in a test case. I scratched my head and thought “why would running from within the test harness change the behavior of my code?…

---

## [\[Cross Post\] Volunteers and Teachers \<3 October 22-23 Rails Outreach for Women](https://www.ruby-forum.com/t/cross-post-volunteers-and-teachers-3-october-22-23-rails-outreach-for-women/195484)

<div class="topic-metadata">

**Author:** [@Curtis\_j\_Schofield](https://www.ruby-forum.com/u/Curtis_j_Schofield)\
**Replies:** 0\
**Last updated:** [September 23, 2010, 7:35pm UTC](https://www.ruby-forum.com/t/cross-post-volunteers-and-teachers-3-october-22-23-rails-outreach-for-women/195484 "2010-09-23T19:35:19Z")

</div>

\[Forgive the Crosspost - this is a community mailout \] What: October 22-23 Rails Outreach for Women URL: http://www.meetup.com/sfruby/calendar/14835957/ Short: Wanted : Rails, BDD/TDD, Cucumber, Ruby Teachers / Volu…

---

## [Cucumber Test - not strictly RSpec but testing related](https://www.ruby-forum.com/t/cucumber-test-not-strictly-rspec-but-testing-related/195450)

<div class="topic-metadata">

**Author:** [@dgaj](https://www.ruby-forum.com/u/dgaj)\
**Replies:** 1\
**Last updated:** [September 23, 2010, 3:34pm UTC](https://www.ruby-forum.com/t/cucumber-test-not-strictly-rspec-but-testing-related/195450 "2010-09-23T15:34:04Z")

</div>

I am trying to test a webpage in cucumber that opens a new browser window, I have a feature like … When I click the “transfer” button Then the user should see the “transfer” page I am having trouble with the second s…

---

## [Is this a bug? (before(:all) and after(:all) are run for each subcontext)](https://www.ruby-forum.com/t/is-this-a-bug-before-all-and-after-all-are-run-for-each-subcontext/195426)

<div class="topic-metadata">

**Author:** [@MGMGMG](https://www.ruby-forum.com/u/MGMGMG)\
**Replies:** 1\
**Last updated:** [September 23, 2010, 6:14am UTC](https://www.ruby-forum.com/t/is-this-a-bug-before-all-and-after-all-are-run-for-each-subcontext/195426 "2010-09-23T06:14:24Z")

</div>

Rspec version is 1.3.0 Given following spec code: describe "SomeModule" do before(:all) { puts "BEFORE" } after(:all) { puts "AFTER"; puts } context "One" do it "should puts A" do puts "A" end it "shoul…

---

## [Failure/Error: Unable to find matching line from backtrace can't convert nil into String](https://www.ruby-forum.com/t/failure-error-unable-to-find-matching-line-from-backtrace-cant-convert-nil-into-string/195354)

<div class="topic-metadata">

**Author:** [@bcardoso](https://www.ruby-forum.com/u/bcardoso)\
**Replies:** 4\
**Last updated:** [September 22, 2010, 3:55pm UTC](https://www.ruby-forum.com/t/failure-error-unable-to-find-matching-line-from-backtrace-cant-convert-nil-into-string/195354 "2010-09-22T15:55:05Z")

</div>

I’m getting this errors from this spec: http://pastie.org/private/lm9nrqnmhqobs1avf3skgw Failures: Account Account should have a relation belongs to with customer Failure/Error: Unable to find matching line from ba…

---

## [RSpec beta 22 with Rails 3](https://www.ruby-forum.com/t/rspec-beta-22-with-rails-3/195296)

<div class="topic-metadata">

**Author:** [@anagri](https://www.ruby-forum.com/u/anagri)\
**Replies:** 3\
**Last updated:** [September 22, 2010, 7:42am UTC](https://www.ruby-forum.com/t/rspec-beta-22-with-rails-3/195296 "2010-09-22T07:42:04Z")

</div>

I am working on a Rails 3 application. Recently bundler got an update for rspec, which upgraded it to 22, (previously we were using beta 20). After the update we are unable to run the old using ‘rake spec:rcov’, whil…

---

## [Undefined method \`has\_selector?' for "":String](https://www.ruby-forum.com/t/undefined-method-has-selector-for-string/195205)

<div class="topic-metadata">

**Author:** [@lord\_raiden](https://www.ruby-forum.com/u/lord_raiden)\
**Replies:** 7\
**Last updated:** [September 22, 2010, 5:11am UTC](https://www.ruby-forum.com/t/undefined-method-has-selector-for-string/195205 "2010-09-22T05:11:16Z")

</div>

I’m running rails 3.0.0 on ruby 1.9.2p0. I’ve rspec beta 22 with Capybara 0.3.9. NO WEBRAT. I’m unable to use 'rendered.should have\_selector(‘a’) in my view specs. home/\_menu.erb should add a link to home first Fail…

---

## [Options for .rspec, or a verbose mode?](https://www.ruby-forum.com/t/options-for-rspec-or-a-verbose-mode/195352)

<div class="topic-metadata">

**Author:** [@rodrigo3n](https://www.ruby-forum.com/u/rodrigo3n)\
**Replies:** 3\
**Last updated:** [September 22, 2010, 3:43am UTC](https://www.ruby-forum.com/t/options-for-rspec-or-a-verbose-mode/195352 "2010-09-22T03:43:52Z")

</div>

Hello everybody, in my app, (using rspec 2.0.0.beta22) I have my .rspec file with “–colour” in it., I want to know if are there any other options for this file? And I wanna know if is there a verbose mode of running m…

---

## [Rspec-rails 1.3.2 tests get loaded, but not executed](https://www.ruby-forum.com/t/rspec-rails-1-3-2-tests-get-loaded-but-not-executed/195355)

<div class="topic-metadata">

**Author:** [@simo](https://www.ruby-forum.com/u/simo)\
**Replies:** 0\
**Last updated:** [September 22, 2010, 3:38am UTC](https://www.ruby-forum.com/t/rspec-rails-1-3-2-tests-get-loaded-but-not-executed/195355 "2010-09-22T03:38:36Z")

</div>

Hello, Can anyone please help me with the following issue I am running rspec-rails 1.3.2 with rails 2.3.9 on ruby 1.8.7 Unfortunately my tests don’t execute at all after i updated these gems although i followed the u…

---

## [Conditional before() blocks in spec\_helper based on metadata?](https://www.ruby-forum.com/t/conditional-before-blocks-in-spec-helper-based-on-metadata/195353)

<div class="topic-metadata">

**Author:** [@johnf](https://www.ruby-forum.com/u/johnf)\
**Replies:** 1\
**Last updated:** [September 22, 2010, 3:33am UTC](https://www.ruby-forum.com/t/conditional-before-blocks-in-spec-helper-based-on-metadata/195353 "2010-09-22T03:33:55Z")

</div>

I have some tests that need to load my application’s seed data prior to running, and others that don’t. It’s a well-defined set of examples: describe "needs seed data", :needs\_data =\> true do ... end What can I pu…

---

## [How do I test my Module?](https://www.ruby-forum.com/t/how-do-i-test-my-module/195309)

<div class="topic-metadata">

**Author:** [@mydarkpassenger](https://www.ruby-forum.com/u/mydarkpassenger)\
**Replies:** 2\
**Last updated:** [September 21, 2010, 4:07pm UTC](https://www.ruby-forum.com/t/how-do-i-test-my-module/195309 "2010-09-21T16:07:58Z")

</div>

I think I understand basic Class testing, however, how do I test a Module’s behavior especially (in my case) where the Module will be used as an extension primarily e.g. object.extend MyModule.

---

## [Spec for derived classes question](https://www.ruby-forum.com/t/spec-for-derived-classes-question/195267)

<div class="topic-metadata">

**Author:** [@mydarkpassenger](https://www.ruby-forum.com/u/mydarkpassenger)\
**Replies:** 2\
**Last updated:** [September 21, 2010, 2:38pm UTC](https://www.ruby-forum.com/t/spec-for-derived-classes-question/195267 "2010-09-21T14:38:54Z")

</div>

I assume spec tests be repeated for derived classes? Is there such a thing in rspec as deriving specs?

---

## [\[Problem\] Rails 3 + RSpec 2 beta 22 with JRuby 1.5.2](https://www.ruby-forum.com/t/problem-rails-3-rspec-2-beta-22-with-jruby-1-5-2/195236)

<div class="topic-metadata">

**Author:** [@bcardoso](https://www.ruby-forum.com/u/bcardoso)\
**Replies:** 3\
**Last updated:** [September 20, 2010, 5:27pm UTC](https://www.ruby-forum.com/t/problem-rails-3-rspec-2-beta-22-with-jruby-1-5-2/195236 "2010-09-20T17:27:13Z")

</div>

Hi, I created a clean rails 3 project and installed rspec 2 beta 22, created a simple test case and run all my test using “rake spec”, i get this error: D:/ruby/rubies/jruby-1.5.2/bin/jruby.bat -S bundle exec rspec …

---

## [Behavior of object.foo(x) when you've stubbed it using object.stub(:foo).with(y)](https://www.ruby-forum.com/t/behavior-of-object-foo-x-when-youve-stubbed-it-using-object-stub-foo-with-y/195218)

<div class="topic-metadata">

**Author:** [@Myron\_M](https://www.ruby-forum.com/u/Myron_M)\
**Replies:** 1\
**Last updated:** [September 20, 2010, 2:13am UTC](https://www.ruby-forum.com/t/behavior-of-object-foo-x-when-youve-stubbed-it-using-object-stub-foo-with-y/195218 "2010-09-20T02:13:04Z")

</div>

The current behavior of rspec-mocks causes a NoMethodError when you call object.foo(x) after setting up a stub using object.stub(:foo).with(y). Here’s an example for when this has caused me a problem: In a before(:…

---

## [How to use RSpec 2 with Sinatra 1.0](https://www.ruby-forum.com/t/how-to-use-rspec-2-with-sinatra-1-0/195204)

<div class="topic-metadata">

**Author:** [@olistik](https://www.ruby-forum.com/u/olistik)\
**Replies:** 1\
**Last updated:** [September 19, 2010, 8:22pm UTC](https://www.ruby-forum.com/t/how-to-use-rspec-2-with-sinatra-1-0/195204 "2010-09-19T20:22:28Z")

</div>

Hello, I am trying to use RSpec 2 with a Sinatra 1.0 application, but I have no idea about whether they are compatible or not. I tried this: in $SINATRA\_APP\_ROOT/app.rb: require ‘sinatra’ set :app\_file, FILE set :r…

---

## [Is it Mailing list on github for oauth on twitter](https://www.ruby-forum.com/t/is-it-mailing-list-on-github-for-oauth-on-twitter/195178)

<div class="topic-metadata">

**Author:** [@babar\_shahzad](https://www.ruby-forum.com/u/babar_shahzad)\
**Replies:** 3\
**Last updated:** [September 19, 2010, 7:01pm UTC](https://www.ruby-forum.com/t/is-it-mailing-list-on-github-for-oauth-on-twitter/195178 "2010-09-19T19:01:39Z")

</div>

Helo dear list members, Can you kindly confirm me that its the correct list I subscribed to. I want help in twitter oauth. I am using abraham williams’ library. If something wrong, I will be very thankful if you cou…

---

## [\[Rails\] rails view helpers, BDD, and what to mock](https://www.ruby-forum.com/t/rails-rails-view-helpers-bdd-and-what-to-mock/195159)

<div class="topic-metadata">

**Author:** [@dougeverly](https://www.ruby-forum.com/u/dougeverly)\
**Replies:** 4\
**Last updated:** [September 18, 2010, 8:56pm UTC](https://www.ruby-forum.com/t/rails-rails-view-helpers-bdd-and-what-to-mock/195159 "2010-09-18T20:56:35Z")

</div>

Hi, I’m trying to understand BDD and proper testing technique. I’m testing a rails view helper method that checks user roles to see if a link should be shown. I’m using rails 2.3.8 and rspec version 1.3.0. My helper…

---

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

<div class="topic-metadata">

**Author:** [@Brennon\_B](https://www.ruby-forum.com/u/Brennon_B)\
**Replies:** 1\
**Last updated:** [September 18, 2010, 4:32pm UTC](https://www.ruby-forum.com/t/testing-forms/195182 "2010-09-18T16:32:36Z")

</div>

I’m testing a view that renders a form to edit an object. I’d like to test that the form correctly populates the form with the object’s attributes’ current values. I tried several variations on mock\_model and stub\_m…

---

## [Controller spec with devise](https://www.ruby-forum.com/t/controller-spec-with-devise/193917)

<div class="topic-metadata">

**Author:** [@titinux](https://www.ruby-forum.com/u/titinux)\
**Replies:** 19\
**Last updated:** [September 18, 2010, 4:30pm UTC](https://www.ruby-forum.com/t/controller-spec-with-devise/193917 "2010-09-18T16:30:16Z")

</div>

Hello, I’m new in using RSpec and I can’t figured out to spec this controller action. class OrdersController \< ApplicationController before\_filter :authenticate\_user! def index respond\_with(@orders = current\_user.o…

---

## [Trying to spec all models](https://www.ruby-forum.com/t/trying-to-spec-all-models/183279)

<div class="topic-metadata">

**Author:** [@pkoebbe](https://www.ruby-forum.com/u/pkoebbe)\
**Replies:** 8\
**Last updated:** [September 17, 2010, 4:29pm UTC](https://www.ruby-forum.com/t/trying-to-spec-all-models/183279 "2010-09-17T16:29:51Z")

</div>

When I do script/spec -c -f n spec/models/\*\*/\*\_spec.rb I get /Library/Ruby/Gems/1.8/gems/rspec-1.3.0/lib/spec/runner/options.rb:283:in \`files\_to\_load’: File or directory not found: spec/models/\*\*/\*\_spec.rb (Runtime…

---

## [Rspec-rails 2.0.0.beta.22 + Rails 3 don't generate spec/controllers/](https://www.ruby-forum.com/t/rspec-rails-2-0-0-beta-22-rails-3-dont-generate-spec-controllers/195138)

<div class="topic-metadata">

**Author:** [@xela](https://www.ruby-forum.com/u/xela)\
**Replies:** 3\
**Last updated:** [September 17, 2010, 3:54pm UTC](https://www.ruby-forum.com/t/rspec-rails-2-0-0-beta-22-rails-3-dont-generate-spec-controllers/195138 "2010-09-17T15:54:42Z")

</div>

Hello, I’ve set up rails 3 with rspec-rails 2.0.0.beta.22. When generating a controller, like so: rails generate controller Users new no spec/controllers get generated. However, when I do: rails generate scaffold U…

---

## [\[rails\] url\_for host and protocol not set when full spec suite run](https://www.ruby-forum.com/t/rails-url-for-host-and-protocol-not-set-when-full-spec-suite-run/195045)

<div class="topic-metadata">

**Author:** [@mrkohrea](https://www.ruby-forum.com/u/mrkohrea)\
**Replies:** 4\
**Last updated:** [September 16, 2010, 8:57am UTC](https://www.ruby-forum.com/t/rails-url-for-host-and-protocol-not-set-when-full-spec-suite-run/195045 "2010-09-16T08:57:16Z")

</div>

rspec (2.0.0.beta.19) rails (3.0.0) authlogic (2.1.6) bartt-ssl\_requirement (1.2.3) RUBYGEMS VERSION: 1.3.7 RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174) \[i686-darwin10.4.0\] Hi, I’m getting different results whe…

---

## [Variable strange change](https://www.ruby-forum.com/t/variable-strange-change/195011)

<div class="topic-metadata">

**Author:** [@rubyernewbie](https://www.ruby-forum.com/u/rubyernewbie)\
**Replies:** 2\
**Last updated:** [September 16, 2010, 7:23am UTC](https://www.ruby-forum.com/t/variable-strange-change/195011 "2010-09-16T07:23:36Z")

</div>

class User has\_many :mads def mad Mad.find\_by\_user\_id(id) end end class God belongs\_to :mad belongs\_to :user belongs\_to :sender, :class\_name =\> “User”, :foreign\_key =\> “sender\_id” def strange\_change! God.trans…

---

## [Specs inside subfolder of lib folder not displaying proper error messages](https://www.ruby-forum.com/t/specs-inside-subfolder-of-lib-folder-not-displaying-proper-error-messages/195034)

<div class="topic-metadata">

**Author:** [@Manish\_Manchanda](https://www.ruby-forum.com/u/Manish_Manchanda)\
**Replies:** 1\
**Last updated:** [September 15, 2010, 5:24pm UTC](https://www.ruby-forum.com/t/specs-inside-subfolder-of-lib-folder-not-displaying-proper-error-messages/195034 "2010-09-15T17:24:50Z")

</div>

hi im facing this issue in which if i place a failing spec inside a subfolder of my lib folder then along with the error message the file name and the line number is not shown. output as below: ‘Test one’ FAILED e…

---

## [Rspec and rails: Problems while testing libraries in the lib directory](https://www.ruby-forum.com/t/rspec-and-rails-problems-while-testing-libraries-in-the-lib-directory/195032)

<div class="topic-metadata">

**Author:** [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Replies:** 1\
**Last updated:** [September 15, 2010, 3:46pm UTC](https://www.ruby-forum.com/t/rspec-and-rails-problems-while-testing-libraries-in-the-lib-directory/195032 "2010-09-15T15:46:30Z")

</div>

I have some classes in the lib directory, and I want to test it. My class which I want to test looks like: class StatAggregation class \<\< self def skills\_rate(user\_id) user\_id = User.find\_by\_id(user\_id) … end end …

---

## [Propagating settings to subtyped ExampleGroups](https://www.ruby-forum.com/t/propagating-settings-to-subtyped-examplegroups/194950)

<div class="topic-metadata">

**Author:** [@bct](https://www.ruby-forum.com/u/bct)\
**Replies:** 5\
**Last updated:** [September 14, 2010, 6:28pm UTC](https://www.ruby-forum.com/t/propagating-settings-to-subtyped-examplegroups/194950 "2010-09-14T18:28:06Z")

</div>

Hey, rspec 2 upgrade question. Rspec 1.x had a class hierarchy. In a Rails project, the ExampleGroup inherited from Test::Unit::TestCase. That allowed me to set use\_transactional\_fixtures in my own ExampleGroups and …

---

## [\[BDD\] NoMethodError raised when calling #stub with incorrect parameters](https://www.ruby-forum.com/t/bdd-nomethoderror-raised-when-calling-stub-with-incorrect-parameters/194948)

<div class="topic-metadata">

**Author:** [@nicholas-henry](https://www.ruby-forum.com/u/nicholas-henry)\
**Replies:** 0\
**Last updated:** [September 14, 2010, 6:12am UTC](https://www.ruby-forum.com/t/bdd-nomethoderror-raised-when-calling-stub-with-incorrect-parameters/194948 "2010-09-14T06:12:16Z")

</div>

I’m new to RSpec and came across an interesting situation where calling a stubbed method with different parameters from those specified, raises a misleading error. Some code to illustrate: (rspec 1.3.0) describe Pers…

---

## [\[BDD\] NoMethodError raised when calling #stub with incorrect parameters](https://www.ruby-forum.com/t/bdd-nomethoderror-raised-when-calling-stub-with-incorrect-parameters/194947)

<div class="topic-metadata">

**Author:** [@nicholas-henry](https://www.ruby-forum.com/u/nicholas-henry)\
**Replies:** 0\
**Last updated:** [September 14, 2010, 6:12am UTC](https://www.ruby-forum.com/t/bdd-nomethoderror-raised-when-calling-stub-with-incorrect-parameters/194947 "2010-09-14T06:12:16Z")

</div>

I’m new to RSpec and came across an interesting situation where calling a stubbed method with different parameters from those specified, raises a misleading error. Some code to illustrate: (rspec 1.3.0) describe Pers…

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

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