<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/">
  <channel rdf:about="http://blog.gmane.org/gmane.comp.lang.ruby.rspec.user">
    <title>gmane.comp.lang.ruby.rspec.user</title>
    <link>http://blog.gmane.org/gmane.comp.lang.ruby.rspec.user</link>
    <description/>
    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>1</syn:updateFrequency>
    <syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19547"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19546"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19541"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19536"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19535"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19534"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19532"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19530"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19528"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19526"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19522"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19515"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19510"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19509"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19506"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19503"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19499"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19493"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19487"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19484"/>
      </rdf:Seq>
    </items>
    <image rdf:resource="http://gmane.org/img/gmane-25t.png"/>
    <textinput rdf:resource=""/>
  </channel>
  <image rdf:about="http://gmane.org/img/gmane-25t.png">
    <title>Gmane</title>
    <url>http://gmane.org/img/gmane-25t.png</url>
    <link>http://gmane.org</link>
  </image>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19547">
    <title>shared examples with a block for expects?</title>
    <link>http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19547</link>
    <description>&lt;pre&gt;Hi,

Basically I want to do something like this:

describe FancyThingsController do

  def do_new
    get :new
  end

  def do_create
    post :create, :fancy_thing =&amp;gt; { :some =&amp;gt; "params" }
  end

  shared_examples "an access controlled action" do |expectation|
    it "denies access" do
      expect(&amp;amp;expectation).to raise_error(CanCan::AccessDenied)
    end
  end

  describe "#new" do
    it_behaves_like "an access controlled action", proc { do_new }
  end

  describe "#create" do
    it_behaves_like "an access controlled action", proc { do_create }
  end

end

but I get:  "expected CanCan::AccessDenied, got #&amp;lt;NameError: undefined
local variable or method `do_create' for
RSpec::Core::ExampleGroup::Nested_1::Nested_2:Class&amp;gt;"

Just curious, how can I do this?

Patrick J. Collins
http://collinatorstudios.com

&lt;/pre&gt;</description>
    <dc:creator>Patrick J. Collins</dc:creator>
    <dc:date>2012-05-24T00:12:54</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19546">
    <title>received unexpected message :id= with (20)</title>
    <link>http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19546</link>
    <description>&lt;pre&gt;Please help me to understand this error message:

 1) PostsController#create when logged in should create a new post and
redirect to a successful message page
     Failure/Error: post 'create', { post: {title: 'New post',
       Mock Post(id: integer, title: string, description: text,
location: string, created_at: datetime, updated_at: datetime, status:
string, tags: string, views: integer, user_id: integer) received
unexpected message :id= with (20)
     # ./spec/controllers/posts_controller_spec.rb:56:in `block (4
levels) in &amp;lt;top (required)&amp;gt;'

Finished in 0.59991 seconds
6 examples, 1 failure



I'm trying to figure out this for about a week or more :(

Attachments:
http://www.ruby-forum.com/attachment/7429/posts_controller_spec.rb
http://www.ruby-forum.com/attachment/7430/posts_controller.rb


&lt;/pre&gt;</description>
    <dc:creator>Kleber Shimabuku</dc:creator>
    <dc:date>2012-05-23T22:27:45</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19541">
    <title>How does Spork help in requests specs?</title>
    <link>http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19541</link>
    <description>&lt;pre&gt;Even with Spork, my requests specs are very slow to start running (about 
7 seconds).

I suspect Rails is booting each time I run "rspec -X spec/requests".

Is that true? If so, is there any way I could instruct the web server to 
keep alive after the specs run so that it would be faster on next run?

Are there any resources on how to have better performance on running 
requests specs with Capybara and Webkit?

Having to wait about 7 seconds between consecutive runs is really a 
blocker for me. If I can't get it to run faster, I'll give up on 
requests specs and only have the controller's tests and client-side code 
specs without any integration tests...

But to be honest, I feel much more comfortable having some integration 
tests for the main features of my application and I would appreciate any 
hints on making them start faster.

The last time I worked with Rails, long ago, it wasn't such a painful 
experience to write such kind of tests (Capybara + Webkit). And my 
current desktop PC is *way* faster than it used to be by that time...

I understand that Rails is much slower to boot now, but maybe there are 
some tricks for reducing the need of rebooting between consecutive 
requests specs run.

