# RSpec

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

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

---

## [Rspec and requests, and folders conventions](https://www.ruby-forum.com/t/rspec-and-requests-and-folders-conventions/215800)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [January 16, 2012, 5:45pm UTC](https://www.ruby-forum.com/t/rspec-and-requests-and-folders-conventions/215800 "2012-01-16T17:45:43Z")

</div>

I’m trying to run rspec requests, using jruby, and I set the defaults in a env.rb file, but it doesn’t seem to be loaded when I run the specs. My folder setup is: /spec/requests/ /spec/requests/section/section\_spec.…

---

## [What does 'these' mean in a PUT controller spec?](https://www.ruby-forum.com/t/what-does-these-mean-in-a-put-controller-spec/215792)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [January 16, 2012, 3:00pm UTC](https://www.ruby-forum.com/t/what-does-these-mean-in-a-put-controller-spec/215792 "2012-01-16T15:00:12Z")

</div>

hi, all, the spec above is found in my controller spec for a ‘category’ resource. It’s a generated spec. ----- start extract -------------------------------------------- describe “PUT update” do describe “with vali…

---

## [How to mock out a WEBrick::HTTPServer?](https://www.ruby-forum.com/t/how-to-mock-out-a-webrick-httpserver/215770)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 1\
**Last updated:** [January 15, 2012, 6:52pm UTC](https://www.ruby-forum.com/t/how-to-mock-out-a-webrick-httpserver/215770 "2012-01-15T18:52:02Z")

</div>

partial code : http://pastie.org/3186140 I want to test a HTTP server, I’m using lower level stuff so I can understand whats going on, then I might move onto FakeWeb/WebMock/etc Its a reverse proxy, so it doesn’t gene…

---

## [Stub().and\_raise() ain't raising?](https://www.ruby-forum.com/t/stub-and-raise-aint-raising/215702)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 3\
**Last updated:** [January 13, 2012, 6:18am UTC](https://www.ruby-forum.com/t/stub-and-raise-aint-raising/215702 "2012-01-13T06:18:02Z")

</div>

I have two blocks of tests: one for testing positive outcomes and one for testing negative. After poking around, I’ve concluded that the underlying :verify\_credentials method is getting called, despite the stub: des…

---

## [Problems using config.extend(Macro)](https://www.ruby-forum.com/t/problems-using-config-extend-macro/215613)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 4\
**Last updated:** [January 10, 2012, 8:56pm UTC](https://www.ruby-forum.com/t/problems-using-config-extend-macro/215613 "2012-01-10T20:56:48Z")

</div>

Happy New Year everyone!! I’m having a painful upgrade from Rails 2.3.11 to Rails 3.1.3 and one of the problems is with the following… Under Ruby 1.8.7 - Rails 2.3.11 - Rspec 1: I have model\_macros.rb under spec/spec…

---

## [View\_context in specs](https://www.ruby-forum.com/t/view-context-in-specs/213470)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 4\
**Last updated:** [January 10, 2012, 12:37am UTC](https://www.ruby-forum.com/t/view-context-in-specs/213470 "2012-01-10T00:37:47Z")

</div>

I have a presenter class which is instantiated like this: class Blah def initialize(context) @context = context end def do\_something\_view\_related @context.render :partial =\> “/…somewhere” end def do\_something\_els…

---

## [RSpec mock question](https://www.ruby-forum.com/t/rspec-mock-question/215591)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 3\
**Last updated:** [January 9, 2012, 9:19pm UTC](https://www.ruby-forum.com/t/rspec-mock-question/215591 "2012-01-09T21:19:44Z")

</div>

How can I mock the XMLRPC::Client.new3 class method using rspec’s mock? I expected this spec: describe Foo do it 'should call new3' do options = {} XMLRPC::Client.any\_instance.should\_receive(:…

---

## [Rspec for this class](https://www.ruby-forum.com/t/rspec-for-this-class/215567)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [January 8, 2012, 11:39pm UTC](https://www.ruby-forum.com/t/rspec-for-this-class/215567 "2012-01-08T23:39:46Z")

</div>

Hi All I am new to rspec. How can I write specs for this class Anyone please provide me the detail specs for this class thanks module Sitemap class Job def initialize(country\_version, directory, country\_host) @co…

---

## [Design love for rspec.info](https://www.ruby-forum.com/t/design-love-for-rspec-info/215544)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 0\
**Last updated:** [January 7, 2012, 7:08pm UTC](https://www.ruby-forum.com/t/design-love-for-rspec-info/215544 "2012-01-07T19:08:42Z")

</div>

Hi everyone, I would like to help on designing rspec.info. What can I do to begin? Thank you. Best, Jos M. www.josemota.net

---

## [Help for a project](https://www.ruby-forum.com/t/help-for-a-project/215543)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 0\
**Last updated:** [January 7, 2012, 6:47pm UTC](https://www.ruby-forum.com/t/help-for-a-project/215543 "2012-01-07T18:47:04Z")

</div>

Hi David, I am reading your book about Rspec because I am starting a framework from scratch for my job for a big client (american express)… and I would like ask you some question regarding some things I would like a…

---

## [Where does cucumber.yml live?](https://www.ruby-forum.com/t/where-does-cucumber-yml-live/162078)

<div class="topic-metadata">

**Author:** [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Replies:** 19\
**Last updated:** [January 7, 2012, 1:52am UTC](https://www.ruby-forum.com/t/where-does-cucumber-yml-live/162078 "2012-01-07T01:52:25Z")

</div>

Where do I put cucumber.yml? I can’t find anything mentioned in the documentation. Thanks John S.

---

## [Why is 'get :index, :page =\> 2' different from 'get :index, :page =\> "2"'](https://www.ruby-forum.com/t/why-is-get-index-page-2-different-from-get-index-page-2/215497)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 2\
**Last updated:** [January 6, 2012, 1:16am UTC](https://www.ruby-forum.com/t/why-is-get-index-page-2-different-from-get-index-page-2/215497 "2012-01-06T01:16:57Z")

</div>

Hi, After coding my app and enjoying a green wave of tests, I had horrible feedback about some bugs. Those bugs happened to some well tested parts of my app. After some research, I found out that get :index, :page =\>…

---

## [Testing dragonfly image attachment](https://www.ruby-forum.com/t/testing-dragonfly-image-attachment/215361)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 0\
**Last updated:** [January 1, 2012, 7:03pm UTC](https://www.ruby-forum.com/t/testing-dragonfly-image-attachment/215361 "2012-01-01T19:03:20Z")

</div>

Hi people. I have the following problem when testing a project model with an attached dragonfly logo: When building a project test record through factory girl the project seems valid, but testing project.should be\_val…

---

## [First Model Macro](https://www.ruby-forum.com/t/first-model-macro/215203)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 4\
**Last updated:** [December 26, 2011, 10:44pm UTC](https://www.ruby-forum.com/t/first-model-macro/215203 "2011-12-26T22:44:46Z")

</div>

Hello all, I trust you are having a good one. I’m just trying out macros and my first one is taken from the RSpec book which replaces … @obj.should\_not be\_valid @obj.should have(1).error\_on(:attr) with the macro… s…

---

## [Problem with stub](https://www.ruby-forum.com/t/problem-with-stub/215148)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 0\
**Last updated:** [December 23, 2011, 3:24pm UTC](https://www.ruby-forum.com/t/problem-with-stub/215148 "2011-12-23T15:24:01Z")

</div>

Respecting the Dry principle, I posted the link of my question as follow: http://stackoverflow.com/questions/8616186/problems-with-stubs If anybody know about this issue, please, give me some help

---

## [Sending rails errors to rspec output](https://www.ruby-forum.com/t/sending-rails-errors-to-rspec-output/215103)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 6\
**Last updated:** [December 22, 2011, 8:33pm UTC](https://www.ruby-forum.com/t/sending-rails-errors-to-rspec-output/215103 "2011-12-22T20:33:37Z")

</div>

I am using Capybara in combination with rspec for integration testing of rails apps. I would like any errors (routing errors, errors in a controller, anything) generated during a test to be printed the same as “puts” …

---

## [Custom error handling](https://www.ruby-forum.com/t/custom-error-handling/215104)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 0\
**Last updated:** [December 22, 2011, 6:08am UTC](https://www.ruby-forum.com/t/custom-error-handling/215104 "2011-12-22T06:08:34Z")

</div>

Hello everyone, I’m currently using rspec2 wit capybara to do some selenium tests. I want to put this on a CI server and run the tests regularly. capybara already has a functionality to save a screenshot. I’d like to …

---

## [Matcher for testing file content](https://www.ruby-forum.com/t/matcher-for-testing-file-content/215046)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 2\
**Last updated:** [December 20, 2011, 3:10pm UTC](https://www.ruby-forum.com/t/matcher-for-testing-file-content/215046 "2011-12-20T15:10:06Z")

</div>

Hi. Is there any matcher for test file content, anything like file("/path/to/file.txt").should contain(“File content”) or file("/path/to/file.txt").content.should == “File content” or file\_content("/path/to/file.tx…

---

## [Problem with RSpec, Rails or Me? (I know the answer is me!)](https://www.ruby-forum.com/t/problem-with-rspec-rails-or-me-i-know-the-answer-is-me/215019)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 3\
**Last updated:** [December 20, 2011, 11:25am UTC](https://www.ruby-forum.com/t/problem-with-rspec-rails-or-me-i-know-the-answer-is-me/215019 "2011-12-20T11:25:53Z")

</div>

This could just be my lack of knowledge of how Rails works but from the following code in my RSpec test … $stderr.puts “BEFORE: #{@invitation.meeting.event.event\_type.event\_type\_time\_units.inspect}” @invitation.save! …

---

## [Rake spec aborted, how to debug](https://www.ruby-forum.com/t/rake-spec-aborted-how-to-debug/214221)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [December 19, 2011, 3:02pm UTC](https://www.ruby-forum.com/t/rake-spec-aborted-how-to-debug/214221 "2011-12-19T15:02:21Z")

</div>

Hello, I’m having an issue running specs on a Rails project. Here’s how bundle exec rake spec --trace ends at a random point after some seconds of hanging with a high CPU usage: I say “a random point” because I can …

---

## [How can shared examples be shared across gems?](https://www.ruby-forum.com/t/how-can-shared-examples-be-shared-across-gems/214761)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 4\
**Last updated:** [December 16, 2011, 2:29am UTC](https://www.ruby-forum.com/t/how-can-shared-examples-be-shared-across-gems/214761 "2011-12-16T02:29:38Z")

</div>

Hi, I have shared examples in a gem… some\_gem\_name/spec/some\_gem\_name/shared\_examples.rb …where the shared examples are contained in a module, e.g., module SharedExamples shared\_examples\_for … end How can I includ…

---

## [Difference between "get '/path/'" and "get :symbol"?](https://www.ruby-forum.com/t/difference-between-get-path-and-get-symbol/214883)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [December 14, 2011, 9:49pm UTC](https://www.ruby-forum.com/t/difference-between-get-path-and-get-symbol/214883 "2011-12-14T21:49:57Z")

</div>

What’s the difference between these two forms, in a spec file? get ‘/prefix/resources’ # get index of resources get :index # get index of resources I have some tests that work one way, some that work the …

---

## [Problem running tests of helpers](https://www.ruby-forum.com/t/problem-running-tests-of-helpers/204888)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 4\
**Last updated:** [December 14, 2011, 7:19pm UTC](https://www.ruby-forum.com/t/problem-running-tests-of-helpers/204888 "2011-12-14T19:19:55Z")

</div>

I’m in the process of upgrading from ruby 1.8.7 to ruby-1.9.2-p18 and from rails 2.3.8 to rails 2.3.9 and my tests of helpers have stopped working, for example script/spec spec/helpers/application\_helper\_spec.rb (F…

---

## [\[ANN\] rspec-ontap](https://www.ruby-forum.com/t/ann-rspec-ontap/214880)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 0\
**Last updated:** [December 14, 2011, 6:19pm UTC](https://www.ruby-forum.com/t/ann-rspec-ontap/214880 "2011-12-14T18:19:46Z")

</div>

Hi– I just released “RSpec On Tap”. It is a TAP-Y/J formatter for RSpec that one can use with TapOut to produce a variety of test reports. TAP-Y/J provides a standard format which test frameworks can produce and tes…

---

## [RSpec's RDoc](https://www.ruby-forum.com/t/rspecs-rdoc/214836)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 0\
**Last updated:** [December 13, 2011, 4:11pm UTC](https://www.ruby-forum.com/t/rspecs-rdoc/214836 "2011-12-13T16:11:12Z")

</div>

Hey all, I’ve been (finally) investing some time in RSpec’s RDoc. It’s gotten a lot better, but there is definitely more work to do. If you’re interested in helping out, please peruse the docs for each lib and file g…

---

## [RSpec TextMate bundle maintainer?](https://www.ruby-forum.com/t/rspec-textmate-bundle-maintainer/214832)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 0\
**Last updated:** [December 13, 2011, 1:22pm UTC](https://www.ruby-forum.com/t/rspec-textmate-bundle-maintainer/214832 "2011-12-13T13:22:03Z")

</div>

Hi all, I’m looking for volunteers to help maintain the RSpec TextMate bundle. I stopped using TextMate as my main editor two years ago now,\* so I don’t have day to day experience with it, and I can barely keep up wit…

---

## [Recommendations for writing view index spec for a resource which behaves differently for different u](https://www.ruby-forum.com/t/recommendations-for-writing-view-index-spec-for-a-resource-which-behaves-differently-for-different-u/214786)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 1\
**Last updated:** [December 12, 2011, 3:29pm UTC](https://www.ruby-forum.com/t/recommendations-for-writing-view-index-spec-for-a-resource-which-behaves-differently-for-different-u/214786 "2011-12-12T15:29:11Z")

</div>

hi guys, In my index view specs for a given resource, I have successfully written it for admin users. For the given resource, when admin users are looking at the index page, they should see -a link to add a new reso…

---

## [Strange time reporting](https://www.ruby-forum.com/t/strange-time-reporting/214709)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 6\
**Last updated:** [December 9, 2011, 7:58pm UTC](https://www.ruby-forum.com/t/strange-time-reporting/214709 "2011-12-09T19:58:22Z")

</div>

While running some specs of a new fresh Rails 3.1 project with latest Rspec, I’m getting some strange time reporting (using --drb and spork): Finished in 731.67 seconds 10 examples, 0 failures But it actually run “ti…

---

## [How to test arguments going into a mailer method?](https://www.ruby-forum.com/t/how-to-test-arguments-going-into-a-mailer-method/214683)

<div class="topic-metadata">

**Author:** [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Replies:** 1\
**Last updated:** [December 9, 2011, 11:52am UTC](https://www.ruby-forum.com/t/how-to-test-arguments-going-into-a-mailer-method/214683 "2011-12-09T11:52:45Z")

</div>

Hi, So I am not really interested in testing the content of the actual body of an outgoing email. I trust that Rails’ internal mechanisms work, however recently I came across some code that did something that I did…

---

## [Expecting multiple changes (chaining)](https://www.ruby-forum.com/t/expecting-multiple-changes-chaining/214666)

<div class="topic-metadata">

**Author:** [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Replies:** 1\
**Last updated:** [December 8, 2011, 11:34pm UTC](https://www.ruby-forum.com/t/expecting-multiple-changes-chaining/214666 "2011-12-08T23:34:16Z")

</div>

Hi RSpec list, I have a question about the “expect { … }.to change” construct (https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers/expect-change): Is there an idiomatic way to test for multiple c…

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

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