# RSpec

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

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

---

## [\--tty vs. --color](https://www.ruby-forum.com/t/tty-vs-color/202321)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [January 26, 2011, 10:22pm UTC](https://www.ruby-forum.com/t/tty-vs-color/202321 "2011-01-26T22:22:23Z")

</div>

Greetings, What is the difference between rspec --tty and rspec --color. I just noticed that under JRuby output for --color is not colored but for – tty it is. Seems like we only need one color option, why two? John-…

---

## [Class/type coercion in ruby blog post](https://www.ruby-forum.com/t/class-type-coercion-in-ruby-blog-post/202304)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 0\
**Last updated:** [January 26, 2011, 4:01pm UTC](https://www.ruby-forum.com/t/class-type-coercion-in-ruby-blog-post/202304 "2011-01-26T16:01:42Z")

</div>

Not to spam, but I a colleague did a write up on coercion in Ruby, and I thought it was interesting and fresh, so I thought I’d share with the community: http://mutuallyhuman.com/blog/2011/01/25/class-coercion-in-ruby …

---

## [\[newbie\] CSS navigation in controller response?](https://www.ruby-forum.com/t/newbie-css-navigation-in-controller-response/202227)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 5\
**Last updated:** [January 26, 2011, 8:25am UTC](https://www.ruby-forum.com/t/newbie-css-navigation-in-controller-response/202227 "2011-01-26T08:25:32Z")

</div>

I’m hooked on RSpec after my first taste (thanks to Chapter 1: From zero to deploy | Ruby on Rails Tutorial | Learn Enough to Be Dangerous). And of course I have a newbish question. Assume a contrived doc structure l…

---

## [Major release required?](https://www.ruby-forum.com/t/major-release-required/201946)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 13\
**Last updated:** [January 23, 2011, 5:45am UTC](https://www.ruby-forum.com/t/major-release-required/201946 "2011-01-23T05:45:44Z")

</div>

Hi all, Since the release of rspec-2.0, I’ve been following Rubygems’ rational versioning \[1\] as closely as possible. Patch releases (2.4.x) have only had bug fixes, and minor releases (2.x.0) have had new features, b…

---

## [Arrange Act Assert (AAA) style syntax for rspec2](https://www.ruby-forum.com/t/arrange-act-assert-aaa-style-syntax-for-rspec2/202096)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 2\
**Last updated:** [January 23, 2011, 4:54am UTC](https://www.ruby-forum.com/t/arrange-act-assert-aaa-style-syntax-for-rspec2/202096 "2011-01-23T04:54:48Z")

</div>

I’d like to be able to test w/ this methodology, and i’m having trouble figuring out where to hook in to rspec to do it. Near as I can tell, the flow is this: run all of the before filters in the order of highest to …

---

## [Best Practice for Controllers](https://www.ruby-forum.com/t/best-practice-for-controllers/201897)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 9\
**Last updated:** [January 22, 2011, 9:55am UTC](https://www.ruby-forum.com/t/best-practice-for-controllers/201897 "2011-01-22T09:55:19Z")

</div>

Hello all, From what I’ve seen, this type of question doesn’t really seem to get an answer on this list as most of the replies relate to failures of RSpec. If this is the case, where is the best place to go to get a…

---

## [No command 'rspec' found](https://www.ruby-forum.com/t/no-command-rspec-found/202065)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 4\
**Last updated:** [January 22, 2011, 3:50am UTC](https://www.ruby-forum.com/t/no-command-rspec-found/202065 "2011-01-22T03:50:32Z")

</div>

What directory is rspec in? Other posts refer to /var/lib/gems/1.8/bin, but my install does not have the “bin”: ~$ ls /var/lib/gems/1.8/ cache doc gems specifications Thanks.

---

## [Test Spies for RSpec 2](https://www.ruby-forum.com/t/test-spies-for-rspec-2/199976)

<div class="topic-metadata">

**Author:** [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Replies:** 3\
**Last updated:** [January 21, 2011, 6:26pm UTC](https://www.ruby-forum.com/t/test-spies-for-rspec-2/199976 "2011-01-21T18:26:58Z")

</div>

I’ve tried three test spy mocking frameworks for RSpec that I know of. Presently, all three (Not A Mock, RR, rspec-spies) don’t work with RSpec 2. Does anyone have a line on any other mocking frameworks for RSpec 2 t…

---

## ['require'ing files from other directories](https://www.ruby-forum.com/t/requireing-files-from-other-directories/202061)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 5\
**Last updated:** [January 21, 2011, 5:22pm UTC](https://www.ruby-forum.com/t/requireing-files-from-other-directories/202061 "2011-01-21T17:22:57Z")

</div>

I’m going through The RSpec Book and am currently working with the Mastermind game example. But that’s besides the point. The way my directories are setup is like so: /mastermind/features/step\_definitions… /mastermi…

---

## [Problem with before(:all)](https://www.ruby-forum.com/t/problem-with-before-all/202089)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 1\
**Last updated:** [January 21, 2011, 3:28pm UTC](https://www.ruby-forum.com/t/problem-with-before-all/202089 "2011-01-21T15:28:32Z")

</div>

I have a module with two methods for marshaling objects. The following rspec code is used to test this module: ----- Start Code ----- require ‘…/code/fmutil.rb’ require ‘…/code/fmgrid.rb’ require ‘…/code/serial.rb…

---

## [Rspec2 partial view gives nil:NilClass. Why?](https://www.ruby-forum.com/t/rspec2-partial-view-gives-nil-nilclass-why/201849)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 2\
**Last updated:** [January 21, 2011, 3:04pm UTC](https://www.ruby-forum.com/t/rspec2-partial-view-gives-nil-nilclass-why/201849 "2011-01-21T15:04:38Z")

</div>

Hello, I am trying to get going with development of view components with Rspec2 and Rails3. However, I make the following observation, and I don’t understand what is going on, and how to fix this. In my spec I defin…

---

## [Parse!: invalid option "--autotest"](https://www.ruby-forum.com/t/parse-invalid-option-autotest/202084)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 1\
**Last updated:** [January 21, 2011, 2:47pm UTC](https://www.ruby-forum.com/t/parse-invalid-option-autotest/202084 "2011-01-21T14:47:40Z")

</div>

I keep getting the error every time I try to run my specs with “bundle exec rake spec”: /Users/sean/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.4.0/lib/rspec/ core/option\_parser.rb:18:in parse!': invalid option: --autot…

---

## [Detecting status of a spec in after block](https://www.ruby-forum.com/t/detecting-status-of-a-spec-in-after-block/202049)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 2\
**Last updated:** [January 20, 2011, 6:48pm UTC](https://www.ruby-forum.com/t/detecting-status-of-a-spec-in-after-block/202049 "2011-01-20T18:48:29Z")

</div>

Hi inside an after :each block, whats the best way to find out if the current spec has run? Right now the only solution I have is self.example.instance\_variable\_get(:@exception).nil?. Is there a better solution? Als…

---

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

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [January 20, 2011, 2:47pm UTC](https://www.ruby-forum.com/t/cucumber-problems/202042 "2011-01-20T14:47:44Z")

</div>

Hello. I know that’s not RSpec, but it belong to BDD. I have some problem with cucumber. When I run all commands in cucumber, I read this(see attached image). What’s wrong? Ruby -v 1.9.2; Cucumber version 0.10.0.

---

## [Writing specs for Padrino using RSpec](https://www.ruby-forum.com/t/writing-specs-for-padrino-using-rspec/202030)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 0\
**Last updated:** [January 20, 2011, 7:36am UTC](https://www.ruby-forum.com/t/writing-specs-for-padrino-using-rspec/202030 "2011-01-20T07:36:17Z")

</div>

Hi I am new to RSpec and just started getting introduced to Padrino. I need to write specs for developing a project using Padrino (or Sinatra). Has anyone written such specs? If so can you share it on the public dom…

---

## [Problem with output at running specs](https://www.ruby-forum.com/t/problem-with-output-at-running-specs/201842)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 4\
**Last updated:** [January 19, 2011, 11:55pm UTC](https://www.ruby-forum.com/t/problem-with-output-at-running-specs/201842 "2011-01-19T23:55:44Z")

</div>

Hi folks, I’m using rspec-rails 1.3.3 with a rails 2.3.2 app, I’m setting up the test environment, an every time that I run the specs I get this weird output: Plain Text code - 35 lines - codepad Do you know how I can…

---

## [Capturing screenshots on test failures](https://www.ruby-forum.com/t/capturing-screenshots-on-test-failures/201987)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 0\
**Last updated:** [January 19, 2011, 1:08pm UTC](https://www.ruby-forum.com/t/capturing-screenshots-on-test-failures/201987 "2011-01-19T13:08:27Z")

</div>

Hi I’m using rspec to run my functional tests and I’d like to add a hook to be executed every time a spec fails so that I can capture a screenshot. What’s the best way to do this? Also I’d like to name my screenshot …

---

## [Aidmock - safe mocking](https://www.ruby-forum.com/t/aidmock-safe-mocking/201872)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 10\
**Last updated:** [January 19, 2011, 8:27am UTC](https://www.ruby-forum.com/t/aidmock-safe-mocking/201872 "2011-01-19T08:27:44Z")

</div>

Hi guys, I launched some days ago a new project that aims to make the use of mocks safer. This is the URL of project: GitHub - wilkerlucio/aidmock: Safe mocking The basic idea is to make user define interfaces of cl…

---

## [Require expectations library confusion](https://www.ruby-forum.com/t/require-expectations-library-confusion/201976)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 2\
**Last updated:** [January 19, 2011, 8:21am UTC](https://www.ruby-forum.com/t/require-expectations-library-confusion/201976 "2011-01-19T08:21:28Z")

</div>

I’m on Ubuntu 10.10, and I’m trying to figure out what I’m missing in regards to the require statement for RSpec’s expectation library. Any code I see on the web requires rspec like: require ‘spec/expectations’ but t…

---

## [Redis and RSpec: Redis returning wildly inconsistent results](https://www.ruby-forum.com/t/redis-and-rspec-redis-returning-wildly-inconsistent-results/201916)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 2\
**Last updated:** [January 18, 2011, 9:53pm UTC](https://www.ruby-forum.com/t/redis-and-rspec-redis-returning-wildly-inconsistent-results/201916 "2011-01-18T21:53:09Z")

</div>

Hi list I use Redis heavily in my application, and perform all of my unit testing using RSpec. So very often during my tests, I am hitting Redis repeatedly. I find that Redis repeatedly returns inconsistent and unex…

---

## [Rspec Nested Resources: Can someone offer an 'update' example?](https://www.ruby-forum.com/t/rspec-nested-resources-can-someone-offer-an-update-example/201904)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 2\
**Last updated:** [January 18, 2011, 1:08am UTC](https://www.ruby-forum.com/t/rspec-nested-resources-can-someone-offer-an-update-example/201904 "2011-01-18T01:08:05Z")

</div>

Hi folks, I’ve just spent a day trying to write up a basic update spec for a nested resource - all without avail. I’m quite new to RSpec & not sure what I’m doing wrong. I can’t seem to get a stub that recognises the …

---

## [Autospec on rails keep rerunning on failed case, and never stop](https://www.ruby-forum.com/t/autospec-on-rails-keep-rerunning-on-failed-case-and-never-stop/201794)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 7\
**Last updated:** [January 17, 2011, 9:56pm UTC](https://www.ruby-forum.com/t/autospec-on-rails-keep-rerunning-on-failed-case-and-never-stop/201794 "2011-01-17T21:56:57Z")

</div>

Hi there, I met a problem when I’m using RSpec(1.3.0) on rails. I installed rspec(1.3.1) and rspec-rails(1.3.3) installed through rails script/plugin install from github. I run autospec at $RAILS\_ROOT, and if the tes…

---

## [Using integrate\_views for all controller specs](https://www.ruby-forum.com/t/using-integrate-views-for-all-controller-specs/201907)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [January 17, 2011, 8:39pm UTC](https://www.ruby-forum.com/t/using-integrate-views-for-all-controller-specs/201907 "2011-01-17T20:39:50Z")

</div>

Is there a way to always use integrate\_views for all controller specs? I hate having to remember to insert that line into each one. Thanks, Joe

---

## [Session variable not available in global before(:each, :type =\> :controller)](https://www.ruby-forum.com/t/session-variable-not-available-in-global-before-each-type-controller/201905)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [January 17, 2011, 7:46pm UTC](https://www.ruby-forum.com/t/session-variable-not-available-in-global-before-each-type-controller/201905 "2011-01-17T19:46:20Z")

</div>

Hi, I’m refactoring some specs, in controller specs I have a before(:each) which sets up things required in the session, wanted to avoid duplication and put the initial setup global for each controller spec my before…

---

## [Problem with output at running specs](https://www.ruby-forum.com/t/problem-with-output-at-running-specs/201909)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 0\
**Last updated:** [January 17, 2011, 7:24pm UTC](https://www.ruby-forum.com/t/problem-with-output-at-running-specs/201909 "2011-01-17T19:24:59Z")

</div>

Hi folks, I’m using rspec-rails 1.3.3 with a rails 2.3.2 app, I’m setting up the test environment, an every time that I run the specs I get this weird output: Plain Text code - 35 lines - codepad Do you know how I can…

---

## [Sudden rspec problem](https://www.ruby-forum.com/t/sudden-rspec-problem/201871)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 4\
**Last updated:** [January 17, 2011, 1:58am UTC](https://www.ruby-forum.com/t/sudden-rspec-problem/201871 "2011-01-17T01:58:39Z")

</div>

I was using rspec 2.4.0 to test some code and it was working fine then suddenly I get rich@richlaptop2:~/Documents/fakemap/rspec$ rspec block.rb /usr/lib/ruby/1.8/rubygems/custom\_require.rb:31:in gem\_original\_require…

---

## [Formatting of one-line specs - question](https://www.ruby-forum.com/t/formatting-of-one-line-specs-question/201861)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [January 16, 2011, 11:15pm UTC](https://www.ruby-forum.com/t/formatting-of-one-line-specs-question/201861 "2011-01-16T23:15:28Z")

</div>

For easy editing, I love one-line specs, like this: specify { 1.should == 1 } But when using ‘–format documentation’, one-line specs don’t always render useful documentation. A solution is to write one-line specs usi…

---

## [\[rspec-rails\] how to test module behavior once and then confirm that controllers implement it?](https://www.ruby-forum.com/t/rspec-rails-how-to-test-module-behavior-once-and-then-confirm-that-controllers-implement-it/201816)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 5\
**Last updated:** [January 15, 2011, 11:47pm UTC](https://www.ruby-forum.com/t/rspec-rails-how-to-test-module-behavior-once-and-then-confirm-that-controllers-implement-it/201816 "2011-01-15T23:47:03Z")

</div>

Hi, I’m using rspec-rails (1.3.2), and wondering how to save myself the trouble of testing filters for ActionControllers when those filters call methods included from modules. Specifically, what is the recommended st…

---

## [Found some inconsistently behavior on its method](https://www.ruby-forum.com/t/found-some-inconsistently-behavior-on-its-method/201768)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 5\
**Last updated:** [January 14, 2011, 10:06pm UTC](https://www.ruby-forum.com/t/found-some-inconsistently-behavior-on-its-method/201768 "2011-01-14T22:06:12Z")

</div>

Hi there, I’ve just started using rspec and rspec-rails (both are the newest version on git repository). I met some inconsistently behavior on it method and its method. The following is the way to reproduce it: com…

---

## [Rspec 2.4 incorrect time reported](https://www.ruby-forum.com/t/rspec-2-4-incorrect-time-reported/201791)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 2\
**Last updated:** [January 14, 2011, 5:52pm UTC](https://www.ruby-forum.com/t/rspec-2-4-incorrect-time-reported/201791 "2011-01-14T17:52:57Z")

</div>

I keep seeing strange run times for our specs: Finished in -348317500.25314 seconds Any thoughts are much appreciated. Best, Michael G.

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

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