# RSpec

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

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

---

## [Request for feedback](https://www.ruby-forum.com/t/request-for-feedback/190160)

<div class="topic-metadata">

**Author:** [@crucoba](https://www.ruby-forum.com/u/crucoba)\
**Replies:** 0\
**Last updated:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/request-for-feedback/190160 "2010-06-17T16:22:04Z")

</div>

Hey all, If you’re interested in seeing rspec-2 get an API like cucumber tags, please comment on Issues · rspec/rspec-core · GitHub. Cheers, David

---

## [Recommendations for ticket #971 workaround?](https://www.ruby-forum.com/t/recommendations-for-ticket-971-workaround/190158)

<div class="topic-metadata">

**Author:** [@johnf](https://www.ruby-forum.com/u/johnf)\
**Replies:** 0\
**Last updated:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/recommendations-for-ticket-971-workaround/190158 "2010-06-17T16:22:04Z")

</div>

hello, I’m running rspec 1.3.0 on Ruby 1.9.2-dev. It appears that when you use it without a corresponding block, the test case is treated not as pending, but instead throws an error inside rspec. I see that there is …

---

## [Rails 3 Support/Design](https://www.ruby-forum.com/t/rails-3-support-design/189985)

<div class="topic-metadata">

**Author:** [@geetarista](https://www.ruby-forum.com/u/geetarista)\
**Replies:** 7\
**Last updated:** [June 12, 2010, 1:18pm UTC](https://www.ruby-forum.com/t/rails-3-support-design/189985 "2010-06-12T13:18:02Z")

</div>

Since Rspec-Rails 2 is specifically geared toward Rails 3, I’m wondering why it doesn’t use railtie, the new generators, etc. Will it stay this way or is it planned to support that?

---

## [Rails 3 , RSpec 2.0.0.beta.11](https://www.ruby-forum.com/t/rails-3-rspec-2-0-0-beta-11/190056)

<div class="topic-metadata">

**Author:** [@juange](https://www.ruby-forum.com/u/juange)\
**Replies:** 1\
**Last updated:** [June 12, 2010, 9:38am UTC](https://www.ruby-forum.com/t/rails-3-rspec-2-0-0-beta-11/190056 "2010-06-12T09:38:34Z")

</div>

Hi, I was doing some testing to mi controller and a error raise, and it’s driving me crazy. This are the lines that I wanna test: @cloning\_vector = CloningVector.new(params\[:cloning\_vector\]) @cloning\_vector.sequence =…

---

## [RoutingError in spec for helper](https://www.ruby-forum.com/t/routingerror-in-spec-for-helper/190021)

<div class="topic-metadata">

**Author:** [@rgagnon](https://www.ruby-forum.com/u/rgagnon)\
**Replies:** 3\
**Last updated:** [June 11, 2010, 5:46pm UTC](https://www.ruby-forum.com/t/routingerror-in-spec-for-helper/190021 "2010-06-11T17:46:18Z")

</div>

Hi, Its maybe not related to rspec but I can’t figure out how to fix it. Here is, In my helper(Rails) I got the piece of code : sortie += link\_to(entete\_colonne + " " + image\_sens\_tri,\* client\_journal\_activites\_pat…

---

## [Rspec 2 (beta.11) view spec haml](https://www.ruby-forum.com/t/rspec-2-beta-11-view-spec-haml/189983)

<div class="topic-metadata">

**Author:** [@churp](https://www.ruby-forum.com/u/churp)\
**Replies:** 4\
**Last updated:** [June 11, 2010, 5:14pm UTC](https://www.ruby-forum.com/t/rspec-2-beta-11-view-spec-haml/189983 "2010-06-11T17:14:06Z")

</div>

Hello All, I’m trying to view-spec with haml require ‘spec\_helper’ describe “user\_sessions/new.html.erb” do it “renders blank form” do activate\_authlogic user\_session = UserSession.new assign :user\_session, user\_s…

---

## [RSpec 2 equivalent for: assigns\[:message\].should == @message](https://www.ruby-forum.com/t/rspec-2-equivalent-for-assigns-message-should-message/189971)

<div class="topic-metadata">

**Author:** [@kristianm](https://www.ruby-forum.com/u/kristianm)\
**Replies:** 1\
**Last updated:** [June 10, 2010, 7:12pm UTC](https://www.ruby-forum.com/t/rspec-2-equivalent-for-assigns-message-should-message/189971 "2010-06-10T19:12:59Z")

</div>

describe MessagesController, “POST create” do before(:each) do @message = mock\_model(Message, :save =\> nil) Message.stub(:new).and\_return(@message) end context “when the message fails to save” do before(:each) do @…

---

## [\[OT\] programming (OOP) principles resources](https://www.ruby-forum.com/t/ot-programming-oop-principles-resources/189946)

<div class="topic-metadata">

**Author:** [@joahking](https://www.ruby-forum.com/u/joahking)\
**Replies:** 2\
**Last updated:** [June 10, 2010, 3:23pm UTC](https://www.ruby-forum.com/t/ot-programming-oop-principles-resources/189946 "2010-06-10T15:23:27Z")

</div>

hi there, we all know good principles of OOP and P in general. But I found today that would be good to know which links (e.g \[1\] \[2\])books|reads would you recommend on the topic greetings, joaquin \[1\] http://c2.co…

---

## [Custom Matchers : Shouldn't they follow DRY principle?](https://www.ruby-forum.com/t/custom-matchers-shouldnt-they-follow-dry-principle/189931)

<div class="topic-metadata">

**Author:** [@anagri](https://www.ruby-forum.com/u/anagri)\
**Replies:** 1\
**Last updated:** [June 10, 2010, 8:12am UTC](https://www.ruby-forum.com/t/custom-matchers-shouldnt-they-follow-dry-principle/189931 "2010-06-10T08:12:38Z")

</div>

I am trying to write custom matchers for RESTful behavior of my controllers. I have created two matchers \*be\_created \*( http://github.com/anagri/rspec\_matchers/blob/80d0d021a7ad1e9af2ff18e79b80c004324abdc7/spec/suppo…

---

## [Mock\_model not working in rspec2?](https://www.ruby-forum.com/t/mock-model-not-working-in-rspec2/189934)

<div class="topic-metadata">

**Author:** [@kristianm](https://www.ruby-forum.com/u/kristianm)\
**Replies:** 1\
**Last updated:** [June 10, 2010, 7:34am UTC](https://www.ruby-forum.com/t/mock-model-not-working-in-rspec2/189934 "2010-06-10T07:34:00Z")

</div>

undefined method \`model\_name’ for Message:Class spec/views/messages/new.html.erb\_spec.rb class Message; end describe “messages/new.html.erb” do it “renders a form to create a message” do assign(:message, mock\_model(Me…

---

## [RSpec book examples online for RSpec 2.beta11 + Cucumber 0.8 + Rails 3.beta3 + Capybara](https://www.ruby-forum.com/t/rspec-book-examples-online-for-rspec-2-beta11-cucumber-0-8-rails-3-beta3-capybara/189924)

<div class="topic-metadata">

**Author:** [@kristianm](https://www.ruby-forum.com/u/kristianm)\
**Replies:** 0\
**Last updated:** [June 10, 2010, 12:02am UTC](https://www.ruby-forum.com/t/rspec-book-examples-online-for-rspec-2-beta11-cucumber-0-8-rails-3-beta3-capybara/189924 "2010-06-10T00:02:06Z")

</div>

With detailed code instructions for each step in the project wiki and in a markdown file within each app. Note: The final example is at page 351 in the b13 version of the book… more to come! Kristian

---

## [Rspec2 mock assign - how do I get the value out?](https://www.ruby-forum.com/t/rspec2-mock-assign-how-do-i-get-the-value-out/189922)

<div class="topic-metadata">

**Author:** [@kristianm](https://www.ruby-forum.com/u/kristianm)\
**Replies:** 0\
**Last updated:** [June 9, 2010, 11:48pm UTC](https://www.ruby-forum.com/t/rspec2-mock-assign-how-do-i-get-the-value-out/189922 "2010-06-09T23:48:03Z")

</div>

assign(:message, stub(“Message”)) In my view I can access the message, but… \<%= @message.to\_s %\> expected the following element's content to include "Hello world!": #\[RSpec::Mocks::Mock:0x81bbd81c @name=“Message”\] F…

---

## [Assigns in RSpec 2 - deprecation warning on rendered?](https://www.ruby-forum.com/t/assigns-in-rspec-2-deprecation-warning-on-rendered/189907)

<div class="topic-metadata">

**Author:** [@kristianm](https://www.ruby-forum.com/u/kristianm)\
**Replies:** 3\
**Last updated:** [June 9, 2010, 11:47pm UTC](https://www.ruby-forum.com/t/assigns-in-rspec-2-deprecation-warning-on-rendered/189907 "2010-06-09T23:47:28Z")

</div>

I have come to the views\_example in the RSpec book, using RSpec 2 all the way. Now I have this spec: describe “messages/show.html.erb” do it “displays the text attribute of the message” do assigns\[:message\] = stub(“M…

---

## [Error while running rspec after unpacking rails gems](https://www.ruby-forum.com/t/error-while-running-rspec-after-unpacking-rails-gems/189813)

<div class="topic-metadata">

**Author:** [@anagri](https://www.ruby-forum.com/u/anagri)\
**Replies:** 3\
**Last updated:** [June 9, 2010, 11:19pm UTC](https://www.ruby-forum.com/t/error-while-running-rspec-after-unpacking-rails-gems/189813 "2010-06-09T23:19:22Z")

</div>

I have a bunch of rspec test that are running fine when I don’t freeze them in the vendor folder. But when I freeze the rails gems, the spec starts failing with the stack /home/xuser/myprojects/xproject/config/…/vend…

---

## [Slow and high cpu in rails3?](https://www.ruby-forum.com/t/slow-and-high-cpu-in-rails3/189885)

<div class="topic-metadata">

**Author:** [@jia](https://www.ruby-forum.com/u/jia)\
**Replies:** 1\
**Last updated:** [June 9, 2010, 3:00pm UTC](https://www.ruby-forum.com/t/slow-and-high-cpu-in-rails3/189885 "2010-06-09T15:00:37Z")

</div>

Hi, I noticed that compared with rails2.3 with rspec1.3, rails3 takes much longer time for me to execute rspec and cucumber, and the cpu is high(50%+). It seems it takes most of the time for loading the environment; …

---

## [How do I stub a view in rspec-2](https://www.ruby-forum.com/t/how-do-i-stub-a-view-in-rspec-2/189887)

<div class="topic-metadata">

**Author:** [@Trey](https://www.ruby-forum.com/u/Trey)\
**Replies:** 2\
**Last updated:** [June 9, 2010, 3:00pm UTC](https://www.ruby-forum.com/t/how-do-i-stub-a-view-in-rspec-2/189887 "2010-06-09T15:00:02Z")

</div>

Hi, I’m in the process of upgrading an app to Rails 3/Rspec 2. I see that stubbing a view helper method has changed in Rspec 2. It looks like instead of doing template.stub!, we’re now supposed to do view.stub!, bu…

---

## [Adding custom directories in Rails app breaks RSpec testing](https://www.ruby-forum.com/t/adding-custom-directories-in-rails-app-breaks-rspec-testing/189884)

<div class="topic-metadata">

**Author:** [@dyba](https://www.ruby-forum.com/u/dyba)\
**Replies:** 1\
**Last updated:** [June 9, 2010, 2:59pm UTC](https://www.ruby-forum.com/t/adding-custom-directories-in-rails-app-breaks-rspec-testing/189884 "2010-06-09T14:59:26Z")

</div>

Hi: I’m trying to find out why is it when I change the Rails directory structure like so (app/controllers/physical/) does RSpec no longer work? I moved all my controller files to app/controllers/physical. Everything …

---

## [How to mock/stub a directory of files and their contents?](https://www.ruby-forum.com/t/how-to-mock-stub-a-directory-of-files-and-their-contents/189886)

<div class="topic-metadata">

**Author:** [@johnt519](https://www.ruby-forum.com/u/johnt519)\
**Replies:** 1\
**Last updated:** [June 9, 2010, 2:53pm UTC](https://www.ruby-forum.com/t/how-to-mock-stub-a-directory-of-files-and-their-contents/189886 "2010-06-09T14:53:00Z")

</div>

Hi, I’m writing a gem that enumerates the files within a specified directory and sub-directories. It’s a module that has a single class method that returns an array containing the file names, but that array will also…

---

## [How do I stub a view in rspec-2](https://www.ruby-forum.com/t/how-do-i-stub-a-view-in-rspec-2/189838)

<div class="topic-metadata">

**Author:** [@treybean](https://www.ruby-forum.com/u/treybean)\
**Replies:** 3\
**Last updated:** [June 8, 2010, 6:49pm UTC](https://www.ruby-forum.com/t/how-do-i-stub-a-view-in-rspec-2/189838 "2010-06-08T18:49:29Z")

</div>

Hi, I’m in the process of upgrading an app to Rails 3/Rspec 2. I see that stubbing a view helper method has changed in Rspec 2. It looks like instead of doing template.stub!, we’re now supposed to do view.stub!, bu…

---

## [How to test the assignment of current\_user](https://www.ruby-forum.com/t/how-to-test-the-assignment-of-current-user/189799)

<div class="topic-metadata">

**Author:** [@mhfs](https://www.ruby-forum.com/u/mhfs)\
**Replies:** 3\
**Last updated:** [June 8, 2010, 6:46pm UTC](https://www.ruby-forum.com/t/how-to-test-the-assignment-of-current-user/189799 "2010-06-08T18:46:34Z")

</div>

Hello, This could be rephrased as – How to test calls of special assigment (setter) methods? I am trying to test the assigmnet of a user object to the current\_user=(new\_user) method. It is part of an authentication …

---

## [How do I stub a view in rspec-2](https://www.ruby-forum.com/t/how-do-i-stub-a-view-in-rspec-2/189837)

<div class="topic-metadata">

**Author:** [@treybean](https://www.ruby-forum.com/u/treybean)\
**Replies:** 0\
**Last updated:** [June 8, 2010, 4:34pm UTC](https://www.ruby-forum.com/t/how-do-i-stub-a-view-in-rspec-2/189837 "2010-06-08T16:34:13Z")

</div>

Hi, I’m in the process of upgrading an app to Rails 3/Rspec 2. I see that stubbing a view helper method has changed in Rspec 2. It looks like instead of doing template.stub!, we’re now supposed to do view.stub!, bu…

---

## [Mocking and specing command line (cli) execution, file operations 	etc.?](https://www.ruby-forum.com/t/mocking-and-specing-command-line-cli-execution-file-operations-etc/189744)

<div class="topic-metadata">

**Author:** [@kristianm](https://www.ruby-forum.com/u/kristianm)\
**Replies:** 2\
**Last updated:** [June 8, 2010, 7:43am UTC](https://www.ruby-forum.com/t/mocking-and-specing-command-line-cli-execution-file-operations-etc/189744 "2010-06-08T07:43:42Z")

</div>

What are the options for creating specs for file operations, executing commands in the CLI etc.? If I build a generator or something which runs a lot of things in the command line, how do I check the results of these …

---

## [Re: mock assertions on block parameters](https://www.ruby-forum.com/t/re-mock-assertions-on-block-parameters/189780)

<div class="topic-metadata">

**Author:** [@Ben\_Butler-Cole](https://www.ruby-forum.com/u/Ben_Butler-Cole)\
**Replies:** 3\
**Last updated:** [June 7, 2010, 6:18pm UTC](https://www.ruby-forum.com/t/re-mock-assertions-on-block-parameters/189780 "2010-06-07T18:18:45Z")

</div>

On 7 June 2010 15:25, Matt W. removed\_email\_address@domain.invalid wrote: Have you seen and\_yield? I can’t quite get my head around what you’re trying to do, but it might help anyway Thank you, I have. My understan…

---

## [(no subject)](https://www.ruby-forum.com/t/no-subject/189777)

<div class="topic-metadata">

**Author:** [@Ben\_Butler-Cole](https://www.ruby-forum.com/u/Ben_Butler-Cole)\
**Replies:** 1\
**Last updated:** [June 7, 2010, 4:28pm UTC](https://www.ruby-forum.com/t/no-subject/189777 "2010-06-07T16:28:40Z")

</div>

Hello. I’m trying to use RSpec’s mocks to describe code which passes a block to a collaborator. I want to write an assertion against the value returned by the block. I can’t find any explicit support for this in RSp…

---

## [Rails 3, Rspec 2, Autotest](https://www.ruby-forum.com/t/rails-3-rspec-2-autotest/187013)

<div class="topic-metadata">

**Author:** [@mpaxton](https://www.ruby-forum.com/u/mpaxton)\
**Replies:** 11\
**Last updated:** [June 6, 2010, 8:23pm UTC](https://www.ruby-forum.com/t/rails-3-rspec-2-autotest/187013 "2010-06-06T20:23:20Z")

</div>

Trying to set up a Rails 3 project with RSpec and Autotest. I followed these steps exactly: But when I start up autotest, I get: $ autotest loading autotest/rails style: Rails instead of: $ autotest loading au…

---

## [Should I be using database\_cleaner to tear down data in RSpec 2.0 + Rails 3.0?](https://www.ruby-forum.com/t/should-i-be-using-database-cleaner-to-tear-down-data-in-rspec-2-0-rails-3-0/189705)

<div class="topic-metadata">

**Author:** [@stickstone](https://www.ruby-forum.com/u/stickstone)\
**Replies:** 9\
**Last updated:** [June 5, 2010, 10:33pm UTC](https://www.ruby-forum.com/t/should-i-be-using-database-cleaner-to-tear-down-data-in-rspec-2-0-rails-3-0/189705 "2010-06-05T22:33:01Z")

</div>

Subject pretty much asks the question

---

## [Spec.opts is deprecated - Using options file with RSpec 2](https://www.ruby-forum.com/t/spec-opts-is-deprecated-using-options-file-with-rspec-2/189708)

<div class="topic-metadata">

**Author:** [@kristianm](https://www.ruby-forum.com/u/kristianm)\
**Replies:** 3\
**Last updated:** [June 5, 2010, 9:47pm UTC](https://www.ruby-forum.com/t/spec-opts-is-deprecated-using-options-file-with-rspec-2/189708 "2010-06-05T21:47:22Z")

</div>

Using RSpec 2 beta. $ rspec spec spec/spec.opts is deprecated. please use .rspec or ~/.rspec instead. I tried renaming the file to .rspec but then it has no effect! spec/.rspec –format nested –color It works if I …

---

## [Rails 3 + RSpec-Rails 2.0 generators (different question)](https://www.ruby-forum.com/t/rails-3-rspec-rails-2-0-generators-different-question/189601)

<div class="topic-metadata">

**Author:** [@stickstone](https://www.ruby-forum.com/u/stickstone)\
**Replies:** 1\
**Last updated:** [June 3, 2010, 7:21pm UTC](https://www.ruby-forum.com/t/rails-3-rspec-rails-2-0-generators-different-question/189601 "2010-06-03T19:21:06Z")

</div>

I just tried ‘rails g rspec:model SomeModel’ and all I get back are the specs. I checked the generator file and it does seem that only the specs are being generated. Is the behavior we should expect from the rspec-rai…

---

## [Beta 9](https://www.ruby-forum.com/t/beta-9/189552)

<div class="topic-metadata">

**Author:** [@lo\_pan](https://www.ruby-forum.com/u/lo_pan)\
**Replies:** 4\
**Last updated:** [June 3, 2010, 4:22am UTC](https://www.ruby-forum.com/t/beta-9/189552 "2010-06-03T04:22:26Z")

</div>

Hi, I’ve been using rspec 2.0.0 beta 8 for a while. All specs pass. Installed beta 9, and more than half fail. Am I the only one who’s seeing this? Not sure what to do to get it all passing using beta 9… Cheers, Law…

---

## [Rails 3 + RSpec-Rails 2.0 generators?](https://www.ruby-forum.com/t/rails-3-rspec-rails-2-0-generators/189557)

<div class="topic-metadata">

**Author:** [@stickstone](https://www.ruby-forum.com/u/stickstone)\
**Replies:** 3\
**Last updated:** [June 3, 2010, 3:19am UTC](https://www.ruby-forum.com/t/rails-3-rspec-rails-2-0-generators/189557 "2010-06-03T03:19:14Z")

</div>

I followed the instructions on the wiki but I don’t seem to have the generator: rails g rspec:install Are the generators not working? btw, I don’t see rspec listed when I run ‘rails generate’ Brian

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

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