Re: [rspec-users] One error reported recursively if two pages visited by request spec

2012-04-23 Thread Mark Berry
Yup that fixed it, thanks!

Mark Berry

On Sun, Apr 22, 2012 at 2:41 AM, David Chelimsky dchelim...@gmail.com wrote:
 Looks like this is related
 to https://github.com/rspec/rspec-core/issues/585, which is already fixed in
 master. If you point your Gemfile to github now you'll see it fixed. 2.10
 release coming soon.

 group :test do
   gem 'rspec-rails',        :git = git://github.com/rspec/rspec-rails.git
   gem 'rspec-core',         :git = git://github.com/rspec/rspec-core.git
   gem 'rspec-expectations', :git =
 git://github.com/rspec/rspec-expectations.git
   gem 'rspec-mocks',        :git = git://github.com/rspec/rspec-mocks.git
   gem 'capybara', '1.1.2'
 end

 Cheers,
 David

 --
 David Chelimsky
 Sent with Sparrow

 On Thursday, April 19, 2012 at 5:55 PM, Mark Berry wrote:

 On Thu, Apr 19, 2012 at 8:54 AM, Mark Berry mcbsyst...@gmail.com wrote:

 On Wed, Apr 18, 2012 at 8:09 PM, David Chelimsky dchelim...@gmail.com
 wrote:

 On Wednesday, April 18, 2012 at 4:30 PM, Mark Berry wrote:

 On Wed April 18, 2012 at 5:35 AM, David Chelimsky wrote:
 On Tuesday, April 17, 2012 at 11:11 PM, Mark Berry wrote:

 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
 #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
 # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
 top (required)'

 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
 #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
 # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
 top (required)'

 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
 #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
 # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
 top (required)'

 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
 #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
 # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
 top (required)'

 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
 #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
 # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
 top (required)'


 This is what I would expect. There is nothing recursive about this. There
 is a failure in
 a before block that runs before every example. It's the same as if you had
 the same
 broken code directly in each example.


 HTH,
 David


 [Sorry if this starts a new thread. I was attempting to monitor and
 reply to the group through Google Groups, but apparently that mirror
 stopped working on April 10, so I'm having to reconstruct this reply.]

 Thanks for the reply.

 Although the output says 5 examples, 5 

Re: [rspec-users] One error reported recursively if two pages visited by request spec

2012-04-22 Thread David Chelimsky
Looks like this is related to https://github.com/rspec/rspec-core/issues/585, 
which is already fixed in master. If you point your Gemfile to github now 
you'll see it fixed. 2.10 release coming soon.

group :test do
  gem 'rspec-rails',:git = git://github.com/rspec/rspec-rails.git
  gem 'rspec-core', :git = git://github.com/rspec/rspec-core.git
  gem 'rspec-expectations', :git = 
git://github.com/rspec/rspec-expectations.git
  gem 'rspec-mocks',:git = git://github.com/rspec/rspec-mocks.git
  gem 'capybara', '1.1.2'
end



Cheers,
David


-- 
David Chelimsky
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


On Thursday, April 19, 2012 at 5:55 PM, Mark Berry wrote:

 On Thu, Apr 19, 2012 at 8:54 AM, Mark Berry mcbsyst...@gmail.com 
 (mailto:mcbsyst...@gmail.com) wrote:
  On Wed, Apr 18, 2012 at 8:09 PM, David Chelimsky dchelim...@gmail.com 
  (mailto:dchelim...@gmail.com) wrote:
   On Wednesday, April 18, 2012 at 4:30 PM, Mark Berry wrote:
   
   On Wed April 18, 2012 at 5:35 AM, David Chelimsky wrote:
   On Tuesday, April 17, 2012 at 11:11 PM, Mark Berry wrote:
   
   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
   #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
   # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
   top (required)'
   
   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
   #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
   # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
   top (required)'
   
   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
   #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
   # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
   top (required)'
   
   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
   #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
   # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
   top (required)'
   
   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
   #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
   # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
   top (required)'
   
   
   This is what I would expect. There is nothing recursive about this. 
   There
   is a failure in
   a before block that runs before every example. It's the same as if you had
   the same
   broken code directly in each example.
   
   
   HTH,
   David
   
   
   [Sorry if this starts a new thread. I 

Re: [rspec-users] One error reported recursively if two pages visited by request spec

2012-04-19 Thread Mark Berry
On Wed, Apr 18, 2012 at 8:09 PM, David Chelimsky dchelim...@gmail.com wrote:
 On Wednesday, April 18, 2012 at 4:30 PM, Mark Berry wrote:

 On Wed April 18, 2012 at 5:35 AM, David Chelimsky wrote:
 On Tuesday, April 17, 2012 at 11:11 PM, Mark Berry wrote:

 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
 #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
 # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
 top (required)'

 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
 #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
 # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
 top (required)'

 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
 #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
 # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
 top (required)'

 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
 #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
 # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
 top (required)'

 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
 #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
 # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
 top (required)'


 This is what I would expect. There is nothing recursive about this. There
 is a failure in
 a before block that runs before every example. It's the same as if you had
 the same
 broken code directly in each example.


 HTH,
 David


 [Sorry if this starts a new thread. I was attempting to monitor and
 reply to the group through Google Groups, but apparently that mirror
 stopped working on April 10, so I'm having to reconstruct this reply.]

 Thanks for the reply.

 Although the output says 5 examples, 5 failures, there is only one
 example, hence my confusion about it failing five times. Also, the
 documentation output lists each describe block (except the first)
 two to four times.

 When I fix the error, I get one line per describe, plus one example
 completed, as expected:


 [myproject (tests)]$ rspec spec/requests/test2* --format documentation

 public pages
 details page
 when visiting a second page before example
 should has link Sign in

 Finished in 1.44 seconds
 1 example, 0 failures


 I have since discovered that the problem only occurs when using
 --format documentation. Without that, with the error back in place,
 RSpec only gives me one error, not five:


 [myproject (tests)]$ rspec spec/requests/test2*
 F

 Failures:

 1) public pages details page when visiting a second page before example
 Failure/Error: before { visit sign_in_path }
 

Re: [rspec-users] One error reported recursively if two pages visited by request spec

2012-04-19 Thread Mark Berry
On Thu, Apr 19, 2012 at 8:54 AM, Mark Berry mcbsyst...@gmail.com wrote:
 On Wed, Apr 18, 2012 at 8:09 PM, David Chelimsky dchelim...@gmail.com wrote:
 On Wednesday, April 18, 2012 at 4:30 PM, Mark Berry wrote:

 On Wed April 18, 2012 at 5:35 AM, David Chelimsky wrote:
 On Tuesday, April 17, 2012 at 11:11 PM, Mark Berry wrote:

 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
 #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
 # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
 top (required)'

 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
 #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
 # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
 top (required)'

 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
 #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
 # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
 top (required)'

 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
 #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
 # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
 top (required)'

 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
 #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
 # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
 top (required)'


 This is what I would expect. There is nothing recursive about this. There
 is a failure in
 a before block that runs before every example. It's the same as if you had
 the same
 broken code directly in each example.


 HTH,
 David


 [Sorry if this starts a new thread. I was attempting to monitor and
 reply to the group through Google Groups, but apparently that mirror
 stopped working on April 10, so I'm having to reconstruct this reply.]

 Thanks for the reply.

 Although the output says 5 examples, 5 failures, there is only one
 example, hence my confusion about it failing five times. Also, the
 documentation output lists each describe block (except the first)
 two to four times.

 When I fix the error, I get one line per describe, plus one example
 completed, as expected:


 [myproject (tests)]$ rspec spec/requests/test2* --format documentation

 public pages
 details page
 when visiting a second page before example
 should has link Sign in

 Finished in 1.44 seconds
 1 example, 0 failures


 I have since discovered that the problem only occurs when using
 --format documentation. Without that, with the error back in place,
 RSpec only gives me one error, not five:


 [myproject (tests)]$ rspec spec/requests/test2*
 F

 Failures:

 1) public pages details page when visiting a second 

Re: [rspec-users] One error reported recursively if two pages visited by request spec

2012-04-18 Thread David Chelimsky
On Tuesday, April 17, 2012 at 11:11 PM, Mark Berry wrote:
 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
 #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
 # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
 top (required)'
 
 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
 #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
 # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
 top (required)'
 
 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
 #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
 # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
 top (required)'
 
 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
 #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
 # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
 top (required)'
 
 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
 #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
 # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
 top (required)'
 
 
 

This is what I would expect. There is nothing recursive about this. There is 
a failure in a before block that runs before every example. It's the same as if 
you had the same broken code directly in each example.

HTH,
David
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] One error reported recursively if two pages visited by request spec

2012-04-18 Thread Mark Berry
On Wed April 18, 2012 at  5:35 AM, David Chelimsky wrote:
On Tuesday, April 17, 2012 at 11:11 PM, Mark Berry wrote:
 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
 #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
 # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
 top (required)'

 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
 #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
 # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
 top (required)'

 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
 #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
 # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
 top (required)'

 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
 #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
 # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
 top (required)'

 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
 #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
 # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
 top (required)'




This is what I would expect. There is nothing recursive about this. There is 
a failure in
a before block that runs before every example. It's the same as if you had the 
same
broken code directly in each example.

HTH,
David

[Sorry if this starts a new thread. I was attempting to monitor and
reply to the group through Google Groups, but apparently that mirror
stopped working on April 10, so I'm having to reconstruct this reply.]

Thanks for the reply.

Although the output says 5 examples, 5 failures, there is only one
example, hence my confusion about it failing five times. Also, the
documentation output lists each describe block (except the first)
two to four times.

When I fix the error, I get one line per describe, plus one example
completed, as expected:


[myproject (tests)]$ rspec spec/requests/test2* --format documentation

public pages
  details page
when visiting a second page before example
  should has link Sign in

Finished in 1.44 seconds
1 example, 0 failures


I have since discovered that the problem only occurs when using
--format documentation. Without that, with the error back in place,
RSpec only gives me one error, not five:


[myproject (tests)]$ rspec spec/requests/test2*
F

Failures:

  1) public pages details page when visiting a second page before example
 Failure/Error: before { visit sign_in_path }
 NameError:
   undefined local variable or method `sign_in_path' for
#RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1:0xa1f2ef8
 # 

Re: [rspec-users] One error reported recursively if two pages visited by request spec

2012-04-18 Thread David Chelimsky
On Wednesday, April 18, 2012 at 4:30 PM, Mark Berry wrote:
  On Wed April 18, 2012 at 5:35 AM, David Chelimsky wrote:
  On Tuesday, April 17, 2012 at 11:11 PM, Mark Berry wrote:
   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
   #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
   # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
   top (required)'
   
   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
   #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
   # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
   top (required)'
   
   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
   #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
   # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
   top (required)'
   
   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
   #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
   # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
   top (required)'
   
   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
   #RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0xb6f3460
   # ./spec/requests/test2_pages_spec.rb:16:in `block (5 levels) in
   top (required)'
   
  
  
 
 
  This is what I would expect. There is nothing recursive about this. There 
  is a failure in
  a before block that runs before every example. It's the same as if you had 
  the same
  broken code directly in each example.
  
 
 
  HTH,
  David
  
 
 
 [Sorry if this starts a new thread. I was attempting to monitor and
 reply to the group through Google Groups, but apparently that mirror
 stopped working on April 10, so I'm having to reconstruct this reply.]
 
 Thanks for the reply.
 
 Although the output says 5 examples, 5 failures, there is only one
 example, hence my confusion about it failing five times. Also, the
 documentation output lists each describe block (except the first)
 two to four times.
 
 When I fix the error, I get one line per describe, plus one example
 completed, as expected:
 
 
 [myproject (tests)]$ rspec spec/requests/test2* --format documentation
 
 public pages
 details page
 when visiting a second page before example
 should has link Sign in
 
 Finished in 1.44 seconds
 1 example, 0 failures
 
 
 I have since discovered that the problem only occurs when using
 --format documentation. Without that, with the error back in place,
 RSpec only gives me one error, not five:
 
 
 [myproject