Thanks in advance,
Rodrigo.

&lt;/pre&gt;</description>
    <dc:creator>Rodrigo Rosenfeld Rosas</dc:creator>
    <dc:date>2012-05-18T00:04:23</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19536">
    <title>Bash shim for Rspec</title>
    <link>http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19536</link>
    <description>&lt;pre&gt;HI Folks,
The following script is *supposed* to run rspec under Jruby with the proper
Java-switch for using SWT with OSX (-XstartOnFirstThread).
The issue is that this script doesn't actually run any of the specs!
Example:
$ bin/rspec_auto_jvm spec/swt_shoes/app_spec.rb
spec/swt_shoes/app_spec.rb
args are  spec/swt_shoes/app_spec.rb
$

Can anyone point out the flaw?

Peter Fitzgibbons
(847) 859-9550
Email: peter.fitzgibbons-Re5JQEeQqe8AvxtiuMwx3w&amp;lt; at &amp;gt;public.gmane.org
IM GTalk: peter.fitzgibbons
IM AOL: peter.fitzgibbons-Re5JQEeQqe8AvxtiuMwx3w&amp;lt; at &amp;gt;public.gmane.org


#!/usr/bin/env bash
# !/usr/bin/env jruby --1.9 --debug
#
# This file was generated by Bundler.
#
# The application 'rspec' is installed as part of a gem, and
# this file is here to facilitate running it.
#

echo "$&amp;lt; at &amp;gt;" | grep 'swt'

if [[ $&amp;lt; at &amp;gt; == *swt* ]]; then
  swt_opt="-J-XstartOnFirstThread"
fi

echo 'args are ' $*

run_rspec="
# http://jira.codehaus.org/browse/JRUBY-6324
# random seed for srand is not initialized properly
# call once and throw-away nil default first value
x = srand

require 'rubygems'

version = \"&amp;gt;= 0\"

if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
  version = $1
  ARGV.shift
end

gem 'rspec-core', version
load Gem.bin_path('rspec-core', 'rspec', version)

exit 0
"

jruby --1.9 --debug ${swt_opt} -e ${run_rspec} $*
&lt;/pre&gt;</description>
    <dc:creator>Peter Fitzgibbons</dc:creator>
    <dc:date>2012-05-15T11:32:05</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19535">
    <title>how can I do an "or" within the context of a matcher?</title>
    <link>http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19535</link>
    <description>&lt;pre&gt;Capybara has two methods:

page.has_button?

and

page.has_link?

...  I am wondering, how can I make a helper method that will be
satisfied by one or the other?  In other words, I want to be able to do:

page.should have_link_or_button("blah")

def have_link_or_button(locator)
  have_link(locator) || have_button(locator)
end

But that doesn't work...  Is there any way to do this?

Patrick J. Collins
http://collinatorstudios.com

&lt;/pre&gt;</description>
    <dc:creator>Patrick J. Collins</dc:creator>
    <dc:date>2012-05-15T06:47:58</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19534">
    <title>overview of how rspec was designed</title>
    <link>http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19534</link>
    <description>&lt;pre&gt;Other than jumping into the codebase myself, I was wondering if anyone has
done a high-level (or better yet low level) write-up on how rspec works
under the covers?
&lt;/pre&gt;</description>
    <dc:creator>S Ahmed</dc:creator>
    <dc:date>2012-05-14T19:23:31</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19532">
    <title>Stubs and contract tests</title>
    <link>http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19532</link>
    <description>&lt;pre&gt;Hey guys, could you help me (in)validating an idea?

As you might know, Contract tests solve a problem stubs have: if the object
interface changes, the stubbed tests will continue passing.

In RSpec, it's common to use a shared_context to describe contracts, so
both Posts and Comments tests would have PostsCommentsContract. If
Comment's interface ever changed, Posts tests would present a failure
wherever we ran it. However, it won't tell us which stubbed methods were
invalid now; it just tell us the file that have invalid stubs.

If we had, for example, #stub_contract(:method), automatically raising
a failure if its reference (double) object's interface changed, how would
it be bad?

I'm trying to think the cons of it. Could you guys help me finding it?

