# RSpec

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

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

---

## [BDD and Interacting With External Resources](https://www.ruby-forum.com/t/bdd-and-interacting-with-external-resources/201056)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [December 29, 2010, 4:03pm UTC](https://www.ruby-forum.com/t/bdd-and-interacting-with-external-resources/201056 "2010-12-29T16:03:22Z")

</div>

Hi all, What’s the best way to handle features which rely on an external API in a behaviour-driven way? Suppose I have an app which manages online ordering from several independent stores, with a cut taken from each …

---

## [BDD and Performance](https://www.ruby-forum.com/t/bdd-and-performance/201055)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 1\
**Last updated:** [December 29, 2010, 11:26am UTC](https://www.ruby-forum.com/t/bdd-and-performance/201055 "2010-12-29T11:26:20Z")

</div>

Hi all, What’s the best way to implement performance enhancements from the outside-in? For example, if I’m working test-free and I know I’m going to be looking up my Shops by phone number often, I’ll write a migratio…

---

## [RSpec2 issue with RCov](https://www.ruby-forum.com/t/rspec2-issue-with-rcov/201049)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 1\
**Last updated:** [December 29, 2010, 2:41am UTC](https://www.ruby-forum.com/t/rspec2-issue-with-rcov/201049 "2010-12-29T02:41:22Z")

</div>

Hello, I am experiencing an issue with RSpec2, while running RCov. In my Rakefile, I have a task defined like this: namespace :test do desc "Run all specs." RSpec::Core::RakeTask.new(:spec) do |t| t.pattern =…

---

## [Rspec 2 helper spec problems](https://www.ruby-forum.com/t/rspec-2-helper-spec-problems/201013)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 1\
**Last updated:** [December 29, 2010, 12:12am UTC](https://www.ruby-forum.com/t/rspec-2-helper-spec-problems/201013 "2010-12-29T00:12:24Z")

</div>

Hi, I have a working application\_helper\_spec.rb, and now I created a posts\_helper\_spec.rb in the spec/helpers directory. But it looks like rspec is not treating it as a helper spec, the helper returns null and mocks a…

---

## [Inconsistent Test results w/ Autotest vs just rspec ./spec](https://www.ruby-forum.com/t/inconsistent-test-results-w-autotest-vs-just-rspec-spec/200905)

<div class="topic-metadata">

**Author:** [@nikuSESS](https://www.ruby-forum.com/u/nikuSESS)\
**Replies:** 1\
**Last updated:** [December 26, 2010, 12:32pm UTC](https://www.ruby-forum.com/t/inconsistent-test-results-w-autotest-vs-just-rspec-spec/200905 "2010-12-26T12:32:32Z")

</div>

Problem ------------------------------------------------------- When I run autotest against my rails 3 app, I get some errors that seem to imply that my @ variables are not be cleared for each context. It happens onl…

---

## [Mock in lambda?](https://www.ruby-forum.com/t/mock-in-lambda/200953)

<div class="topic-metadata">

**Author:** [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Replies:** 3\
**Last updated:** [December 26, 2010, 8:56am UTC](https://www.ruby-forum.com/t/mock-in-lambda/200953 "2010-12-26T08:56:33Z")

</div>

Hi, I have a lambda. Test = lambda { kill(333) } How should I spec if I want to make sure this Test will send kill message with 333? Thanks. Best regards, Zhi-Qiang L. removed\_email\_address@domain.invalid

---

## [Stubbing out common setup](https://www.ruby-forum.com/t/stubbing-out-common-setup/200904)

<div class="topic-metadata">

**Author:** [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Replies:** 1\
**Last updated:** [December 24, 2010, 12:25pm UTC](https://www.ruby-forum.com/t/stubbing-out-common-setup/200904 "2010-12-24T12:25:55Z")

</div>

I want to stub an after save method(which generates files and so, is time consuming), for most of my spec files apart from a few where that method is actually tested. I was trying to do this with using shared examples…

---

## [View Specs](https://www.ruby-forum.com/t/view-specs/200903)

<div class="topic-metadata">

**Author:** [@nikuSESS](https://www.ruby-forum.com/u/nikuSESS)\
**Replies:** 1\
**Last updated:** [December 24, 2010, 12:12pm UTC](https://www.ruby-forum.com/t/view-specs/200903 "2010-12-24T12:12:45Z")

</div>

Hi, I was using WebRat and I had view specs that looked like this: describe “expenses/new.html.erb” do it “displays ‘New Expense’” do render rendered.should include(“New Expense”) end end I am now using Capybara …

---

## [Use filters to wrap examples into a pending block?](https://www.ruby-forum.com/t/use-filters-to-wrap-examples-into-a-pending-block/200861)

<div class="topic-metadata">

**Author:** [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Replies:** 2\
**Last updated:** [December 23, 2010, 1:02pm UTC](https://www.ruby-forum.com/t/use-filters-to-wrap-examples-into-a-pending-block/200861 "2010-12-23T13:02:39Z")

</div>

Hi all, I was wonder whether something like the following is possible in RSpec? RSpec.configure do |c| c.filter\_examples : pending\_for\_some\_reason =\> lambda {|example| pending “This example is failing due to upgrade …

---

## [Running rspec in spec/requests directory with cells fails](https://www.ruby-forum.com/t/running-rspec-in-spec-requests-directory-with-cells-fails/200796)

<div class="topic-metadata">

**Author:** [@nikuSESS](https://www.ruby-forum.com/u/nikuSESS)\
**Replies:** 3\
**Last updated:** [December 22, 2010, 9:34pm UTC](https://www.ruby-forum.com/t/running-rspec-in-spec-requests-directory-with-cells-fails/200796 "2010-12-22T21:34:16Z")

</div>

Hi, not exactly sure if this is a cells bug or an rspec (or both), but when running a simple request spec from the spec/requests directory gets an error whereas running it from the RAILS ROOT directory it works… Seem…

---

## [Make macros DRY](https://www.ruby-forum.com/t/make-macros-dry/200786)

<div class="topic-metadata">

**Author:** [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Replies:** 2\
**Last updated:** [December 22, 2010, 11:12am UTC](https://www.ruby-forum.com/t/make-macros-dry/200786 "2010-12-22T11:12:07Z")

</div>

Hey, I have lots of problems to refactor RSpec macros and make them DRY. Right now I’m stuck in such a situation for some role macros. In my controller tests, I want to write: it\_should\_grant\_access(:super\_admin, :t…

---

## [Feature suggestion: straight strings](https://www.ruby-forum.com/t/feature-suggestion-straight-strings/200722)

<div class="topic-metadata">

**Author:** [@nikuSESS](https://www.ruby-forum.com/u/nikuSESS)\
**Replies:** 2\
**Last updated:** [December 21, 2010, 12:48pm UTC](https://www.ruby-forum.com/t/feature-suggestion-straight-strings/200722 "2010-12-21T12:48:40Z")

</div>

Sorry if I mentioned this one before, but has anyone proposed being able to do something like "it should be able".to { } ? (or something like that)… Might be preferable where a test description doesn’t start with “i…

---

## [Testing html email content with have\_selector rspec2 rails3 fails](https://www.ruby-forum.com/t/testing-html-email-content-with-have-selector-rspec2-rails3-fails/200072)

<div class="topic-metadata">

**Author:** [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Replies:** 1\
**Last updated:** [December 21, 2010, 12:48am UTC](https://www.ruby-forum.com/t/testing-html-email-content-with-have-selector-rspec2-rails3-fails/200072 "2010-12-21T00:48:01Z")

</div>

Previously on rails 2.x I have been able to test the content of my html actionmailer emails. In rspec 1.x: @mailer = OrderMailer.create\_receipt(@order) @mailer.body.should have\_tag(’.order\_number’) @mailer.body.shou…

---

## [Rspec-rails with gems 1.3.4](https://www.ruby-forum.com/t/rspec-rails-with-gems-1-3-4/200721)

<div class="topic-metadata">

**Author:** [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Replies:** 2\
**Last updated:** [December 20, 2010, 7:33pm UTC](https://www.ruby-forum.com/t/rspec-rails-with-gems-1-3-4/200721 "2010-12-20T19:33:14Z")

</div>

When I try to install rspec-rails it tells me: ERROR: Error installing rspec-rails: i18n requires RubyGems version \>= 1.3.5 I am using RubyGems 1.3.4, and I am locked down to that version at the client site. Is the…

---

## ["unit" vs. "functional" specs](https://www.ruby-forum.com/t/unit-vs-functional-specs/200411)

<div class="topic-metadata">

**Author:** [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Replies:** 3\
**Last updated:** [December 19, 2010, 2:34pm UTC](https://www.ruby-forum.com/t/unit-vs-functional-specs/200411 "2010-12-19T14:34:31Z")

</div>

I went back and forth on whether to send this to this list or the ruby-talk list, so feel free to tell me to take a hike… I’m working on a personal project where I’m trying to keep a really high bar on quality. One …

---

## [\[Mock\]How do I check order of method argument?](https://www.ruby-forum.com/t/mock-how-do-i-check-order-of-method-argument/200622)

<div class="topic-metadata">

**Author:** [@nikuSESS](https://www.ruby-forum.com/u/nikuSESS)\
**Replies:** 3\
**Last updated:** [December 18, 2010, 1:17pm UTC](https://www.ruby-forum.com/t/mock-how-do-i-check-order-of-method-argument/200622 "2010-12-18T13:17:48Z")

</div>

Hello. My name is niku. I’m using rspec 2.2.1 /tmp% rspec --version 2.2.1 I tested fixed\_stdout\_spec.rb · GitHub and passed. /tmp% rspec stdout\_spec.rb … Finished in 0.00105 seconds 2 examples, 0 failures But I…

---

## [Count error on lambda should change](https://www.ruby-forum.com/t/count-error-on-lambda-should-change/200511)

<div class="topic-metadata">

**Author:** [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Replies:** 1\
**Last updated:** [December 18, 2010, 12:58pm UTC](https://www.ruby-forum.com/t/count-error-on-lambda-should-change/200511 "2010-12-18T12:58:20Z")

</div>

Hi, any idea what could cause the following error in a controller test? "count should have been changed by 1, but was changed by 0" I’m posting to a create route using a lambda, similar to Hartl’s example in his Rail…

---

## [Rspec & Rails Nested Resources](https://www.ruby-forum.com/t/rspec-rails-nested-resources/226146)

<div class="topic-metadata">

**Author:** [@dcarneiro](https://www.ruby-forum.com/u/dcarneiro)\
**Replies:** 2\
**Last updated:** [December 18, 2010, 12:58pm UTC](https://www.ruby-forum.com/t/rspec-rails-nested-resources/226146 "2010-12-18T12:58:20Z")

</div>

Hey all, I’m new to Rspec and I was just wondering what the standard way of testing nested resources is? I currently have a Job model which has many Correspondences. The new action of my CorrespondencesController loo…

---

## [Failing View Spec, rspec-rails 2.2.1](https://www.ruby-forum.com/t/failing-view-spec-rspec-rails-2-2-1/199938)

<div class="topic-metadata">

**Author:** [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Replies:** 9\
**Last updated:** [December 18, 2010, 2:48am UTC](https://www.ruby-forum.com/t/failing-view-spec-rspec-rails-2-2-1/199938 "2010-12-18T02:48:46Z")

</div>

Hello all. Just a little frustration moment here and hoping someone can explain to me what is going on. I had a passing view spec using \>= rspec-rails2. Then after updating to 2.1.0-2.2.1 it always fails. Thinking I…

---

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

<div class="topic-metadata">

**Author:** [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Replies:** 0\
**Last updated:** [December 17, 2010, 5:21am UTC](https://www.ruby-forum.com/t/rspec-rails-2-3-1-is-released/200605 "2010-12-17T05:21:08Z")

</div>

rspec-rails-2.3.1 / 2010-12-16 full changelog Bug fixes respond\_to? correctly handles 2 args scaffold generator no longer fails on autotest directory

---

## [Rspec-core-2.3.1 is released](https://www.ruby-forum.com/t/rspec-core-2-3-1-is-released/200606)

<div class="topic-metadata">

**Author:** [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Replies:** 0\
**Last updated:** [December 17, 2010, 5:21am UTC](https://www.ruby-forum.com/t/rspec-core-2-3-1-is-released/200606 "2010-12-17T05:21:08Z")

</div>

rspec-core-2.3.1 / 2010-12-16 full changelog: Bug fixes send debugger warning message to $stdout if RSpec.configuration.error\_stream has not been defined yet. HTML Formatter finally properly displays nested groups…

---

## [Specing a model to make sure it implements act\_as\_authentic](https://www.ruby-forum.com/t/specing-a-model-to-make-sure-it-implements-act-as-authentic/200237)

<div class="topic-metadata">

**Author:** [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Replies:** 2\
**Last updated:** [December 16, 2010, 7:22am UTC](https://www.ruby-forum.com/t/specing-a-model-to-make-sure-it-implements-act-as-authentic/200237 "2010-12-16T07:22:54Z")

</div>

Is it possible to spec that a model should acts\_as\_authentic which is from the authlogic gem? I’m using rspec-1.3.x Cheers Stephen

---

## [Making sure a model acts\_as\_authentic](https://www.ruby-forum.com/t/making-sure-a-model-acts-as-authentic/200203)

<div class="topic-metadata">

**Author:** [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Replies:** 1\
**Last updated:** [December 16, 2010, 7:17am UTC](https://www.ruby-forum.com/t/making-sure-a-model-acts-as-authentic/200203 "2010-12-16T07:17:44Z")

</div>

Is there any way to spec that a model should acts\_as\_authentic which is from the authlogic plugin im using rspec-1 Stephen S.stone

---

## [Nested model and Factory.build](https://www.ruby-forum.com/t/nested-model-and-factory-build/200568)

<div class="topic-metadata">

**Author:** [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Replies:** 0\
**Last updated:** [December 16, 2010, 2:26am UTC](https://www.ruby-forum.com/t/nested-model-and-factory-build/200568 "2010-12-16T02:26:24Z")

</div>

I am new to RSpec and BDD, learning it while starting a new project. I am writing model tests for a user model with a has\_one association: class User \< ActiveRecord::Base has\_one :core\_profile validates\_associated :c…

---

## [Nested examples in html formatter](https://www.ruby-forum.com/t/nested-examples-in-html-formatter/200513)

<div class="topic-metadata">

**Author:** [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Replies:** 2\
**Last updated:** [December 15, 2010, 4:49pm UTC](https://www.ruby-forum.com/t/nested-examples-in-html-formatter/200513 "2010-12-15T16:49:40Z")

</div>

Is there a way for the html formatter to show nested “describe” blocks, as written in my examples. Or perhaps I should change how I write my examples so nesting can be shown? eg describe MyModel do it “should be va…

---

## [Problems running RSpec 2 with autotest/autospec](https://www.ruby-forum.com/t/problems-running-rspec-2-with-autotest-autospec/189710)

<div class="topic-metadata">

**Author:** [@kristianm](https://www.ruby-forum.com/u/kristianm)\
**Replies:** 24\
**Last updated:** [December 14, 2010, 8:57pm UTC](https://www.ruby-forum.com/t/problems-running-rspec-2-with-autotest-autospec/189710 "2010-12-14T20:57:12Z")

</div>

It seems there is no bin/autospec with RSpec 2. So I got it running simply with $ autotest Been looking at instructions here http://wiki.github.com/dchelimsky/rspec/autotest-integration And here Getting Started with …

---

## [@current\_user in controller specs](https://www.ruby-forum.com/t/current-user-in-controller-specs/200432)

<div class="topic-metadata">

**Author:** [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Replies:** 1\
**Last updated:** [December 14, 2010, 7:48pm UTC](https://www.ruby-forum.com/t/current-user-in-controller-specs/200432 "2010-12-14T19:48:39Z")

</div>

Hi, I’m an absolute beginner with RSpec, so I apologize if this question doesn’t make sense. I’m using RSpec 2, Rails 3. I have a @current\_user instance variable that I can access in my controller. I have a contr…

---

## [Count error on lambda should change](https://www.ruby-forum.com/t/count-error-on-lambda-should-change/226115)

<div class="topic-metadata">

**Author:** [@djangst](https://www.ruby-forum.com/u/djangst)\
**Replies:** 2\
**Last updated:** [December 14, 2010, 7:32pm UTC](https://www.ruby-forum.com/t/count-error-on-lambda-should-change/226115 "2010-12-14T19:32:19Z")

</div>

Hi, any idea what could cause the following error in a controller test? "count should have been changed by 1, but was changed by 0" I’m posting to a create route using a lambda, similar to Hartl’s example in his Rai…

---

## [RSpec2: How to avoid an example run when previous failed](https://www.ruby-forum.com/t/rspec2-how-to-avoid-an-example-run-when-previous-failed/200410)

<div class="topic-metadata">

**Author:** [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Replies:** 2\
**Last updated:** [December 13, 2010, 4:28am UTC](https://www.ruby-forum.com/t/rspec2-how-to-avoid-an-example-run-when-previous-failed/200410 "2010-12-13T04:28:38Z")

</div>

Is there a way not to execute an example when another one fails? I want to minimize failure noises in cases when, say, one spec checks that an array has an expected number of elements while the others drill down on a …

---

## [Comparing files](https://www.ruby-forum.com/t/comparing-files/200397)

<div class="topic-metadata">

**Author:** [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Replies:** 12\
**Last updated:** [December 12, 2010, 7:13am UTC](https://www.ruby-forum.com/t/comparing-files/200397 "2010-12-12T07:13:29Z")

</div>

Hello folks, I’m writing some tests for file upload code. The files are binary, images mostly. I’m futzing around a bit, trying to figure out how to assert that the uploaded file is the same as some golden master. If …

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

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