# RSpec

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

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

---

## [What's the best way to test inherited behavior?](https://www.ruby-forum.com/t/whats-the-best-way-to-test-inherited-behavior/150546)

<div class="topic-metadata">

**Author:** [@foobarwidget](https://www.ruby-forum.com/u/foobarwidget)\
**Replies:** 7\
**Last updated:** [October 10, 2008, 9:53am UTC](https://www.ruby-forum.com/t/whats-the-best-way-to-test-inherited-behavior/150546 "2008-10-10T09:53:58Z")

</div>

I currently have a base class and 2 subclasses. I’m struggling with finding the best way to test them. This is the current situation. The base class is called AbstractServer. It’s not really abstract because it can be…

---

## [Should !=](https://www.ruby-forum.com/t/should/150570)

<div class="topic-metadata">

**Author:** [@marksbrain](https://www.ruby-forum.com/u/marksbrain)\
**Replies:** 3\
**Last updated:** [October 10, 2008, 2:23am UTC](https://www.ruby-forum.com/t/should/150570 "2008-10-10T02:23:11Z")

</div>

I expected ‘should !=’ to act the same as ‘should\_not ==’. That turned out to be incorrect (by design?): require ‘spec’ require ‘spec/rails’ describe “using ‘should !=’” do it “seems to treat != as the same as ==” …

---

## [Refactoring and using each](https://www.ruby-forum.com/t/refactoring-and-using-each/150425)

<div class="topic-metadata">

**Author:** [@Jeroen\_van\_Dijk](https://www.ruby-forum.com/u/Jeroen_van_Dijk)\
**Replies:** 2\
**Last updated:** [October 9, 2008, 9:27pm UTC](https://www.ruby-forum.com/t/refactoring-and-using-each/150425 "2008-10-09T21:27:52Z")

</div>

Hi all, I’m new to this list and new to RSpec so I have been trying out RSpec the last couple of days and I find it very a natural way of testing. So first of all thanks for providing this framework. Now, I have wr…

---

## [How to set up data before story runner steps?](https://www.ruby-forum.com/t/how-to-set-up-data-before-story-runner-steps/130302)

<div class="topic-metadata">

**Author:** [@Bei](https://www.ruby-forum.com/u/Bei)\
**Replies:** 3\
**Last updated:** [October 9, 2008, 3:25pm UTC](https://www.ruby-forum.com/t/how-to-set-up-data-before-story-runner-steps/130302 "2008-10-09T15:25:11Z")

</div>

Hi I'm using story runner of RSpec now. What I'm trying to do is initializing the @selenium before any steps of one story is executing, and stop @selenium after any story is finished. just as @BeforeClass and @After…

---

## [ArgumentError in "is a pending example" - block not supplied](https://www.ruby-forum.com/t/argumenterror-in-is-a-pending-example-block-not-supplied/150454)

<div class="topic-metadata">

**Author:** [@mwalsh](https://www.ruby-forum.com/u/mwalsh)\
**Replies:** 3\
**Last updated:** [October 9, 2008, 12:31pm UTC](https://www.ruby-forum.com/t/argumenterror-in-is-a-pending-example-block-not-supplied/150454 "2008-10-09T12:31:57Z")

</div>

We have a few unfinished examples in our code of the form it “should and does do something” do # stuff end it “should do something someday” it “should and does do something else” do # more stuff end Now since I u…

---

## [About received unexpected message :code with (no args)](https://www.ruby-forum.com/t/about-received-unexpected-message-code-with-no-args/150518)

<div class="topic-metadata">

**Author:** [@guofeng](https://www.ruby-forum.com/u/guofeng)\
**Replies:** 1\
**Last updated:** [October 9, 2008, 12:24pm UTC](https://www.ruby-forum.com/t/about-received-unexpected-message-code-with-no-args/150518 "2008-10-09T12:24:52Z")

</div>

I use rspec\_scaffold to generate a part of examples as below: it “should expose a newly created awarding\_body as @awarding\_body” do AwardingBody.should\_receive(:new).with({‘these’ =\> ‘params’}).and\_return(mock\_awardin…

---

## [When is spec\_helper.rb actually executed?](https://www.ruby-forum.com/t/when-is-spec-helper-rb-actually-executed/150477)

<div class="topic-metadata">

**Author:** [@weyus](https://www.ruby-forum.com/u/weyus)\
**Replies:** 8\
**Last updated:** [October 9, 2008, 3:53am UTC](https://www.ruby-forum.com/t/when-is-spec-helper-rb-actually-executed/150477 "2008-10-09T03:53:10Z")

</div>

I’m trying to debug what I suspect is a case where spec\_helper.rb is not being executed. I put a puts statement inside the Spec::Runner.configure do |config| block, and I can’t ever see the printout. When does spec\_h…

---

## [Basic Rspec operation questions](https://www.ruby-forum.com/t/basic-rspec-operation-questions/150458)

<div class="topic-metadata">

**Author:** [@weyus](https://www.ruby-forum.com/u/weyus)\
**Replies:** 9\
**Last updated:** [October 9, 2008, 2:46am UTC](https://www.ruby-forum.com/t/basic-rspec-operation-questions/150458 "2008-10-09T02:46:21Z")

</div>

With Rails, is “rake spec” supposed to automatically run under the test environment? I have to do “rake spec RAILS\_ENV=test” in order to get the environments/test.rb file to load. Also, are the standard Test::Unit fi…

---

## [Testing Views with Authentication](https://www.ruby-forum.com/t/testing-views-with-authentication/150481)

<div class="topic-metadata">

**Author:** [@Donald\_F](https://www.ruby-forum.com/u/Donald_F)\
**Replies:** 2\
**Last updated:** [October 9, 2008, 2:22am UTC](https://www.ruby-forum.com/t/testing-views-with-authentication/150481 "2008-10-09T02:22:56Z")

</div>

I am trying to figure out how to properly test a view when part of the view is is protected with a role check \<% if current\_user.admin? %\>… How do I force a log in or mock the current user. I need to do it in a DRY wa…

---

## [What makes specs run against the test database?](https://www.ruby-forum.com/t/what-makes-specs-run-against-the-test-database/150487)

<div class="topic-metadata">

**Author:** [@weyus](https://www.ruby-forum.com/u/weyus)\
**Replies:** 2\
**Last updated:** [October 9, 2008, 2:14am UTC](https://www.ruby-forum.com/t/what-makes-specs-run-against-the-test-database/150487 "2008-10-09T02:14:45Z")

</div>

I just did a test where I ran one spec and deep deep within the code under test, I printed out the DB connection of the AR class of a given object, like so: puts invoice.class.connection.inspect My spec requires spec…

---

## [Cucumber and fixtures](https://www.ruby-forum.com/t/cucumber-and-fixtures/150431)

<div class="topic-metadata">

**Author:** [@agnathan](https://www.ruby-forum.com/u/agnathan)\
**Replies:** 7\
**Last updated:** [October 9, 2008, 1:19am UTC](https://www.ruby-forum.com/t/cucumber-and-fixtures/150431 "2008-10-09T01:19:44Z")

</div>

Is it possible to use spec fixtures with Cucumber, and if so, how? Thanks, Daniel H.

---

## [Rspec: gem vs. plugin?](https://www.ruby-forum.com/t/rspec-gem-vs-plugin/150456)

<div class="topic-metadata">

**Author:** [@weyus](https://www.ruby-forum.com/u/weyus)\
**Replies:** 7\
**Last updated:** [October 9, 2008, 12:32am UTC](https://www.ruby-forum.com/t/rspec-gem-vs-plugin/150456 "2008-10-09T00:32:22Z")

</div>

All, I have some experience with Rspec from about a year ago. At that time, there was a gem and a plugin, and a Rspec on Rails plugin. Should I only be using the gem? With the 1.1.8 gem, if I try to do “rake rspec” …

---

## [Route\_for()](https://www.ruby-forum.com/t/route-for/150473)

<div class="topic-metadata">

**Author:** [@anita](https://www.ruby-forum.com/u/anita)\
**Replies:** 2\
**Last updated:** [October 8, 2008, 11:47pm UTC](https://www.ruby-forum.com/t/route-for/150473 "2008-10-08T23:47:54Z")

</div>

Hello, Can I test in the spec the route taken by the redirect\_to from the controller? The URL is not controller/action. I tried: route\_for(:controller =\> “signup”, :action =\> “confirmation”).should == “/my/set/URL” …

---

## [Making Rspec errors with anything less verbose](https://www.ruby-forum.com/t/making-rspec-errors-with-anything-less-verbose/150448)

<div class="topic-metadata">

**Author:** [@joesniff](https://www.ruby-forum.com/u/joesniff)\
**Replies:** 0\
**Last updated:** [October 8, 2008, 5:43pm UTC](https://www.ruby-forum.com/t/making-rspec-errors-with-anything-less-verbose/150448 "2008-10-08T17:43:43Z")

</div>

Hello, I was doing some work on cucumber and it hit me that this error message from a failed spec was a little too verbose. The spec test is: Cucumber::Tree::RowScenario.should\_receive(:new).with(anything, anything,…

---

## [Cucumber and printed step and line number](https://www.ruby-forum.com/t/cucumber-and-printed-step-and-line-number/150428)

<div class="topic-metadata">

**Author:** [@aidy\_lewis](https://www.ruby-forum.com/u/aidy_lewis)\
**Replies:** 2\
**Last updated:** [October 8, 2008, 2:29pm UTC](https://www.ruby-forum.com/t/cucumber-and-printed-step-and-line-number/150428 "2008-10-08T14:29:41Z")

</div>

Hi, Today I installed the latest cucumber gem. For some reason, the actual current step file and step line number is being printed to the right of the step in the console. E.g. And enters into job reference …

---

## [Adding Test Spy into Rspec mocking framework](https://www.ruby-forum.com/t/adding-test-spy-into-rspec-mocking-framework/148594)

<div class="topic-metadata">

**Author:** [@joesniff](https://www.ruby-forum.com/u/joesniff)\
**Replies:** 13\
**Last updated:** [October 8, 2008, 11:10am UTC](https://www.ruby-forum.com/t/adding-test-spy-into-rspec-mocking-framework/148594 "2008-10-08T11:10:37Z")

</div>

Thanks to a pointer from lizkeogh.com site I’ve been discovering the joy of the Mockito (http://mockito.org/) mocking framework for Java. It verifies behaviour after the action. It struck me how this matched the forma…

---

## [Expected redirect to "/admin/account", got redirect to "/admin/account"](https://www.ruby-forum.com/t/expected-redirect-to-admin-account-got-redirect-to-admin-account/150394)

<div class="topic-metadata">

**Author:** [@pergesu](https://www.ruby-forum.com/u/pergesu)\
**Replies:** 1\
**Last updated:** [October 8, 2008, 2:16am UTC](https://www.ruby-forum.com/t/expected-redirect-to-admin-account-got-redirect-to-admin-account/150394 "2008-10-08T02:16:48Z")

</div>

Getting the failure message: expected redirect to “/admin/account”, got redirect to “/admin/account” I’m on Rails 1.2.6 with edge rspec/rspec-rails. There’s nothing funky inside that I can tell, but this is my first …

---

## [Gem generators on 1.2.6](https://www.ruby-forum.com/t/gem-generators-on-1-2-6/150387)

<div class="topic-metadata">

**Author:** [@pergesu](https://www.ruby-forum.com/u/pergesu)\
**Replies:** 4\
**Last updated:** [October 8, 2008, 2:01am UTC](https://www.ruby-forum.com/t/gem-generators-on-1-2-6/150387 "2008-10-08T02:01:36Z")

</div>

In a 1.2.6 app (don’t ask), I don’t see the generators available to me with the gems installed. However the documentation makes it look like it should work: Generator gems are also available: gem search -r generato…

---

## [Testing Generators](https://www.ruby-forum.com/t/testing-generators/150326)

<div class="topic-metadata">

**Author:** [@phylae](https://www.ruby-forum.com/u/phylae)\
**Replies:** 3\
**Last updated:** [October 8, 2008, 1:50am UTC](https://www.ruby-forum.com/t/testing-generators/150326 "2008-10-08T01:50:27Z")

</div>

Hi, I have started writing my own generators, and I was wondering if anyone had any suggestions for testing them. I know I could just run the generator in a dummy application; write my tests; and then copy the tests …

---

## [Post authentication token](https://www.ruby-forum.com/t/post-authentication-token/150301)

<div class="topic-metadata">

**Author:** [@markthomas](https://www.ruby-forum.com/u/markthomas)\
**Replies:** 7\
**Last updated:** [October 7, 2008, 8:45pm UTC](https://www.ruby-forum.com/t/post-authentication-token/150301 "2008-10-07T20:45:59Z")

</div>

Hi, I have a simple story that involves the user clicking a button and a new page being rendered. Seems like a simple situation, but it’s testing my limited knowledge. The problem I have is my response test is failing, …

---

## [Cucumber and html reports](https://www.ruby-forum.com/t/cucumber-and-html-reports/150357)

<div class="topic-metadata">

**Author:** [@aidy\_lewis](https://www.ruby-forum.com/u/aidy_lewis)\
**Replies:** 6\
**Last updated:** [October 7, 2008, 7:15pm UTC](https://www.ruby-forum.com/t/cucumber-and-html-reports/150357 "2008-10-07T19:15:27Z")

</div>

Hi, Is there anyway I can cycle through all the features in a folder and pipe to html through the command line? For this: C:\\SvnProjects\\my\_application\\features\> cucumber \*.feature --format html my\_application.htm …

---

## [Expectation ordering](https://www.ruby-forum.com/t/expectation-ordering/150336)

<div class="topic-metadata">

**Author:** [@Ashley\_M](https://www.ruby-forum.com/u/Ashley_M)\
**Replies:** 4\
**Last updated:** [October 7, 2008, 6:18pm UTC](https://www.ruby-forum.com/t/expectation-ordering/150336 "2008-10-07T18:18:31Z")

</div>

Hi Can I still rely on this RSpec behaviour? I’ve got a spec for a TCP socket client: it "should do things in a sane order" do @socket.should\_receive(:write) do @socket.should\_receive(:read) do …

---

## [Can I get more details in the "rake spec" output (e.g. for eql fail, what was the actual value that](https://www.ruby-forum.com/t/can-i-get-more-details-in-the-rake-spec-output-e-g-for-eql-fail-what-was-the-actual-value-that/150306)

<div class="topic-metadata">

**Author:** [@greg](https://www.ruby-forum.com/u/greg)\
**Replies:** 3\
**Last updated:** [October 7, 2008, 6:10pm UTC](https://www.ruby-forum.com/t/can-i-get-more-details-in-the-rake-spec-output-e-g-for-eql-fail-what-was-the-actual-value-that/150306 "2008-10-07T18:10:50Z")

</div>

Hi, Can I get more details in the “rake spec” output (e.g. for eql fail, what was the actual value that was returned)??? Another example might be what the exception actually is in a case the “should not raise except…

---

## [Specifying a specific error is re-raised](https://www.ruby-forum.com/t/specifying-a-specific-error-is-re-raised/150344)

<div class="topic-metadata">

**Author:** [@Ashley\_M](https://www.ruby-forum.com/u/Ashley_M)\
**Replies:** 2\
**Last updated:** [October 7, 2008, 4:52pm UTC](https://www.ruby-forum.com/t/specifying-a-specific-error-is-re-raised/150344 "2008-10-07T16:52:56Z")

</div>

Hi I’ve got code I want to intercept all errors (to report them) but re- raise them immediately. Currently the raise\_error matcher doesn’t support matching against instances of exception classes, so I’ve done this t…

---

## [Uninitialized constant Spec:Story](https://www.ruby-forum.com/t/uninitialized-constant-spec-story/150268)

<div class="topic-metadata">

**Author:** [@markthomas](https://www.ruby-forum.com/u/markthomas)\
**Replies:** 10\
**Last updated:** [October 6, 2008, 11:22pm UTC](https://www.ruby-forum.com/t/uninitialized-constant-spec-story/150268 "2008-10-06T23:22:37Z")

</div>

Hi, I’m fairly new to Rails and v. new to RSpec. Think it looks pretty useful and so I’m trying it out for the first time. I have installed the rspec-rails gem and created a simple plain text my\_story file and my\_stor…

---

## [Would I stub an existing class method out or use fixtures in this scenario?](https://www.ruby-forum.com/t/would-i-stub-an-existing-class-method-out-or-use-fixtures-in-this-scenario/150180)

<div class="topic-metadata">

**Author:** [@greg](https://www.ruby-forum.com/u/greg)\
**Replies:** 7\
**Last updated:** [October 6, 2008, 7:52pm UTC](https://www.ruby-forum.com/t/would-i-stub-an-existing-class-method-out-or-use-fixtures-in-this-scenario/150180 "2008-10-06T19:52:14Z")

</div>

Hi, Would the BDD experts recommend I either (a) use fixtures for data or (b) stub out existing class methods for such a scenario? Scenario = Working on a “populate for future transactions” method & testing this. It…

---

## [Newbie question about mock\_model and should\_receive](https://www.ruby-forum.com/t/newbie-question-about-mock-model-and-should-receive/150251)

<div class="topic-metadata">

**Author:** [@rgagnon](https://www.ruby-forum.com/u/rgagnon)\
**Replies:** 1\
**Last updated:** [October 6, 2008, 5:34pm UTC](https://www.ruby-forum.com/t/newbie-question-about-mock-model-and-should-receive/150251 "2008-10-06T17:34:55Z")

</div>

Hello, I mocked a model and I need to test when I set for instance ‘000’ to an attribute ‘A’ that B attibute is set to ‘1111’. I don’t want to stub or mock the B(accessors) to that value cause I want to make sure my …

---

## [What questions do you have about testing?](https://www.ruby-forum.com/t/what-questions-do-you-have-about-testing/150191)

<div class="topic-metadata">

**Author:** [@pergesu](https://www.ruby-forum.com/u/pergesu)\
**Replies:** 2\
**Last updated:** [October 6, 2008, 1:31am UTC](https://www.ruby-forum.com/t/what-questions-do-you-have-about-testing/150191 "2008-10-06T01:31:25Z")

</div>

Hey everyone, We’re doing a panel on testing at the Voices That Matter conference (http://www.voicesthatmatter.com/ruby2008/ - you should go :). Obie set up a google moderator thing \[1\] to collect questions for the p…

---

## [Cucumber 0.1.7 released](https://www.ruby-forum.com/t/cucumber-0-1-7-released/150194)

<div class="topic-metadata">

**Author:** [@aslak\_hellesoy](https://www.ruby-forum.com/u/aslak_hellesoy)\
**Replies:** 1\
**Last updated:** [October 6, 2008, 1:11am UTC](https://www.ruby-forum.com/t/cucumber-0-1-7-released/150194 "2008-10-06T01:11:31Z")

</div>

I just released 0.1.7 as a gem. (As usual, it will take a few hours before it rsyncs around the world). Changes are here: http://github.com/aslakhellesoy/cucumber/tree/v0.1.7/History.txt Thanks to everyone who’s cont…

---

## [Difference between gem and plugin](https://www.ruby-forum.com/t/difference-between-gem-and-plugin/150115)

<div class="topic-metadata">

**Author:** [@Donald\_F](https://www.ruby-forum.com/u/Donald_F)\
**Replies:** 18\
**Last updated:** [October 5, 2008, 7:29pm UTC](https://www.ruby-forum.com/t/difference-between-gem-and-plugin/150115 "2008-10-05T19:29:00Z")

</div>

Can someone tell me the difference ins the gem versions and the plugin versions? do they work together? need both? Don F.

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

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