--Alexandre
&lt;/pre&gt;</description>
    <dc:creator>Alexandre de Oliveira</dc:creator>
    <dc:date>2012-05-11T14:24:19</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19530">
    <title>how do I test for a status code in a :js =&gt; true test?</title>
    <link>http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19530</link>
    <description>&lt;pre&gt;I have a view with some javascript that does page redirection, and I
wanted to confirm that under certain circumstances the user will get a
500 error from CanCan::AccessDenied.

It seems that when I am not using :js =&amp;gt; true, I can do:

page.status_code.shoud be 500

but.. when I try that in a :js =&amp;gt; true example group, I get:
Capybara::NotSupportedByDriverError: Capybara::NotSupportedByDriverError

also the request and response objects are nil in the context of this
test...  My dirty workaround has just been to do:

page.has_content "CanCan::AccessDenied"

Which serves my purposes, but I was hoping for a better way...  Any
ideas?

Thank you.

Patrick J. Collins
http://collinatorstudios.com

&lt;/pre&gt;</description>
    <dc:creator>Patrick J. Collins</dc:creator>
    <dc:date>2012-05-10T04:14:38</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19528">
    <title>is there a way to turn on :js =&gt; true in the middleof a spec?</title>
    <link>http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19528</link>
    <description>&lt;pre&gt;Hi,

If I have a spec with some complicated background stuff--  like say for
example logging in...

it "does stuff", :js =&amp;gt; true do
  fancy_login_helper_method
  visit somewhere_over_the_rainbow_path
  click_button "omg"
  page.should have_content("waka waka")
end

...  Is there any way to do something like :

it "does stuff" do
  fancy_login_helper_method
  js do
    visit somewhere_over_the_rainbow_path
    click_button "omg"
    page.should have_content("waka waka")
  end
end

So that I can cut down the time it takes to excute that test a bit?  Or
is that just impossible with the way headless vs browser stuff works?

Patrick J. Collins
http://collinatorstudios.com

&lt;/pre&gt;</description>
    <dc:creator>Patrick J. Collins</dc:creator>
    <dc:date>2012-05-09T20:09:04</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19526">
    <title>stub.as_null_object mock and double</title>
    <link>http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19526</link>
    <description>&lt;pre&gt;Hi there,

Is there any particular reason why stub is not stub.as_null_object by
default?

Or alternatively is there some nicer sugar for stub.as_null_object

Is RSpec trying to discourage the use of stub.as_null_object, and if so why?

TIA

Andrew

&lt;/pre&gt;</description>
    <dc:creator>Andrew Premdas</dc:creator>
    <dc:date>2012-05-09T16:01:18</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19522">
    <title>Retrying specs</title>
    <link>http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19522</link>
    <description>&lt;pre&gt;Is it possible to run an example without displaying it's
status ...F...
I'm currently using an around(:each) to run the spec and passing the
example block into vcr however occasionally the cassette needs to be
rerecorded.  I'd like to delay recording it as an error until it has been
retried.  Is that possible currently in rspec?

&lt;/pre&gt;</description>
    <dc:creator>Samer Masry</dc:creator>
    <dc:date>2012-05-08T17:55:02</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19515">
    <title>rspec 2.10.0 breaks controller specs...</title>
    <link>http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19515</link>
    <description>&lt;pre&gt;Apparently 2.10.0 doesn't like this line in devise's lib/devise/test_helpers.rb
  &amp;lt; at &amp;gt;request.env['warden'] = Warden::Proxy.new(&amp;lt; at &amp;gt;request.env, manager) 

...

This worked fine in 2.8.1, but now all my controller specs give me:

