niku -E:)
2011-Dec-30 00:06 UTC
[rspec-users] rspec can''t be finish when cause StopIteration
When I execute following spec file, rspec can''t be
finish(can''t display
shell prompt).
How do I check StopIteration?
I''m using
/Users/niku% ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]
/Users/niku% rspec -v
2.7.1
describe do
subject { [1,2].to_enum }
it do
# expect { 2.times{ subject.next } }. # failure, but it can be finish
expect { 3.times{ subject.next } }.
to raise_error(StopIteration)
end
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/rspec-users/attachments/20111229/6867734f/attachment-0001.html>
David Chelimsky
2011-Dec-30 21:43 UTC
[rspec-users] rspec can''t be finish when cause StopIteration
On Dec 29, 2011, at 6:06 PM, niku -E:) wrote:> When I execute following spec file, rspec can''t be finish(can''t display shell prompt). > How do I check StopIteration? > > I''m using > /Users/niku% ruby -v > ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0] > /Users/niku% rspec -v > 2.7.1 > > describe do > subject { [1,2].to_enum } > it do > # expect { 2.times{ subject.next } }. # failure, but it can be finish > expect { 3.times{ subject.next } }. > to raise_error(StopIteration) > end > endI can''t reproduce this. Having copied your example as/is, I get the following: ============================$ ruby -v ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0] [david: tmp]$ gem list rspec *** LOCAL GEMS *** rspec (2.7.0) rspec-core (2.7.1) rspec-expectations (2.7.0) rspec-mocks (2.7.0) [david: tmp]$ rspec example_spec.rb . Finished in 0.13401 seconds 1 example, 0 failures [david: tmp]$ ============================ Anybody else?
niku -E:)
2011-Dec-31 00:58 UTC
[rspec-users] rspec can''t be finish when cause StopIteration
Thank you David
I took commands.
It seems to me similar environment.
But different results.
Regards
===/Users/niku% ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]
/Users/niku% gem list rspec
*** LOCAL GEMS ***
rspec (2.7.0)
rspec-core (2.7.1)
rspec-expectations (2.7.0)
rspec-mocks (2.7.0)
/Users/niku% cat stop_iteration_spec.rb
describe do
subject { [1,2].to_enum }
it do
# expect { 2.times{ subject.next } }. # failure, but it can be finish
expect { 3.times{ subject.next } }.
to raise_error(StopIteration)
end
end
/Users/niku% rspec stop_iteration_spec.rb
should raise StopIteration
Finished in 0.13396 seconds
1 example, 0 failures
^C
Exiting... Interrupt again to exit immediately.
/Users/niku%
===
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/rspec-users/attachments/20111230/21bfa33d/attachment.html>