# RSpec

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

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

---

## [\[RSpec\] Dynamic reloading with Object.send(:remove\_const)](https://www.ruby-forum.com/t/rspec-dynamic-reloading-with-object-send-remove-const/192736)

<div class="topic-metadata">

**Author:** [@bcardoso](https://www.ruby-forum.com/u/bcardoso)\
**Replies:** 3\
**Last updated:** [August 5, 2010, 2:56pm UTC](https://www.ruby-forum.com/t/rspec-dynamic-reloading-with-object-send-remove-const/192736 "2010-08-05T14:56:18Z")

</div>

Hi, I have a function that adds dynamic validations to my models. I use a combination of “:remove\_const” and “load” methods to reload the code everytime I want to re-apply my dynamic validations. It seams RSpec has s…

---

## [Weird html report samba issue](https://www.ruby-forum.com/t/weird-html-report-samba-issue/192761)

<div class="topic-metadata">

**Author:** [@ahaberb](https://www.ruby-forum.com/u/ahaberb)\
**Replies:** 0\
**Last updated:** [August 5, 2010, 1:42am UTC](https://www.ruby-forum.com/t/weird-html-report-samba-issue/192761 "2010-08-05T01:42:30Z")

</div>

After several hours of troubleshooting, i’ve come across a weird issue when saving rspec reports in html format to a samba share using ubuntu hardy, rspec 1.3.0 and ruby 1.9.1. Sometimes the top of the html gets repe…

---

## [\[newbie\] tradeoffs of direct model access vs. simulated browser (webrat)](https://www.ruby-forum.com/t/newbie-tradeoffs-of-direct-model-access-vs-simulated-browser-webrat/192741)

<div class="topic-metadata">

**Author:** [@Lille](https://www.ruby-forum.com/u/Lille)\
**Replies:** 6\
**Last updated:** [August 4, 2010, 11:16pm UTC](https://www.ruby-forum.com/t/newbie-tradeoffs-of-direct-model-access-vs-simulated-browser-webrat/192741 "2010-08-04T23:16:46Z")

</div>

Hi, My app involves the elicitation of tabular data over a succession of controller/model/view groups. The net result is a numeric outcome based on the entered data (basically, it’s a spreadsheet on Rails.) Here is t…

---

## [RSpec 2 add-on for testing and specifying generators - initial release](https://www.ruby-forum.com/t/rspec-2-add-on-for-testing-and-specifying-generators-initial-release/192676)

<div class="topic-metadata">

**Author:** [@kristianm](https://www.ruby-forum.com/u/kristianm)\
**Replies:** 3\
**Last updated:** [August 4, 2010, 12:42pm UTC](https://www.ruby-forum.com/t/rspec-2-add-on-for-testing-and-specifying-generators-initial-release/192676 "2010-08-04T12:42:03Z")

</div>

http://github.com/kristianmandrup/rspec\_for\_generators When creating Rails generators I noticed that the only option I could find for testing was to use a special Rails TestCase class created specifically for use with…

---

## [\[RSpec\] Testing a helper with or without model layer?](https://www.ruby-forum.com/t/rspec-testing-a-helper-with-or-without-model-layer/192635)

<div class="topic-metadata">

**Author:** [@bcardoso](https://www.ruby-forum.com/u/bcardoso)\
**Replies:** 4\
**Last updated:** [August 3, 2010, 4:23pm UTC](https://www.ruby-forum.com/t/rspec-testing-a-helper-with-or-without-model-layer/192635 "2010-08-03T16:23:44Z")

</div>

Hi guys, I wanted to get a more experienced opinion about a test I had to do. I posted the code at pastie with comments for best visual readability: http://pastie.org/private/qvvrxubslvia2nv6l3km4q Any feedback is ap…

---

## [Migration question](https://www.ruby-forum.com/t/migration-question/192578)

<div class="topic-metadata">

**Author:** [@rogerdpack](https://www.ruby-forum.com/u/rogerdpack)\
**Replies:** 3\
**Last updated:** [August 3, 2010, 4:42am UTC](https://www.ruby-forum.com/t/migration-question/192578 "2010-08-03T04:42:57Z")

</div>

Got this: no such file to load – spec/rake/spectask anybody know off hand what the equivalent is for rspec2? -r

---

## [Controller spec, integrate views, mocking helper method](https://www.ruby-forum.com/t/controller-spec-integrate-views-mocking-helper-method/192607)

<div class="topic-metadata">

**Author:** [@LesNightingill](https://www.ruby-forum.com/u/LesNightingill)\
**Replies:** 0\
**Last updated:** [August 3, 2010, 1:32am UTC](https://www.ruby-forum.com/t/controller-spec-integrate-views-mocking-helper-method/192607 "2010-08-03T01:32:45Z")

</div>

I need to use integrate views to test some particular features. In ApplicationHelper I have: module ApplicationHelper def current\_user\_permitted? # some logic that returns true/false end end I’m testing MyControll…

---

## [Newbie : How to spec params hash amendment](https://www.ruby-forum.com/t/newbie-how-to-spec-params-hash-amendment/192449)

<div class="topic-metadata">

**Author:** [@himdel](https://www.ruby-forum.com/u/himdel)\
**Replies:** 1\
**Last updated:** [August 2, 2010, 4:03pm UTC](https://www.ruby-forum.com/t/newbie-how-to-spec-params-hash-amendment/192449 "2010-08-02T16:03:04Z")

</div>

I am new to rspec and am finding it all a bit daunting at the moment. I’d like to be able to adopt a bdd approach to my development but I’m still at the stage of trying to get my head around rspec concepts so I’m comm…

---

## [Rspec 1 - nested examples (in an each block) use the final block variable 4 times instead of each of](https://www.ruby-forum.com/t/rspec-1-nested-examples-in-an-each-block-use-the-final-block-variable-4-times-instead-of-each-of/192361)

<div class="topic-metadata">

**Author:** [@nruth](https://www.ruby-forum.com/u/nruth)\
**Replies:** 6\
**Last updated:** [July 31, 2010, 3:50am UTC](https://www.ruby-forum.com/t/rspec-1-nested-examples-in-an-each-block-use-the-final-block-variable-4-times-instead-of-each-of/192361 "2010-07-31T03:50:33Z")

</div>

Please correct me if this is fixed in Rspec 2, but in Rspec 1 I have hit upon the following problem (at least thrice, this time it costing me several hours), code is the best example: I have a practice examination sys…

---

## [Proposition: warn on rake spec - group :test](https://www.ruby-forum.com/t/proposition-warn-on-rake-spec-group-test/192390)

<div class="topic-metadata">

**Author:** [@Rainer\_Kuhn](https://www.ruby-forum.com/u/Rainer_Kuhn)\
**Replies:** 3\
**Last updated:** [July 30, 2010, 4:00pm UTC](https://www.ruby-forum.com/t/proposition-warn-on-rake-spec-group-test/192390 "2010-07-30T16:00:28Z")

</div>

Consider putting out some information on rake spec, when rspec ist only defined in the :test group. This just cost me an hour until I read the blog post explaining it. Thing is, rake spec doesn’t show on “rake -T” but…

---

## [How to fix 'rake gems:refresh\_specs' gems has no specificati](https://www.ruby-forum.com/t/how-to-fix-rake-gems-refresh-specs-gems-has-no-specificati/192381)

<div class="topic-metadata">

**Author:** [@amitjain](https://www.ruby-forum.com/u/amitjain)\
**Replies:** 10\
**Last updated:** [July 30, 2010, 2:47pm UTC](https://www.ruby-forum.com/t/how-to-fix-rake-gems-refresh-specs-gems-has-no-specificati/192381 "2010-07-30T14:47:14Z")

</div>

Hello, I recently unpacked the latest rspec and rspec rails in my applicaiton. When I run my specs I get: $ rcov user\_spec.rb config.gem: Unpacked gem CVS in vendor/gems has no specification file. Run ‘rake gems:re…

---

## [Testing controller and action with parameters](https://www.ruby-forum.com/t/testing-controller-and-action-with-parameters/192395)

<div class="topic-metadata">

**Author:** [@andersonleite](https://www.ruby-forum.com/u/andersonleite)\
**Replies:** 1\
**Last updated:** [July 29, 2010, 4:53pm UTC](https://www.ruby-forum.com/t/testing-controller-and-action-with-parameters/192395 "2010-07-29T16:53:04Z")

</div>

I have an action and I am testing it like this: The action: def create @event = Evento.new(params\[:event\]) @event.aproved = false if @event.save redirect\_to :action =\> “index” else render :action =\> “new” end en…

---

## [Should\_receive break the method chain?](https://www.ruby-forum.com/t/should-receive-break-the-method-chain/192388)

<div class="topic-metadata">

**Author:** [@rubyernewbie](https://www.ruby-forum.com/u/rubyernewbie)\
**Replies:** 1\
**Last updated:** [July 29, 2010, 3:48pm UTC](https://www.ruby-forum.com/t/should-receive-break-the-method-chain/192388 "2010-07-29T15:48:04Z")

</div>

class A def process @b.calculate end end it ‘should change b calculate value’ do @b.should\_receive(:calculate) @a.process @b.calculae\_value.should == ‘after\_calculae’ end it will fail, if I comment out #@b.shou…

---

## [Gem post-install messages](https://www.ruby-forum.com/t/gem-post-install-messages/192392)

<div class="topic-metadata">

**Author:** [@mislav](https://www.ruby-forum.com/u/mislav)\
**Replies:** 1\
**Last updated:** [July 29, 2010, 3:40pm UTC](https://www.ruby-forum.com/t/gem-post-install-messages/192392 "2010-07-29T15:40:27Z")

</div>

When you install the rspec-rails stack, the rspec gem post-install messages take more than 60 lines in total. Most of those messages are something uninformative like “thank you for installing the rspec-blah”. Um, OK. …

---

## [\`gem\_original\_require': no such file to load](https://www.ruby-forum.com/t/gem-original-require-no-such-file-to-load/192382)

<div class="topic-metadata">

**Author:** [@amitjain](https://www.ruby-forum.com/u/amitjain)\
**Replies:** 0\
**Last updated:** [July 29, 2010, 12:24pm UTC](https://www.ruby-forum.com/t/gem-original-require-no-such-file-to-load/192382 "2010-07-29T12:24:01Z")

</div>

Hi All, I am getting such types of errors with rspec implementation. $ rcov user\_spec.rb config.gem: Unpacked gem CVS in vendor/gems has no specification file. Run ‘rake gems:refresh\_specs’ to fix this. config.gem: …

---

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

<div class="topic-metadata">

**Author:** [@Nicholas\_W](https://www.ruby-forum.com/u/Nicholas_W)\
**Replies:** 1\
**Last updated:** [July 29, 2010, 3:39am UTC](https://www.ruby-forum.com/t/testing-subdomains/192310 "2010-07-29T03:39:49Z")

</div>

Hi \*, is someone using rspec 2 and rails 3 for testing subdomains ? How do I test for example in a route spec tis route ? match ‘profile’, :to =\> ‘users#profile’, :constraints =\> { :subdomain =\> /.+/ } TIA, ngw

---

## [About spec.opts and command line options and global options](https://www.ruby-forum.com/t/about-spec-opts-and-command-line-options-and-global-options/192350)

<div class="topic-metadata">

**Author:** [@juuser](https://www.ruby-forum.com/u/juuser)\
**Replies:** 2\
**Last updated:** [July 28, 2010, 9:57pm UTC](https://www.ruby-forum.com/t/about-spec-opts-and-command-line-options-and-global-options/192350 "2010-07-28T21:57:56Z")

</div>

Hello! I have some questions/proposals which have been quite time on my mind already. Let’s suppose i have files under spec directory with the following structure and contents: spec/helper.rb module Helper end spe…

---

## [2.0.0.beta.19 -"its" construct doesn't work](https://www.ruby-forum.com/t/2-0-0-beta-19-its-construct-doesnt-work/192289)

<div class="topic-metadata">

**Author:** [@tadatoshi](https://www.ruby-forum.com/u/tadatoshi)\
**Replies:** 0\
**Last updated:** [July 27, 2010, 7:53pm UTC](https://www.ruby-forum.com/t/2-0-0-beta-19-its-construct-doesnt-work/192289 "2010-07-27T19:53:41Z")

</div>

I have updated RSpec to 2.0.0.beta.19 and “its” construct that has been working with 2.0.0.beta.18 doesn’t work any more. Error message is: implicit argument passing of super from method defined by define\_method() is…

---

## [Problem running RSpec tests with Rails](https://www.ruby-forum.com/t/problem-running-rspec-tests-with-rails/192229)

<div class="topic-metadata">

**Author:** [@bcardoso](https://www.ruby-forum.com/u/bcardoso)\
**Replies:** 10\
**Last updated:** [July 27, 2010, 1:01pm UTC](https://www.ruby-forum.com/t/problem-running-rspec-tests-with-rails/192229 "2010-07-27T13:01:59Z")

</div>

Hi Not sure if this is a RSpec problem or Rails but I believe is more a RSpec situation. What happens is that when I run my RSpecs tests all the BD is recreated, including the “schema\_migration” table, because of thi…

---

## [Beginner questions: parametrize tests and disable tests (skippy?)](https://www.ruby-forum.com/t/beginner-questions-parametrize-tests-and-disable-tests-skippy/192225)

<div class="topic-metadata">

**Author:** [@nathanvda](https://www.ruby-forum.com/u/nathanvda)\
**Replies:** 2\
**Last updated:** [July 27, 2010, 11:06am UTC](https://www.ruby-forum.com/t/beginner-questions-parametrize-tests-and-disable-tests-skippy/192225 "2010-07-27T11:06:47Z")

</div>

Hi there, i have two very specific questions. I am writing an application to send sms-es. Now i would like to be able, somehow, to disable the part of my tests that actually sends the sms-es. My code is tested, but t…

---

## [\[newbie\] rspec, validations and factory\_girl](https://www.ruby-forum.com/t/newbie-rspec-validations-and-factory-girl/192231)

<div class="topic-metadata">

**Author:** [@Lille](https://www.ruby-forum.com/u/Lille)\
**Replies:** 2\
**Last updated:** [July 26, 2010, 8:09pm UTC](https://www.ruby-forum.com/t/newbie-rspec-validations-and-factory-girl/192231 "2010-07-26T20:09:28Z")

</div>

Hi, class B \< ActiveRecord::Base belongs\_to :a validates\_numericality\_of :some\_attribute, :greater\_than =\> 0, :allow\_blank=\>true def some\_attribute a.numeric\_attr \* read\_attribute(:some\_attribute) end … If I cre…

---

## [Render\_template expectation - surprising pattern matching issue](https://www.ruby-forum.com/t/render-template-expectation-surprising-pattern-matching-issue/192230)

<div class="topic-metadata">

**Author:** [@Timo\_RSSSSSSSSner](https://www.ruby-forum.com/u/Timo_RSSSSSSSSner)\
**Replies:** 1\
**Last updated:** [July 26, 2010, 6:49pm UTC](https://www.ruby-forum.com/t/render-template-expectation-surprising-pattern-matching-issue/192230 "2010-07-26T18:49:14Z")

</div>

Hey guys, we just found out by accident that rspec seems to apply a pretty confusing mechanism to ensure that a certain template is rendered. To clarify, consider this standard controller spec: working it ‘GET edit’ …

---

## [Formatting shared example descriptions with test data](https://www.ruby-forum.com/t/formatting-shared-example-descriptions-with-test-data/192200)

<div class="topic-metadata">

**Author:** [@Ashley\_M](https://www.ruby-forum.com/u/Ashley_M)\
**Replies:** 4\
**Last updated:** [July 26, 2010, 5:17pm UTC](https://www.ruby-forum.com/t/formatting-shared-example-descriptions-with-test-data/192200 "2010-07-26T17:17:54Z")

</div>

Hi I’m back again, and still on a quest to tame shared example to do my bidding. This time what I’m wondering is… is there any way to format shared example specdoc description output with data passed in with #let, o…

---

## [RSpec 2 example group block scope](https://www.ruby-forum.com/t/rspec-2-example-group-block-scope/192201)

<div class="topic-metadata">

**Author:** [@Ashley\_M](https://www.ruby-forum.com/u/Ashley_M)\
**Replies:** 0\
**Last updated:** [July 26, 2010, 10:21am UTC](https://www.ruby-forum.com/t/rspec-2-example-group-block-scope/192201 "2010-07-26T10:21:03Z")

</div>

Hi again As part of the refactoring I’m doing, I’m writing out quite a bit of metaprogramming. The easiest way to prove constant lookup is working is to create a new class in an example group, and use its name. But …

---

## [How it would be tested?](https://www.ruby-forum.com/t/how-it-would-be-tested/191895)

<div class="topic-metadata">

**Author:** [@tests\_learner](https://www.ruby-forum.com/u/tests_learner)\
**Replies:** 4\
**Last updated:** [July 25, 2010, 10:09pm UTC](https://www.ruby-forum.com/t/how-it-would-be-tested/191895 "2010-07-25T22:09:25Z")

</div>

Hello all. I’m working with rails and came to a situation that i cannot imagine how to test this. Given i have an index action that retrieves me a collection of objects. But some of them have especific permissions. …

---

## [What is the value of the distinction between exceptions and failures?](https://www.ruby-forum.com/t/what-is-the-value-of-the-distinction-between-exceptions-and-failures/192183)

<div class="topic-metadata">

**Author:** [@crucoba](https://www.ruby-forum.com/u/crucoba)\
**Replies:** 0\
**Last updated:** [July 25, 2010, 8:45pm UTC](https://www.ruby-forum.com/t/what-is-the-value-of-the-distinction-between-exceptions-and-failures/192183 "2010-07-25T20:45:07Z")

</div>

There is a feature request to make a distinction between exceptions and logical failures in RSpec’s output. If this topic interests you, please take a look at Issues · rspec/rspec-core · GitHub and add your thoughts t…

---

## [Controller stub and helper spec with lastest beta](https://www.ruby-forum.com/t/controller-stub-and-helper-spec-with-lastest-beta/192136)

<div class="topic-metadata">

**Author:** [@chatgris](https://www.ruby-forum.com/u/chatgris)\
**Replies:** 3\
**Last updated:** [July 25, 2010, 4:46pm UTC](https://www.ruby-forum.com/t/controller-stub-and-helper-spec-with-lastest-beta/192136 "2010-07-25T16:46:54Z")

</div>

Hello, I have two issues with beta 2.0.0.beta.18. First, here’s the gems : gem “rails”, “3.0.0.beta4” gem “mongoid”, “2.0.0.beta10” group :test do gem “rspec-rails”, “2.0.0.beta.18” gem “factory\_girl\_rails”, “1.0” …

---

## [Rspec-orm and \_not\_ mocking models](https://www.ruby-forum.com/t/rspec-orm-and-not-mocking-models/191988)

<div class="topic-metadata">

**Author:** [@Costa\_Shapiro](https://www.ruby-forum.com/u/Costa_Shapiro)\
**Replies:** 2\
**Last updated:** [July 25, 2010, 11:08am UTC](https://www.ruby-forum.com/t/rspec-orm-and-not-mocking-models/191988 "2010-07-25T11:08:37Z")

</div>

Hello, (Surprisingly?) I find mocking AR (DM less so) in specs extremely tedious and intrusive. Having said this, I find the approach of top-down VCM speccing very legitimate (cucumber for V, rspec for C, and probab…

---

## [Newbie: how to preserve NoMethodError under stubbing?](https://www.ruby-forum.com/t/newbie-how-to-preserve-nomethoderror-under-stubbing/192121)

<div class="topic-metadata">

**Author:** [@Lille](https://www.ruby-forum.com/u/Lille)\
**Replies:** 7\
**Last updated:** [July 24, 2010, 4:34pm UTC](https://www.ruby-forum.com/t/newbie-how-to-preserve-nomethoderror-under-stubbing/192121 "2010-07-24T16:34:09Z")

</div>

Hi, I’ve been browsing the RSpec book and the RDoc, but I can’t see how to ensure the following: Stub an instance with a method it doesn’t have and raise NoMethodError (or something like it.) I want to do this becau…

---

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

<div class="topic-metadata">

**Author:** [@pgundlach](https://www.ruby-forum.com/u/pgundlach)\
**Replies:** 5\
**Last updated:** [July 24, 2010, 3:03am UTC](https://www.ruby-forum.com/t/rails-stubbed-static-methods-are-bleeding-over-into-other-specs-and-making-them-fail/191032 "2010-07-24T03:03:35Z")

</div>

Hi all, I’m having a problem where stubbed static methods aren’t properly becoming “unstubbed”. I have tried manually unstubbing them, but it still doesn’t work. Spec is as follows: it "creates user accounts for …

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

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