Failure/Error: Unable to find matching line from backtrace
     NoMethodError:
       undefined method `env' for nil:NilClass
     # /Users/patrick/.rvm/gems/ruby-1.9.3-p125&amp;lt; at &amp;gt;my_app/gems/devise-2.0.4/lib/devise/test_helpers.rb:33:in `warden'
     # /Users/patrick/.rvm/gems/ruby-1.9.3-p125&amp;lt; at &amp;gt;my_app/gems/rspec-rails-2.10.0/lib/rspec/rails/adapters.rb:15:in `block (2 levels) in setup'
     # /Users/patrick/.rvm/gems/ruby-1.9.3-p125&amp;lt; at &amp;gt;my_app/gems/rspec-core-2.10.0/lib/rspec/core/example.rb:178:in `instance_eval'
     # /Users/patrick/.rvm/gems/ruby-1.9.3-p125&amp;lt; at &amp;gt;my_app/gems/rspec-core-2.10.0/lib/rspec/core/example.rb:178:in `instance_eval'
     # /Users/patrick/.rvm/gems/ruby-1.9.3-p125&amp;lt; at &amp;gt;my_app/gems/rspec-core-2.10.0/lib/rspec/core/hooks.rb:23:in `run'
     # /Users/patrick/.rvm/gems/ruby-1.9.3-p125&amp;lt; at &amp;gt;my_app/gems/rspec-core-2.10.0/lib/rspec/core/hooks.rb:63:in `block in run'
     # /Users/patrick/.rvm/gems/ruby-1.9.3-p125&amp;lt; at &amp;gt;my_app/gems/rspec-core-2.10.0/lib/rspec/core/hooks.rb:63:in `each'
     # /Users/patrick/.rvm/gems/ruby-1.9.3-p125&amp;lt; at &amp;gt;my_app/gems/rspec-core-2.10.0/lib/rspec/core/hooks.rb:63:in `run'
     # /Users/patrick/.rvm/gems/ruby-1.9.3-p125&amp;lt; at &amp;gt;my_app/gems/rspec-core-2.10.0/lib/rspec/core/hooks.rb:400:in `run_hook'
     # /Users/patrick/.rvm/gems/ruby-1.9.3-p125&amp;lt; at &amp;gt;my_app/gems/rspec-core-2.10.0/lib/rspec/core/example_group.rb:298:in `run_before_each_hooks'
     # /Users/patrick/.rvm/gems/ruby-1.9.3-p125&amp;lt; at &amp;gt;my_app/gems/rspec-core-2.10.0/lib/rspec/core/example.rb:239:in `run_before_each'
     # /Users/patrick/.rvm/gems/ruby-1.9.3-p125&amp;lt; at &amp;gt;my_app/gems/rspec-core-2.10.0/lib/rspec/core/example.rb:86:in `block in run'
     # /Users/patrick/.rvm/gems/ruby-1.9.3-p125&amp;lt; at &amp;gt;my_app/gems/rspec-core-2.10.0/lib/rspec/core/example.rb:195:in `with_around_each_hooks'
     # /Users/patrick/.rvm/gems/ruby-1.9.3-p125&amp;lt; at &amp;gt;my_app/gems/rspec-core-2.10.0/lib/rspec/core/example.rb:84:in `run'
     # /Users/patrick/.rvm/gems/ruby-1.9.3-p125&amp;lt; at &amp;gt;my_app/gems/rspec-core-2.10.0/lib/rspec/core/example_group.rb:353:in `block in run_examples'
     # /Users/patrick/.rvm/gems/ruby-1.9.3-p125&amp;lt; at &amp;gt;my_app/gems/rspec-core-2.10.0/lib/rspec/core/example_group.rb:349:in `map'
     # /Users/patrick/.rvm/gems/ruby-1.9.3-p125&amp;lt; at &amp;gt;my_app/gems/rspec-core-2.10.0/lib/rspec/core/example_group.rb:349:in `run_examples'
     # /Users/patrick/.rvm/gems/ruby-1.9.3-p125&amp;lt; at &amp;gt;my_app/gems/rspec-core-2.10.0/lib/rspec/core/example_group.rb:335:in `run'
     # /Users/patrick/.rvm/gems/ruby-1.9.3-p125&amp;lt; at &amp;gt;my_app/gems/rspec-core-2.10.0/lib/rspec/core/example_group.rb:336:in `block in run'
     # /Users/patrick/.rvm/gems/ruby-1.9.3-p125&amp;lt; at &amp;gt;my_app/gems/rspec-core-2.10.0/lib/r 17     def process(*)
