# RSpec

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

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

---

## [Rspec gem vs "rspec plugin" vs "rspec-rails plugin"?](https://www.ruby-forum.com/t/rspec-gem-vs-rspec-plugin-vs-rspec-rails-plugin/152772)

<div class="topic-metadata">

**Author:** [@greg](https://www.ruby-forum.com/u/greg)\
**Replies:** 6\
**Last updated:** [November 8, 2008, 12:21am UTC](https://www.ruby-forum.com/t/rspec-gem-vs-rspec-plugin-vs-rspec-rails-plugin/152772 "2008-11-08T00:21:06Z")

</div>

Hi, I’ve got the rspec gem installed, as well as the two plugins “rspec” & “rspec-rails”. I can’t remember which is actual used and which isn’t for my rails app when I go “rake spec”? Anyone know? Could I remove ei…

---

## [Confusion At Failing Specs](https://www.ruby-forum.com/t/confusion-at-failing-specs/152838)

<div class="topic-metadata">

**Author:** [@rsl](https://www.ruby-forum.com/u/rsl)\
**Replies:** 0\
**Last updated:** [November 7, 2008, 10:59pm UTC](https://www.ruby-forum.com/t/confusion-at-failing-specs/152838 "2008-11-07T22:59:37Z")

</div>

Can someone please explain to me why this spec fails it “should work” do template.stub!(:render) template.should\_receive(:render).with(:partial =\> “foo”) render @template\_with\_render\_partial\_foo end but this spec p…

---

## [Deprecate integrate\_views, WDYT?](https://www.ruby-forum.com/t/deprecate-integrate-views-wdyt/152819)

<div class="topic-metadata">

**Author:** [@zdennis](https://www.ruby-forum.com/u/zdennis)\
**Replies:** 0\
**Last updated:** [November 7, 2008, 7:11pm UTC](https://www.ruby-forum.com/t/deprecate-integrate-views-wdyt/152819 "2008-11-07T19:11:20Z")

</div>

I posted a ticket to lighthouse: http://rspec.lighthouseapp.com/projects/5645-rspec/tickets/595-deprecate-integrate\_views Please put your comments and thoughts there, as that is the best place for that discussion. I w…

---

## [Hash / params causing errors](https://www.ruby-forum.com/t/hash-params-causing-errors/152752)

<div class="topic-metadata">

**Author:** [@ramontayag](https://www.ruby-forum.com/u/ramontayag)\
**Replies:** 3\
**Last updated:** [November 7, 2008, 4:32am UTC](https://www.ruby-forum.com/t/hash-params-causing-errors/152752 "2008-11-07T04:32:26Z")

</div>

Hey everyone, I’m trying to spec a controller and I can’t seem to get a test to pass because rspec seems to see the difference between params I expect and params that I pass. However, this comes from the same params …

---

## [Anyone able to explain logic behind "rake spec" startup (e.g. db:test:prepare =\> abort\_if\_pending\_mi](https://www.ruby-forum.com/t/anyone-able-to-explain-logic-behind-rake-spec-startup-e-g-dbprepare-abort-if-pending-mi/152678)

<div class="topic-metadata">

**Author:** [@greg](https://www.ruby-forum.com/u/greg)\
**Replies:** 8\
**Last updated:** [November 7, 2008, 2:14am UTC](https://www.ruby-forum.com/t/anyone-able-to-explain-logic-behind-rake-spec-startup-e-g-dbprepare-abort-if-pending-mi/152678 "2008-11-07T02:14:26Z")

</div>

anyone able to explain logic behind “rake spec” startup? i.e. the below steps & why things occur when they do Macintosh-2:myequity greg$ rake spec --trace (in /Users/greg/source/myequity) \*\* Invoke spec (first\_time) …

---

## [Cucumber docs](https://www.ruby-forum.com/t/cucumber-docs/152734)

<div class="topic-metadata">

**Author:** [@twaters](https://www.ruby-forum.com/u/twaters)\
**Replies:** 8\
**Last updated:** [November 7, 2008, 2:03am UTC](https://www.ruby-forum.com/t/cucumber-docs/152734 "2008-11-07T02:03:55Z")

</div>

Hi all, What is the best source for cucumber documentation. I did the rdoc thing but that was more of the API view. Is there any usage guides, etc. besides the examples and what you get when you download it or is the…

---

## [Verifying some understanding about manipulating DB data in before/after callbacks in RSpec](https://www.ruby-forum.com/t/verifying-some-understanding-about-manipulating-db-data-in-before-after-callbacks-in-rspec/152733)

<div class="topic-metadata">

**Author:** [@weyus](https://www.ruby-forum.com/u/weyus)\
**Replies:** 3\
**Last updated:** [November 6, 2008, 11:31pm UTC](https://www.ruby-forum.com/t/verifying-some-understanding-about-manipulating-db-data-in-before-after-callbacks-in-rspec/152733 "2008-11-06T23:31:47Z")

</div>

We had an after(:each) callback that looked like this: PurchaseOrder.find(:all).each {|po| DraftInvoice.find\_all\_by\_po\_number(po.po\_number).each {|di| di.destroy}} which we were hoping would reset some purchase order …

---

## [Mocking named\_scope utilization](https://www.ruby-forum.com/t/mocking-named-scope-utilization/148379)

<div class="topic-metadata">

**Author:** [@jmcervera](https://www.ruby-forum.com/u/jmcervera)\
**Replies:** 10\
**Last updated:** [November 6, 2008, 7:05pm UTC](https://www.ruby-forum.com/t/mocking-named-scope-utilization/148379 "2008-11-06T19:05:24Z")

</div>

Hello, I am having trouble to mock the chaining of named\_scope in the controller, also I would like to use will\_paginate. def index @things = Thing.allowed\_for(@current\_user).available.paginate :page =\> params\[:page…

---

## [Testing variables in controllers?](https://www.ruby-forum.com/t/testing-variables-in-controllers/152702)

<div class="topic-metadata">

**Author:** [@ramontayag](https://www.ruby-forum.com/u/ramontayag)\
**Replies:** 4\
**Last updated:** [November 6, 2008, 6:43pm UTC](https://www.ruby-forum.com/t/testing-variables-in-controllers/152702 "2008-11-06T18:43:40Z")

</div>

How do you test that your controller fetched the right records? I have an action that returns a different set of records based on whether or not the current\_user is the “owner” of the profile being viewed. Code is he…

---

## [How to avoid tests removing data that my migrations put in?](https://www.ruby-forum.com/t/how-to-avoid-tests-removing-data-that-my-migrations-put-in/152539)

<div class="topic-metadata">

**Author:** [@greg](https://www.ruby-forum.com/u/greg)\
**Replies:** 14\
**Last updated:** [November 6, 2008, 5:41pm UTC](https://www.ruby-forum.com/t/how-to-avoid-tests-removing-data-that-my-migrations-put-in/152539 "2008-11-06T17:41:15Z")

</div>

hi, I have an issue in that I have some reference data my migrations run in. However when running “rake spec” it seems to remove the data in the test database up front. What do you recommend to workaround this issue…

---

## [Parsing Variables from the RakeFile to spec\_helper](https://www.ruby-forum.com/t/parsing-variables-from-the-rakefile-to-spec-helper/152679)

<div class="topic-metadata">

**Author:** [@linux\_cat](https://www.ruby-forum.com/u/linux_cat)\
**Replies:** 3\
**Last updated:** [November 6, 2008, 4:49pm UTC](https://www.ruby-forum.com/t/parsing-variables-from-the-rakefile-to-spec-helper/152679 "2008-11-06T16:49:29Z")

</div>

Is this possible, i basically want to create a loop in my Rakefile which updates a variable in my spec file with every run the variable is something like: browser = ENV\[‘SELENIUM\_RC\_BROWSER’\] || “\*chrome” in my spec…

---

## [Caboosers drop RSpec](https://www.ruby-forum.com/t/caboosers-drop-rspec/152469)

<div class="topic-metadata">

**Author:** [@tomx](https://www.ruby-forum.com/u/tomx)\
**Replies:** 48\
**Last updated:** [November 6, 2008, 10:44am UTC](https://www.ruby-forum.com/t/caboosers-drop-rspec/152469 "2008-11-06T10:44:48Z")

</div>

Hi, Any responses to http://blog.caboo.se/articles/2008/11/4/we-ve-stopped-using-rspec ? How much of this is due to legitimate bugs/problems versus unfortunate circumstances? Feels kind of worrying that they haven’t …

---

## [Fwd: spec\_server not working](https://www.ruby-forum.com/t/fwd-spec-server-not-working/152257)

<div class="topic-metadata">

**Author:** [@vanderkerkoff](https://www.ruby-forum.com/u/vanderkerkoff)\
**Replies:** 6\
**Last updated:** [November 6, 2008, 12:02am UTC](https://www.ruby-forum.com/t/fwd-spec-server-not-working/152257 "2008-11-06T00:02:17Z")

</div>

I can’t seem to get spec\_server to work correctly (I’ve never used it before, so maybe I’m missing something?) I start up spec\_server as prescribed: mdarby@macbook:~/Documents/apps/CCW: rake spec:server:start (in /Us…

---

## [Rake features and cucumber feature/name not producing same result](https://www.ruby-forum.com/t/rake-features-and-cucumber-feature-name-not-producing-same-result/152556)

<div class="topic-metadata">

**Author:** [@Mikel\_L](https://www.ruby-forum.com/u/Mikel_L)\
**Replies:** 5\
**Last updated:** [November 5, 2008, 11:55pm UTC](https://www.ruby-forum.com/t/rake-features-and-cucumber-feature-name-not-producing-same-result/152556 "2008-11-05T23:55:51Z")

</div>

Hi all. If I run rake features or cucumber features/\* I get one failing FIT scenario in one of my features. If I then run that feature that contains the FIT table with the failing scenario manually, it passes. I ru…

---

## [RSpec whines when I set the value of an object](https://www.ruby-forum.com/t/rspec-whines-when-i-set-the-value-of-an-object/152631)

<div class="topic-metadata">

**Author:** [@fipa](https://www.ruby-forum.com/u/fipa)\
**Replies:** 9\
**Last updated:** [November 5, 2008, 9:53pm UTC](https://www.ruby-forum.com/t/rspec-whines-when-i-set-the-value-of-an-object/152631 "2008-11-05T21:53:22Z")

</div>

In have the following code: def index @items = Item.find\_for\_payment(session\[:order\_id\], @site.id) @cart.amount = @items.sum { |item| item.price.to\_i \* item.quantity.to\_i } end @cart is set by a before\_filter calle…

---

## [Stubbing times: #from\_now et al](https://www.ruby-forum.com/t/stubbing-times-from-now-et-al/152627)

<div class="topic-metadata">

**Author:** [@nickh](https://www.ruby-forum.com/u/nickh)\
**Replies:** 7\
**Last updated:** [November 5, 2008, 9:33pm UTC](https://www.ruby-forum.com/t/stubbing-times-from-now-et-al/152627 "2008-11-05T21:33:49Z")

</div>

I had a look around for how to stub Time.now , #from\_now , etc, and came across this, which was useful: http://devblog.michaelgalero.com/2007/11/23/actioncontroller-rspec-stub-timenow/ Unfortunately, my situation is s…

---

## [Mulitbrowser selenium ruby](https://www.ruby-forum.com/t/mulitbrowser-selenium-ruby/151684)

<div class="topic-metadata">

**Author:** [@linux\_cat](https://www.ruby-forum.com/u/linux_cat)\
**Replies:** 2\
**Last updated:** [November 5, 2008, 6:35pm UTC](https://www.ruby-forum.com/t/mulitbrowser-selenium-ruby/151684 "2008-11-05T18:35:11Z")

</div>

Hope all is well, Striaght to the point I wonder if someone has any ideas to help me with the following problem: I have written an automation framework in ruby, that uses selenium and rspec and is run by an ant task,…

---

## [Design Pattern proposal for better Rails development](https://www.ruby-forum.com/t/design-pattern-proposal-for-better-rails-development/152602)

<div class="topic-metadata">

**Author:** [@fipa](https://www.ruby-forum.com/u/fipa)\
**Replies:** 16\
**Last updated:** [November 5, 2008, 5:27pm UTC](https://www.ruby-forum.com/t/design-pattern-proposal-for-better-rails-development/152602 "2008-11-05T17:27:53Z")

</div>

The biggest problems I have when developing (beside stupid typos) are: The name of a method which I often change to a supposedly more descriptive name, which I will eventually change to an even more supposedly descr…

---

## [How to stub the :current\_user and any methods associated with it](https://www.ruby-forum.com/t/how-to-stub-the-current-user-and-any-methods-associated-with-it/134064)

<div class="topic-metadata">

**Author:** [@newbie](https://www.ruby-forum.com/u/newbie)\
**Replies:** 14\
**Last updated:** [November 5, 2008, 3:41pm UTC](https://www.ruby-forum.com/t/how-to-stub-the-current-user-and-any-methods-associated-with-it/134064 "2008-11-05T15:41:53Z")

</div>

I’m new to Rspec and I’m having a bit of trouble with this controller that I’m testing. I think I’m doing it right but I guess my syntax is wrong. I’m currently using the “acts\_as\_authenticated” plug in. What I want …

---

## [No such file "spec/rake/spectask" even when rspec is install](https://www.ruby-forum.com/t/no-such-file-spec-rake-spectask-even-when-rspec-is-install/152595)

<div class="topic-metadata">

**Author:** [@rob](https://www.ruby-forum.com/u/rob)\
**Replies:** 1\
**Last updated:** [November 5, 2008, 1:47pm UTC](https://www.ruby-forum.com/t/no-such-file-spec-rake-spectask-even-when-rspec-is-install/152595 "2008-11-05T13:47:28Z")

</div>

Hi there, I wonder if anyone can help, I’ve recently moved a project over from using an old version of the rspec and rspec-rails plugins to using the gems. This worked seamlessly for both myself and another colleague.…

---

## [NoMethodError dependent on spec order](https://www.ruby-forum.com/t/nomethoderror-dependent-on-spec-order/152494)

<div class="topic-metadata">

**Author:** [@jimlast](https://www.ruby-forum.com/u/jimlast)\
**Replies:** 3\
**Last updated:** [November 5, 2008, 1:58am UTC](https://www.ruby-forum.com/t/nomethoderror-dependent-on-spec-order/152494 "2008-11-05T01:58:54Z")

</div>

Hello, Sometimes when we place expectations on class methods, the class methods seem to be not available in their previous form for other, later specs. Calling the class methods in other specs result in a no method e…

---

## [Problem with namespaced controller, form\_for, and view specs](https://www.ruby-forum.com/t/problem-with-namespaced-controller-form-for-and-view-specs/152550)

<div class="topic-metadata">

**Author:** [@caiwangqin](https://www.ruby-forum.com/u/caiwangqin)\
**Replies:** 0\
**Last updated:** [November 5, 2008, 1:46am UTC](https://www.ruby-forum.com/t/problem-with-namespaced-controller-form-for-and-view-specs/152550 "2008-11-05T01:46:38Z")

</div>

Hello, I have encountered a problem with the view tests involving a form\_for tag that references a namespaced controller. My controller is: class Admin::AuthenticationProvidersController \< ApplicationController The …

---

## [Problems stubbing @controller.stub!(:send)](https://www.ruby-forum.com/t/problems-stubbing-controller-stub-send/152531)

<div class="topic-metadata">

**Author:** [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Replies:** 2\
**Last updated:** [November 5, 2008, 1:34am UTC](https://www.ruby-forum.com/t/problems-stubbing-controller-stub-send/152531 "2008-11-05T01:34:20Z")

</div>

In one of my controller tests I’m testing a method which uses self.send() to do some pre-processing if that private method name is defined: # If this task requires some additional preperation then create a …

---

## [Cucumber: Why rake features needs to call db:test:prepare?](https://www.ruby-forum.com/t/cucumber-why-rake-features-needs-to-call-dbprepare/152543)

<div class="topic-metadata">

**Author:** [@fipa](https://www.ruby-forum.com/u/fipa)\
**Replies:** 3\
**Last updated:** [November 5, 2008, 1:19am UTC](https://www.ruby-forum.com/t/cucumber-why-rake-features-needs-to-call-dbprepare/152543 "2008-11-05T01:19:44Z")

</div>

I am missing something here. Using PostgreSQL, when I remove this line from the rake task, I don’t see the DB being populated although I do invoke create! on some models. When I use debug(@some\_instance) I see its id …

---

## [RSpec and PostgreSQL not playing nicely together](https://www.ruby-forum.com/t/rspec-and-postgresql-not-playing-nicely-together/152502)

<div class="topic-metadata">

**Author:** [@fipa](https://www.ruby-forum.com/u/fipa)\
**Replies:** 9\
**Last updated:** [November 5, 2008, 12:09am UTC](https://www.ruby-forum.com/t/rspec-and-postgresql-not-playing-nicely-together/152502 "2008-11-05T00:09:26Z")

</div>

Here is a very simple spec: require File.expand\_path(File.dirname(FILE) + ‘/…/spec\_helper’) describe Product, “The Product model” do describe “When a new blank product object gets created” do before(:each) do @produc…

---

## [Unable to stub a class method in a before\_filter](https://www.ruby-forum.com/t/unable-to-stub-a-class-method-in-a-before-filter/152525)

<div class="topic-metadata">

**Author:** [@fipa](https://www.ruby-forum.com/u/fipa)\
**Replies:** 8\
**Last updated:** [November 4, 2008, 10:12pm UTC](https://www.ruby-forum.com/t/unable-to-stub-a-class-method-in-a-before-filter/152525 "2008-11-04T22:12:10Z")

</div>

Here is my spec: describe Admin::ProductsController, “A visitor wants to access admin/products” do before(:each) do @product = mock\_model(Product, :traffic\_available =\> 0) Product.stub!(:find\_by\_domain\_name).and\_retu…

---

## [Testing a wizard with Cucumber](https://www.ruby-forum.com/t/testing-a-wizard-with-cucumber/152497)

<div class="topic-metadata">

**Author:** [@diabolist](https://www.ruby-forum.com/u/diabolist)\
**Replies:** 8\
**Last updated:** [November 4, 2008, 9:44pm UTC](https://www.ruby-forum.com/t/testing-a-wizard-with-cucumber/152497 "2008-11-04T21:44:59Z")

</div>

Assuming you have a multi-step wizard like thing, with lots of different states and paths through it. What approach would your use to write a feature for it? What I want to do is do the separate states and then reuse …

---

## [Can I do foo.should (be\_nil || be\_empty) in rspec](https://www.ruby-forum.com/t/can-i-do-foo-should-be-nil-be-empty-in-rspec/152473)

<div class="topic-metadata">

**Author:** [@diabolist](https://www.ruby-forum.com/u/diabolist)\
**Replies:** 18\
**Last updated:** [November 4, 2008, 9:43pm UTC](https://www.ruby-forum.com/t/can-i-do-foo-should-be-nil-be-empty-in-rspec/152473 "2008-11-04T21:43:13Z")

</div>

Is there any way to do foo.should (be\_nil || be\_empty) in rspec. Thanks in advance

---

## [Cucumber and autotest](https://www.ruby-forum.com/t/cucumber-and-autotest/152427)

<div class="topic-metadata">

**Author:** [@glenatron](https://www.ruby-forum.com/u/glenatron)\
**Replies:** 2\
**Last updated:** [November 4, 2008, 6:50am UTC](https://www.ruby-forum.com/t/cucumber-and-autotest/152427 "2008-11-04T06:50:10Z")

</div>

Hey all, Does anyone know how to disable the cucumber autotest support on a project? With this commit: http://github.com/aslakhellesoy/cucumber/commit/93470e2580b5e3cfe0c8eb3fce86e21bf8afa219 The cucumber features a…

---

## [Stub! and null\_object](https://www.ruby-forum.com/t/stub-and-null-object/152458)

<div class="topic-metadata">

**Author:** [@mwalsh](https://www.ruby-forum.com/u/mwalsh)\
**Replies:** 1\
**Last updated:** [November 4, 2008, 6:37am UTC](https://www.ruby-forum.com/t/stub-and-null-object/152458 "2008-11-04T06:37:18Z")

</div>

I have some code I want to stub out as it’s not part of what I’m testing. It’s got a bit of DSL going on, so there are method calls chained together. The call I want to stub out looks like this: user.record\_action(…

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

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