# RSpec

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

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

---

## [Expecting one of two conditions](https://www.ruby-forum.com/t/expecting-one-of-two-conditions/227277)

<div class="topic-metadata">

**Author:** [@fearless\_fool](https://www.ruby-forum.com/u/fearless_fool)\
**Replies:** 0\
**Last updated:** [March 10, 2013, 12:20am UTC](https://www.ruby-forum.com/t/expecting-one-of-two-conditions/227277 "2013-03-10T00:20:15Z")

</div>

I’m expecting my\_test to raise one error or another, but since I’m pulling data from a db, I don’t know which error it will be. Is there a better way to write this? expect { my\_test }.to raise\_error { |error| error.…

---

## [Simular to Include](https://www.ruby-forum.com/t/simular-to-include/226999)

<div class="topic-metadata">

**Author:** [@maetthew](https://www.ruby-forum.com/u/maetthew)\
**Replies:** 0\
**Last updated:** [February 28, 2013, 6:40am UTC](https://www.ruby-forum.com/t/simular-to-include/226999 "2013-02-28T06:40:42Z")

</div>

Hi, I have array1 that contains several web address. Array2 contains the expected endings of array1 values. How can I control that arrays2 values is in array1? I have tried array1.should include array2, but it requir…

---

## [Testing Controllers in Rspec](https://www.ruby-forum.com/t/testing-controllers-in-rspec/226978)

<div class="topic-metadata">

**Author:** [@learningruby](https://www.ruby-forum.com/u/learningruby)\
**Replies:** 3\
**Last updated:** [February 27, 2013, 8:20pm UTC](https://www.ruby-forum.com/t/testing-controllers-in-rspec/226978 "2013-02-27T20:20:33Z")

</div>

I am building an Rails application where the forgot password feature is implemented. I need to write the test cases for it using RSpec. I am very new to RSPEC and got the basic idea of how rspec works from the tutoria…

---

## [Speeding up RSpec Tests](https://www.ruby-forum.com/t/speeding-up-rspec-tests/229713)

<div class="topic-metadata">

**Author:** [@boobmarleyy](https://www.ruby-forum.com/u/boobmarleyy)\
**Replies:** 0\
**Last updated:** [February 13, 2013, 10:22pm UTC](https://www.ruby-forum.com/t/speeding-up-rspec-tests/229713 "2013-02-13T22:22:46Z")

</div>

Hi there, In a blog post I’ve seen that it’s really possible to speed up some of the rspec tests by small tweaks. As far as I understand, it is about BCrypt and the cost of encryption algorithms. More information: h…

---

## [Undefined method \`run\_all' for \[\]:Array](https://www.ruby-forum.com/t/undefined-method-run-all-for-array/201195)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 2\
**Last updated:** [February 7, 2013, 9:09am UTC](https://www.ruby-forum.com/t/undefined-method-run-all-for-array/201195 "2013-02-07T09:09:28Z")

</div>

I’m using the latest ruby 1.9.3-head and recently whenever I run rspec (2.2+) I get the following error: I have seen others have run into this issue, but to resolve it just rolled back to a previous version of rspec o…

---

## [How to stub a class inside a module with Mocha in Ruby?](https://www.ruby-forum.com/t/how-to-stub-a-class-inside-a-module-with-mocha-in-ruby/225773)

<div class="topic-metadata">

**Author:** [@SSkonishi\_takurou\_S](https://www.ruby-forum.com/u/SSkonishi_takurou_S)\
**Replies:** 0\
**Last updated:** [January 29, 2013, 2:15pm UTC](https://www.ruby-forum.com/t/how-to-stub-a-class-inside-a-module-with-mocha-in-ruby/225773 "2013-01-29T14:15:49Z")

</div>

I know there are lot of questions in here around this. I’ve tried all of them but none of them works. Basically, I’m trying to stub TwitterOAuth::Client so my test won’t call the real api every time. Here’s the bit fr…

---

## [Spec'ing a rails controller that does error handling](https://www.ruby-forum.com/t/specing-a-rails-controller-that-does-error-handling/225732)

<div class="topic-metadata">

**Author:** [@aris](https://www.ruby-forum.com/u/aris)\
**Replies:** 0\
**Last updated:** [January 26, 2013, 7:25pm UTC](https://www.ruby-forum.com/t/specing-a-rails-controller-that-does-error-handling/225732 "2013-01-26T19:25:16Z")

</div>

I am trying to spec a controller action that does some error handling, and I’m having a tough time expressing what I expect in rspec code. The ‘create’ action is the action in question. It is a fairly standard create …

---

## [Irelan NEEDS Ruby on Rails Developers](https://www.ruby-forum.com/t/irelan-needs-ruby-on-rails-developers/229244)

<div class="topic-metadata">

**Author:** [@kenor](https://www.ruby-forum.com/u/kenor)\
**Replies:** 0\
**Last updated:** [December 13, 2012, 4:57pm UTC](https://www.ruby-forum.com/t/irelan-needs-ruby-on-rails-developers/229244 "2012-12-13T16:57:34Z")

</div>

There is now a HUGE demand for Ruby on Rails Developers in Ireland. More and more companies have Permanent Jobs opening and there are not enough qualified developers to fill them. As a result, Ruby on Rails developers…

---

## [Getting started](https://www.ruby-forum.com/t/getting-started/224614)

<div class="topic-metadata">

**Author:** [@aris](https://www.ruby-forum.com/u/aris)\
**Replies:** 0\
**Last updated:** [November 19, 2012, 1:22pm UTC](https://www.ruby-forum.com/t/getting-started/224614 "2012-11-19T13:22:56Z")

</div>

Hi I am new to using Cucumber. I am new to Ruby basically. I have installed Ruby gems and Cucumber on my machine. How do I get started? For Eg: I need to test Google.com, then how do I start testing using Cucumber? I…

---

## [Test case creation for a pizza ordering site](https://www.ruby-forum.com/t/test-case-creation-for-a-pizza-ordering-site/224587)

<div class="topic-metadata">

**Author:** [@aris](https://www.ruby-forum.com/u/aris)\
**Replies:** 0\
**Last updated:** [November 18, 2012, 3:57am UTC](https://www.ruby-forum.com/t/test-case-creation-for-a-pizza-ordering-site/224587 "2012-11-18T03:57:58Z")

</div>

Hi, I am new to Ruby and Cucumber. Can anyone help me with creating test scripts using cucumber for a pizza ordering site which requires a login or new user creation to place an order. Thanks !

---

## [Controller specs and default\_url\_options](https://www.ruby-forum.com/t/controller-specs-and-default-url-options/215821)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 4\
**Last updated:** [November 12, 2012, 4:07pm UTC](https://www.ruby-forum.com/t/controller-specs-and-default-url-options/215821 "2012-11-12T16:07:40Z")

</div>

Hello, I’m using Rails 3.1.3 with rspec-rails 2.8.1. I have a scope ‘:locale’ in routes.rb and I want to run controller and routing specs. I’m aware of the problem with setting default\_url\_options in application.rb c…

---

## [Rspec failure upon revisit](https://www.ruby-forum.com/t/rspec-failure-upon-revisit/224285)

<div class="topic-metadata">

**Author:** [@aris](https://www.ruby-forum.com/u/aris)\
**Replies:** 1\
**Last updated:** [November 7, 2012, 4:35pm UTC](https://www.ruby-forum.com/t/rspec-failure-upon-revisit/224285 "2012-11-07T16:35:52Z")

</div>

I just returned from a different project after taking a few weeks off of my tutorial. I’m using Ruby on Rails 3 Tutorial - Learn Rails by Example by Michael H… After rebooting my server I ran an rspec spec/ command t…

---

## [.rspec ci reporter configuration file](https://www.ruby-forum.com/t/rspec-ci-reporter-configuration-file/224187)

<div class="topic-metadata">

**Author:** [@aris](https://www.ruby-forum.com/u/aris)\
**Replies:** 0\
**Last updated:** [November 2, 2012, 11:07am UTC](https://www.ruby-forum.com/t/rspec-ci-reporter-configuration-file/224187 "2012-11-02T11:07:15Z")

</div>

Is there a way to add date to report.html file name so that it looks like for example: report\_02\_11\_2012.html my current configuration looks like: –out /somefolder/report.html

---

## [Change() vs change{}](https://www.ruby-forum.com/t/change-vs-change/223952)

<div class="topic-metadata">

**Author:** [@aris](https://www.ruby-forum.com/u/aris)\
**Replies:** 0\
**Last updated:** [October 24, 2012, 6:26pm UTC](https://www.ruby-forum.com/t/change-vs-change/223952 "2012-10-24T18:26:53Z")

</div>

Hi, I am doing the rails tutorial and there is a line: expect { click\_button submit }.not\_to change(User, :count) When I looked up the rspec docs and book too, I found: change {} documentation (using curly brackets). …

---

## [Rspec for thor script](https://www.ruby-forum.com/t/rspec-for-thor-script/222915)

<div class="topic-metadata">

**Author:** [@aris](https://www.ruby-forum.com/u/aris)\
**Replies:** 0\
**Last updated:** [September 14, 2012, 6:31pm UTC](https://www.ruby-forum.com/t/rspec-for-thor-script/222915 "2012-09-14T18:31:19Z")

</div>

Hello all, I recently developed a CLI extending thor API. While i was trying to write specs for thor’s tasks, I couldn’t find any way to write the same for tasks with mandatory options or with options. So can anyone…

---

## [Drawing the line between controller and integration tests](https://www.ruby-forum.com/t/drawing-the-line-between-controller-and-integration-tests/222791)

<div class="topic-metadata">

**Author:** [@aris](https://www.ruby-forum.com/u/aris)\
**Replies:** 1\
**Last updated:** [September 11, 2012, 12:28am UTC](https://www.ruby-forum.com/t/drawing-the-line-between-controller-and-integration-tests/222791 "2012-09-11T00:28:25Z")

</div>

I’m trying to understand what belongs – and what doesn’t belong – in controller tests and in integration tests. As a common example, assume I have a list of named widgets. Somewhere in my code, I want to verify that …

---

## [Stub a controller private method containing arguments](https://www.ruby-forum.com/t/stub-a-controller-private-method-containing-arguments/222748)

<div class="topic-metadata">

**Author:** [@aris](https://www.ruby-forum.com/u/aris)\
**Replies:** 0\
**Last updated:** [September 9, 2012, 8:00am UTC](https://www.ruby-forum.com/t/stub-a-controller-private-method-containing-arguments/222748 "2012-09-09T08:00:25Z")

</div>

controller code: class BooksController \< ApplicationController def index param1, param2 = “123”, “456” @test = method\_1(param1, param2) end private def method\_1(param1, param2) return “test” end end controller…

---

## [Newbie testing questions](https://www.ruby-forum.com/t/newbie-testing-questions/220205)

<div class="topic-metadata">

**Author:** [@Gurdipe\_D](https://www.ruby-forum.com/u/Gurdipe_D)\
**Replies:** 1\
**Last updated:** [September 7, 2012, 9:14pm UTC](https://www.ruby-forum.com/t/newbie-testing-questions/220205 "2012-09-07T21:14:10Z")

</div>

I recently wrote my first gem and am now in the process of learning how to write tests for it before I release. My gem is pretty basic and really just has a few class files with some methods for using GET to an API t…

---

## [RSpec Selenium Webdriver Html Report with Screenshots](https://www.ruby-forum.com/t/rspec-selenium-webdriver-html-report-with-screenshots/222568)

<div class="topic-metadata">

**Author:** [@aris](https://www.ruby-forum.com/u/aris)\
**Replies:** 3\
**Last updated:** [September 3, 2012, 7:59pm UTC](https://www.ruby-forum.com/t/rspec-selenium-webdriver-html-report-with-screenshots/222568 "2012-09-03T19:59:21Z")

</div>

Hello, I’m using Rake + RSpec + Selenium-WebDriver for the web testing, Is there a way to create html report with the screenshot generated on failure? Would really appreciate your help!

---

## [Rspec: How to mock class method](https://www.ruby-forum.com/t/rspec-how-to-mock-class-method/221714)

<div class="topic-metadata">

**Author:** [@aris](https://www.ruby-forum.com/u/aris)\
**Replies:** 0\
**Last updated:** [July 27, 2012, 7:31am UTC](https://www.ruby-forum.com/t/rspec-how-to-mock-class-method/221714 "2012-07-27T07:31:03Z")

</div>

Hi, I have two model: Message, User message.rb class Message \< ActiveRecord::Base class \<\< self def method\_a(args) \[1,2\] end end end user.rb class User \< ActiveRecord::Base def method\_user if …

---

## [Strange error when running bundle exec rspec spec](https://www.ruby-forum.com/t/strange-error-when-running-bundle-exec-rspec-spec/218586)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [July 25, 2012, 9:31am UTC](https://www.ruby-forum.com/t/strange-error-when-running-bundle-exec-rspec-spec/218586 "2012-07-25T09:31:29Z")

</div>

Hi I have been following the online rails tutorial written by Micheal Hartl, can be found here: http://ruby.railstutorial.org/chapters/beginning#top As I have been going through the chapters, at first the rspec tests…

---

## [Unable to Run 'bundle exec cucumber'](https://www.ruby-forum.com/t/unable-to-run-bundle-exec-cucumber/221640)

<div class="topic-metadata">

**Author:** [@aris](https://www.ruby-forum.com/u/aris)\
**Replies:** 0\
**Last updated:** [July 23, 2012, 6:32pm UTC](https://www.ruby-forum.com/t/unable-to-run-bundle-exec-cucumber/221640 "2012-07-23T18:32:25Z")

</div>

Hi, I have a cucumber problem that is preventing me from running all my feature files, anyone has come across to this problem ? On Windows with. cucumber (1.2.1, 0.9.4) Command: bundle exec cucumber C:/Ruby187/lib…

---

## [RSpec/rails & Capybara: #within](https://www.ruby-forum.com/t/rspec-rails-capybara-within/221611)

<div class="topic-metadata">

**Author:** [@aris](https://www.ruby-forum.com/u/aris)\
**Replies:** 0\
**Last updated:** [July 22, 2012, 11:08pm UTC](https://www.ruby-forum.com/t/rspec-rails-capybara-within/221611 "2012-07-22T23:08:23Z")

</div>

I’m new to Capybara and after a good amount of google, I still can’t figure out how the #within methods works! I can use it only if I call visit before? There’s no way to use it on a string, like the page = Capybara.s…

---

## [Describe, context, feature, scenario](https://www.ruby-forum.com/t/describe-context-feature-scenario/226331)

<div class="topic-metadata">

**Author:** [@random52k](https://www.ruby-forum.com/u/random52k)\
**Replies:** 0\
**Last updated:** [July 16, 2012, 3:28am UTC](https://www.ruby-forum.com/t/describe-context-feature-scenario/226331 "2012-07-16T03:28:21Z")

</div>

Describe, context, feature, scenario: what is the difference between the four and when do I use each one? thanks, mike

---

## [Running Rspec tests with JRuby fails](https://www.ruby-forum.com/t/running-rspec-tests-with-jruby-fails/221284)

<div class="topic-metadata">

**Author:** [@aris](https://www.ruby-forum.com/u/aris)\
**Replies:** 0\
**Last updated:** [July 6, 2012, 9:41pm UTC](https://www.ruby-forum.com/t/running-rspec-tests-with-jruby-fails/221284 "2012-07-06T21:41:31Z")

</div>

How to run RSpec tests with JRuby in a Java project? I tried to run it with JRuby 1.7.0.preview1, rspec (2.10.0) rspec-core (2.10.1) rspec-expectations (2.10.0) rspec-mocks (2.10.1) rspec-rails (2.10.1) as follows…

---

## [Rails validation spec fails (but code works in development env)](https://www.ruby-forum.com/t/rails-validation-spec-fails-but-code-works-in-development-env/209291)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 2\
**Last updated:** [July 4, 2012, 10:24am UTC](https://www.ruby-forum.com/t/rails-validation-spec-fails-but-code-works-in-development-env/209291 "2012-07-04T10:24:56Z")

</div>

I’m not sure if this is the best way to validate a foreign key in rails, but I am using the following validation to do so (Rails 3, Rspec 2): class Item \< ActiveRecord::Base validates :manufacturer\_id, :inclusion =\> {…

---

## [An open source project with very good use of Cucumber?](https://www.ruby-forum.com/t/an-open-source-project-with-very-good-use-of-cucumber/220858)

<div class="topic-metadata">

**Author:** [@aris](https://www.ruby-forum.com/u/aris)\
**Replies:** 2\
**Last updated:** [June 22, 2012, 2:42pm UTC](https://www.ruby-forum.com/t/an-open-source-project-with-very-good-use-of-cucumber/220858 "2012-06-22T14:42:13Z")

</div>

Hey everybody I came here through the RSpec Book, so I grant myself to ask something about Cucumber here. :wink: I’m still very new to the topic and read a lot of different opinions about how to do great Cucumber sce…

---

## [Selenium+Autotest: how to run browser in background?](https://www.ruby-forum.com/t/selenium-autotest-how-to-run-browser-in-background/220624)

<div class="topic-metadata">

**Author:** [@aris](https://www.ruby-forum.com/u/aris)\
**Replies:** 1\
**Last updated:** [June 22, 2012, 11:38am UTC](https://www.ruby-forum.com/t/selenium-autotest-how-to-run-browser-in-background/220624 "2012-06-22T11:38:28Z")

</div>

Hey guys After hours of hard work I finally managed to set up my development environment to run cucumber scenarios using autotest and selenium. What’s a bit bugging is the fact that Firefox always jumps to the foregr…

---

## [Response.should have\_content("1 movie") does not seem to work for me](https://www.ruby-forum.com/t/response-should-have-content-1-movie-does-not-seem-to-work-for-me/220607)

<div class="topic-metadata">

**Author:** [@aris](https://www.ruby-forum.com/u/aris)\
**Replies:** 1\
**Last updated:** [June 22, 2012, 11:36am UTC](https://www.ruby-forum.com/t/response-should-have-content-1-movie-does-not-seem-to-work-for-me/220607 "2012-06-22T11:36:52Z")

</div>

Hey everybody I have worked quite to near the end of The RSpec Book, but now I’m having some troubles. I’m trying to get the last few Cucumber steps to work, which are: Then /^Caddyshack should be in the Comedy genre…

---

## [File not found](https://www.ruby-forum.com/t/file-not-found/220836)

<div class="topic-metadata">

**Author:** [@aris](https://www.ruby-forum.com/u/aris)\
**Replies:** 0\
**Last updated:** [June 21, 2012, 7:12pm UTC](https://www.ruby-forum.com/t/file-not-found/220836 "2012-06-21T19:12:33Z")

</div>

I’ve been trying to learn RSpec using the book The RSpec Book by David Chelimsky but I’ve been having a problem in Chapter 5 around page 50. I tried running “rspec spec/codebreaker/game\_spec.rb --format doc” but it sa…

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

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