spec/core/example_group.rb:336:in `map'
     # /Users/patrick/.rvm/gems/ruby-1.9.3-p125&amp;lt; at &amp;gt;my_app/gems/rspec-core-2.10.0/lib/rspec/core/example_group.rb:336:in `run'
     # /Users/patrick/.rvm/gems/ruby-1.9.3-p125&amp;lt; at &amp;gt;my_app/gems/rspec-core-2.10.0/lib/rspec/core/command_line.rb:28:in `block (2 levels) in run'
     # /Users/patrick/.rvm/gems/ruby-1.9.3-p125&amp;lt; at &amp;gt;my_app/gems/rspec-core-2.10.0/lib/rspec/core/command_line.rb:28:in `map'
     # /Users/patrick/.rvm/gems/ruby-1.9.3-p125&amp;lt; at &amp;gt;my_app/gems/rspec-core-2.10.0/lib/rspec/core/command_line.rb:28:in `block in run'
     # /Users/patrick/.rvm/gems/ruby-1.9.3-p125&amp;lt; at &amp;gt;my_app/gems/rspec-core-2.10.0/lib/rspec/core/reporter.rb:34:in `report'
     # /Users/patrick/.rvm/gems/ruby-1.9.3-p125&amp;lt; at &amp;gt;my_app/gems/rspec-core-2.10.0/lib/rspec/core/command_line.rb:25:in `run'
     # /Users/patrick/.rvm/gems/ruby-1.9.3-p125&amp;lt; at &amp;gt;my_app/gems/rspec-core-2.10.0/lib/rspec/core/runner.rb:69:in `run'
     # /Users/patrick/.rvm/gems/ruby-1.9.3-p125&amp;lt; at &amp;gt;my_app/gems/rspec-core-2.10.0/lib/rspec/core/runner.rb:10:in `block in autorun'

Patrick J. Collins
http://collinatorstudios.com

&lt;/pre&gt;</description>
    <dc:creator>Patrick J. Collins</dc:creator>
    <dc:date>2012-05-04T20:07:47</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19510">
    <title>stuck in testing hell...</title>
    <link>http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19510</link>
    <description>&lt;pre&gt;Hey everyone,

So here I am, trying to love my testing process-- but I really hit a
wall today and experienced a moment where testing totally causes a lack
of productivity...  To make a long story short, here's what happened:

I've been integrating a 3rd party payment service within my app-- The
way it works is, you get a token for the transaction, and then send a
request to their API to see if the credit card authorizes, and then if
it does, you can purchase it and make sure that's valid...

So I have a purchase model, and I am using state_machine to store the
transaction state...  For example, when an attempt to authorize a
credit card is done, if that fails, then the state machine transitions
within a failure block to set the purchase's state to
"authorization_failed".

...  Ok...  So, I made tests to cover all of this behavior, and
everything was perfect-- all tests were passing, and then I was told:
"Hey, we want to store the transaction data in the purchase records--
whether it failed or succeded"...  I said:  Sure!  No Problem!

The way I had this setup was, an attr_accessor :samurai_transaction

and then a before_create callback that calls a method
:build_samurai_transaction

... That method basically did:

Samurai::Processor.authorize( ...bunch o' auth data stuff... )

So to keep this data around, I made a migration to create the column
(same name as the attr_accessor property) and then I added serialize
:samurai_transaction and removed the attr_accessor macro.

Everything should be exactly the same behaviorally..  Ran my tests to
verify, and.. FAIL FAIL FAIL FAIL FAIL FAIL FAIL...

Inspecting the failures, I see that all of a sudden I am getting bogus
errors about "undefined method `matches_method?' for nil:NilClass"

I go through everything trying to figure out where this is coming from
and finally find that it's from my stubbing out the calls to Samurai..
I was doing:

auth = stub("auth", :success? =&amp;gt; true, :capture =&amp;gt; true)
Samurai::Processor.stubs(:authorize).returns auth

..  It worked fine before, but apparently something can't handle the
serialized database column holding a mocked object?  No idea...

So I changed this to:
auth = OpenStruct.new(:success? =&amp;gt; true, :capture =&amp;gt; true)

The error went away, which then made me convinced that it is something
to do with Mocha.....  However, then I saw other tests failing, and
guess why?

WRONG NUMBER OF ARGUMENTS FOR CAPTURE (0 for 1).

.... uhh?

Samurai has it's own ".capture" method to take funds..  This has some
conflicts with Rails' internal ".capture".........  For some reason,
o = OpenStruct.new(:capture =&amp;gt; true)
o.capture
  =&amp;gt; wrong number of arguments error...

So now I have to do:

o = OpenStruct.new(:kapture =&amp;gt; true)
def o.capture
  kapture
end

and, suddenly I am finding myself in hacky hack land-- and hating every
minute of it.

Not to mention my tests still are breaking because of some other undetermined
problems having to do with OpenStruct not being as "simple" of a
solution as I was hoping.

... AAAAAAAAAAAAAAAAAAAAAAGH!


Patrick J. Collins
http://collinatorstudios.com

&lt;/pre&gt;</description>
    <dc:creator>Patrick J. Collins</dc:creator>
    <dc:date>2012-05-01T03:24:31</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19509">
    <title>This is a test to see if the google mirror is workingagain</title>
    <link>http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19509</link>
    <description>&lt;pre&gt;This is a test to see if the google mirror is working again. Sorry for the noise.

Cheers,
David
&lt;/pre&gt;</description>
    <dc:creator>David Chelimsky</dc:creator>
    <dc:date>2012-04-27T02:46:05</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19506">
    <title>New google groups (help, please)</title>
    <link>http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19506</link>
    <description>&lt;pre&gt;Hi all.

Google is in the process of changing the google group format and,
unless I'm missing something, seems to have abandoned the mirror
functionality this list has relied on for several years now (posting
to rspec-users also posts to the google group).

If anybody on this list knows how to solve this problem in the google
group UI, please let me know.

If not, we need to retire/archive either the rspec-users mailing list
or the google group. Any thoughts on this?

Thanks in advance for your help/advice.

Cheers,
David
&lt;/pre&gt;</description>
    <dc:creator>David Chelimsky</dc:creator>
    <dc:date>2012-04-25T09:41:01</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19503">
    <title>How to modify database inside a transaction inbefore(:all)?</title>
    <link>http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19503</link>
    <description>&lt;pre&gt;I have a set of examples that should run with a specific set of records 
in the database.

Since setting those records is an expensive operation I'd like to 
perform it just once per context.

For example:

context 'sample tree' do
     before(:all) { create_tree_records }

     example ...
end

The problem with this is that while before(:each) and the examples will 
run in a transaction that will be rolled back at the end of each 
example, that won't happen to the records created/modified by the 
before(:all) block.

It seems my database vendor (PostgreSQL) supports nested transactions 
(savepoints):

http://www.postgresql.org/about/

I should also notice that I'm using Sequel and it seems that 
transactions are reentrant in Sequel:

http://cheat.errtheblog.com/s/sequel/

Database#transaction is re-entrant:

   DB.transaction do # BEGIN issued only here
     DB.transaction
       dataset &amp;lt;&amp;lt; {:first_name =&amp;gt; 'Inigo', :last_name =&amp;gt; 'Montoya'}
     end
end # COMMIT issued only here

So, this logic wouldn't work for me. I need a save point in a 
before(:all), so that I'd restore it on a before(:each).

Is there any recommendation to make this work in my specs?

Thanks in advance,
Rodrigo.

&lt;/pre&gt;</description>
    <dc:creator>Rodrigo Rosenfeld Rosas</dc:creator>
    <dc:date>2012-04-23T22:39:05</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19499">
    <title>using rspec in a non-rails environment</title>
    <link>http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19499</link>
    <description>&lt;pre&gt;My folder structure is as follows:

/myapp/
/myapp/lib/class1.rb

/myapp/rspec/spec_helper.rb
/myapp/rspec/lib/class1_spec.rb

My spec_helper has:

require 'rubygems'
require 'rspec'

RSpec.configure do |config|
end


My class1_spec.rb has:

require 'spec_helper'
require '../../lib/class1'

describe Class1 do
  it "should do something"
end


How do I require my class1 correct, when I run:

rspec spec/lib/class1_spec.rb I am getting:

1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file --
../../lib/class1.rb (LoadError)

Also, in a non-rails app, what kind of things do you put in the spec_helper
normally? any popular config settings that I should know about?

thanks!
&lt;/pre&gt;</description>
    <dc:creator>S Ahmed</dc:creator>
    <dc:date>2012-04-23T17:26:13</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19493">
    <title>how can I stub out external service calls during integration tests?</title>
    <link>http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19493</link>
    <description>&lt;pre&gt;Hi,

I realize that integration tests are supposed to be high-level and deal
with what the user really sees on their end, but say you have a form
that integrates via ajax with a payment service like chargify--  Even
though that service may have a "sandbox" environment that you can post
to, I would rather not my requests specs go out and actually hit the
wire...

So, my question is, what is the proper way to stub out something like
this?  Is it to do something hacky like:

page.evaluate_script "$('#form_for_chargify').submit(function() {
window.location = '&amp;lt;&amp;lt;some path where a user is redirected to upon successful payment&amp;gt;&amp;gt;'; return false; }

Is there a better way to do this?

Thanks.

Patrick J. Collins
http://collinatorstudios.com

&lt;/pre&gt;</description>
    <dc:creator>Patrick J. Collins</dc:creator>
    <dc:date>2012-04-19T06:33:50</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19487">
    <title>how can I get prettier failure messages forintegration specs?</title>
    <link>http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19487</link>
    <description>&lt;pre&gt;When an integration test fails, I get a whole mess of garbage that is
all in red, very painful to the eyes--  Especially when I quickly just
want to see what went wrong-- in this case, all I want to see is
ActiveRecord::RecondNotFound-- but instead I see: 
 
Failure/Error: page.should have_content "Submit Payment"
       expected there to be content "Submit Payment" in "Action
Controller: Exception caught\n    body { background-color: #fff; color:
#333; }\n\n    body, p, ol, ul, td {\n      font-family: helvetica,
verdana, arial, sans-serif;\n      font-size:   13px;\n
line-height: 18px;\n    }\n\n    pre {\n      background-color: #eee;\n
padding: 10px;\n      font-size: 11px;\n      white-space: pre-wrap;\n
}\n\n    a { color: #000; }\n    a:visited { color: #666; }\n    a:hover
{ color: #fff; background-color:#000; }\n  \n\n\n
ActiveRecord::RecordNotFound\n   ... bla bla bla bla bla bla forever.

......  Are there any options to reformat this output?  A small
improvement would be to actually turn \n into actual new lines...
However, an even better option would be to make this automatically
launch the browser so that the error page could be read properly.

Is this possible?


Patrick J. Collins
http://collinatorstudios.com

&lt;/pre&gt;</description>
    <dc:creator>Patrick J. Collins</dc:creator>
    <dc:date>2012-04-19T00:01:32</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19484">
    <title>Testing parameter passed to controller new method (undefined method 'stringify_keys')</title>
    <link>http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19484</link>
    <description>&lt;pre&gt;I'm trying to test passing a parameter to the new method of my
controller and am coming up with the "undefined method 'stringify_keys'"
error when I use this code:

get "new", { :company_id =&amp;gt; '1' }

I have seen other solutions to this issue, but they have all centered
around the create method and either using FactoryGirl.attributes_for or
making a deeper hash like { :object =&amp;gt; { :company_id =&amp;gt; 1 } }.  I don't
think either of these solutions are appropriate.

The logic I'm using involves CanCan, where I don't want the user to be
able to load up the 'new' page unless they've got a valid company id.

If the only way to do what I want really is to use the full object hash,
then I need an update for my view test which is validating the new link,
currently like so:

rendered.should have_selector 'a',
:content =&amp;gt; 'Add Object',
:href =&amp;gt; '/menus/new?company_id=' + company.id.to_s

I'm using Rails 3.2.3 and rspec 2.9

&lt;/pre&gt;</description>
    <dc:creator>Justin Funk</dc:creator>
    <dc:date>2012-04-18T14:06:47</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19479">
    <title>One error reported recursively if two pages visitedby request spec</title>
    <link>http://comments.gmane.org/gmane.comp.lang.ruby.rspec.user/19479</link>
    <description>&lt;pre&gt;Hi,

I'm using Rails 3.1.3, rspec-rails 2.9.0, and Ruby 1.9.3p0.

I've been getting recursive errors, where one error is reported
multiple times. It's quite spectacular in a long suite, with the
errors overflowing the console buffer. I've whittled down a simple
example:

require 'spec_helper'
describe "public pages" do
  subject { page }
  describe "details page" do
    before do
      visit root_path
    end
    describe "when visiting a second page before example" do
      before { visit sign_in_path }
      it { should have_link("Sign in") }
    end
  end
end

The error here is that "sign_in_path" should really be "signin_path".
But I get that error five times, and when I run with --format
documentation, it looks like RSpec is generating it recursively before
it "blows up" with a stack trace (see output below).

Obviously this test doesn't really need two before blocks, but
sometimes I do want to visit two pages before a test.

Am I doing something wrong, or is this a bug?

Mark Berry

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test output:

[myproject (tests)]$ rspec spec/requests/test2* --format documentation
No DRb server is running. Running in local process instead ...

public pages
  details page
    when no user is signed in
      when visiting a second page before example
      when visiting a second page before example
      when no user is signed in
        when visiting a second page before example
        details page
          when no user is signed in
            when visiting a second page before example

Failures:

  1) public pages details page when no user is signed in when visiting
a second page before example
     Failure/Error: before { visit sign_in_path }
     NameError:
       undefined local variable or method `sign_in_path' for
#&amp;lt;RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460&amp;gt;
     # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
&amp;lt;top (required)&amp;gt;'

  2) public pages details page when no user is signed in when visiting
a second page before example
     Failure/Error: before { visit sign_in_path }
     NameError:
       undefined local variable or method `sign_in_path' for
#&amp;lt;RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460&amp;gt;
     # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
&amp;lt;top (required)&amp;gt;'

  3) public pages details page when no user is signed in when visiting
a second page before example
     Failure/Error: before { visit sign_in_path }
     NameError:
       undefined local variable or method `sign_in_path' for
#&amp;lt;RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460&amp;gt;
     # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
&amp;lt;top (required)&amp;gt;'

  4) public pages details page when no user is signed in when visiting
a second page before example
     Failure/Error: before { visit sign_in_path }
     NameError:
       undefined local variable or method `sign_in_path' for
#&amp;lt;RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460&amp;gt;
     # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
&amp;lt;top (required)&amp;gt;'

  5) public pages details page when no user is signed in when visiting
a second page before example
     Failure/Error: before { visit sign_in_path }
     NameError:
       undefined local variable or method `sign_in_path' for
#&amp;lt;RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460&amp;gt;
     # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
&amp;lt;top (required)&amp;gt;'

Finished in 0.33725 seconds
5 examples, 5 failures

Failed examples:

rspec ./spec/requests/test2_pages_spec.rb:18 # public pages details
page when no user is signed in when visiting a second page before
example
rspec ./spec/requests/test2_pages_spec.rb:18 # public pages details
page when no user is signed in when visiting a second page before
example
rspec ./spec/requests/test2_pages_spec.rb:18 # public pages details
page when no user is signed in when visiting a second page before
example
rspec ./spec/requests/test2_pages_spec.rb:18 # public pages details
page when no user is signed in when visiting a second page before
example
rspec ./spec/requests/test2_pages_spec.rb:18 # public pages details
page when no user is signed in when visiting a second page before
example
/home/myuser/.rvm/gems/ruby-1.9.3-p0&amp;lt; at &amp;gt;myproject/gems/activesupport-3.1.3/lib/active_support/whiny_nil.rb:48:in
`method_missing': undefined method `strip' for nil:NilClass
(NoMethodError)
from /home/myuser/.rvm/gems/ruby-1.9.3-p0&amp;lt; at &amp;gt;myproject/gems/rspec-core-2.9.0/lib/rspec/core/formatters/documentation_formatter.rb:41:in
`failure_output'
from /home/myuser/.rvm/gems/ruby-1.9.3-p0&amp;lt; at &amp;gt;myproject/gems/rspec-core-2.9.0/lib/rspec/core/formatters/documentation_formatter.rb:37:in
`example_failed'
from /home/myuser/.rvm/gems/ruby-1.9.3-p0&amp;lt; at &amp;gt;myproject/gems/rspec-core-2.9.0/lib/rspec/core/reporter.rb:98:in
`block in notify'
...
&lt;/pre&gt;</description>
    <dc:creator>Mark Berry</dc:creator>
    <dc:date>2012-04-18T04:11:07</dc:date>
  </item>
  <textinput rdf:about="http://search.gmane.org/?group=$group=gmane.comp.lang.ruby.rspec.user">
    <title>Search Engine</title>
    <description>Search the mailing list at Gmane</description>
    <name>query</name>
    <link>http://search.gmane.org/?group=$group=gmane.comp.lang.ruby.rspec.user</link>
  </textinput>
</rdf:RDF>

