Nathan Voxland
2011-May-04 19:29 UTC
[rspec-users] Re-executing rspec tests in existing JRuby container
I have a JRuby Servlet environment very much like the "Parse Once, Eval Many Times on Servlet" example at http://kenai.com/projects/jruby/pages/RedBridgeServletExamples. What I am trying to do is execute an rspec test by hitting a URL mapped to my JRuby servlet. I get an expected error the first time I access the URL, but for each URL access after that I get the error IOError: closed stream write at org/jruby/RubyIO.java:1322 write at org/jruby/RubyIO.java:2305 puts at org/jruby/RubyIO.java:2260 puts at org/jruby/RubyIO.java:2252 message at C:/jboss......gems/rspec-core-2.5.1/lib/rspec/core/ formatters/base_text_formatter.rb:15 send at org/jruby/RubyKernel.java:2056 notify at C:/jboss......gems/rspec-core-2.5.1/lib/rspec/core/ reporter.rb:75 each at org/jruby/RubyArray.java:1602 notify at C:/jboss......gems/rspec-core-2.5.1/lib/rspec/core/ reporter.rb:74 message at C:/jboss......gems/rspec-core-2.5.1/lib/rspec/core/ reporter.rb:38 announce_exclusion_filter at C:/jboss......gems/rspec-core-2.5.1/lib/ rspec/core/world.rb:77 (root) at <script>:33 which appears to be because rspec does not expect me to be assigning a new output to reporter on each execution. Is there a supported way to re-execute rspec multiple times without restarting my webserver? Or does rspec expect to only be called once? Note: I am fine (and probably require) making calls to the rspec API directly, rather than using the command line because it is embedded in a server. Nathan
David Chelimsky
2011-May-07 14:38 UTC
[rspec-users] Re-executing rspec tests in existing JRuby container
On May 4, 2011, at 2:29 PM, Nathan Voxland wrote:> I have a JRuby Servlet environment very much like the "Parse Once, > Eval Many Times on Servlet" example at http://kenai.com/projects/jruby/pages/RedBridgeServletExamples. > > What I am trying to do is execute an rspec test by hitting a URL > mapped to my JRuby servlet. I get an expected error the first time I > access the URL, but for each URL access after that I get the error > > IOError: closed stream<snip/>> which appears to be because rspec does not expect me to be assigning a > new output to reporter on each execution. > > Is there a supported way to re-execute rspec multiple times without > restarting my webserver?No.> Or does rspec expect to only be called once?Yes. RSpec is designed to automate other things, but you are trying to automate it instead. There is an open feature request that would probably satisfy your use case: https://github.com/rspec/rspec-core/issues/359. Please feel free to add comments there. Cheers, David
David Chelimsky
2011-May-07 14:56 UTC
[rspec-users] Re-executing rspec tests in existing JRuby container
On May 7, 2011, at 9:38 AM, David Chelimsky wrote:> On May 4, 2011, at 2:29 PM, Nathan Voxland wrote: > >> I have a JRuby Servlet environment very much like the "Parse Once, >> Eval Many Times on Servlet" example at http://kenai.com/projects/jruby/pages/RedBridgeServletExamples. >> >> What I am trying to do is execute an rspec test by hitting a URL >> mapped to my JRuby servlet. I get an expected error the first time I >> access the URL, but for each URL access after that I get the error >> >> IOError: closed stream > > <snip/> > >> which appears to be because rspec does not expect me to be assigning a >> new output to reporter on each execution. >> >> Is there a supported way to re-execute rspec multiple times without >> restarting my webserver? > > No. > >> Or does rspec expect to only be called once? > > Yes. > > RSpec is designed to automate other things, but you are trying to automate it instead. > > There is an open feature request that would probably satisfy your use case: https://github.com/rspec/rspec-core/issues/359. Please feel free to add comments there.Actually, after further review, you can do this (something I never actually do - except in RSpec''s own suite!): RSpec::Core::Runner::run(options, err, out) - options is an array of command line options (which includes a list of at least one directory and/or file). Run ''rspec --help'' to see the available options. - err is the error stream or file. It can be any IO object. - out is the output stream of file. It can be any IO object. HTH, David
Nathan Voxland
2011-May-11 19:45 UTC
[rspec-users] Re-executing rspec tests in existing JRuby container
I''ll take a look at that. Nathan On May 7, 9:56?am, David Chelimsky <dchelim... at gmail.com> wrote:> On May 7, 2011, at 9:38 AM, David Chelimsky wrote: > > > > > > > > > > > On May 4, 2011, at 2:29 PM, Nathan Voxland wrote: > > >> I have a JRuby Servlet environment very much like the "Parse Once, > >> Eval Many Times on Servlet" example athttp://kenai.com/projects/jruby/pages/RedBridgeServletExamples. > > >> What I am trying to do is execute an rspec test by hitting a URL > >> mapped to my JRuby servlet. I get an expected error the first time I > >> access the URL, but for each URL access after that I get the error > > >> IOError: closed stream > > > <snip/> > > >> which appears to be because rspec does not expect me to be assigning a > >> new output to reporter on each execution. > > >> Is there a supported way to re-execute rspec multiple times without > >> restarting my webserver? > > > No. > > >> Or does rspec expect to only be called once? > > > Yes. > > > RSpec is designed to automate other things, but you are trying to automate it instead. > > > There is an open feature request that would probably satisfy your use case:https://github.com/rspec/rspec-core/issues/359. Please feel free to add comments there. > > Actually, after further review, you can do this (something I never actually do - except in RSpec''s own suite!): > > RSpec::Core::Runner::run(options, err, out) > > - options is an array of command line options (which includes a list of at least one directory and/or file). Run ''rspec --help'' to see the available options. > - err is the error stream or file. It can be any IO object. > - out is the output stream of file. It can be any IO object. > > HTH, > David > _______________________________________________ > rspec-users mailing list > rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users
David Chelimsky
2011-May-11 20:02 UTC
[rspec-users] Re-executing rspec tests in existing JRuby container
There was a similar issue reported to rspec-core that has some more info: https://github.com/rspec/rspec-core/issues/359 Cheers, David On May 11, 2011, at 2:45 PM, Nathan Voxland wrote:> I''ll take a look at that. > > Nathan > > On May 7, 9:56 am, David Chelimsky <dchelim... at gmail.com> wrote: >> On May 7, 2011, at 9:38 AM, David Chelimsky wrote: >> >> >> >> >> >> >> >> >> >>> On May 4, 2011, at 2:29 PM, Nathan Voxland wrote: >> >>>> I have a JRuby Servlet environment very much like the "Parse Once, >>>> Eval Many Times on Servlet" example athttp://kenai.com/projects/jruby/pages/RedBridgeServletExamples. >> >>>> What I am trying to do is execute an rspec test by hitting a URL >>>> mapped to my JRuby servlet. I get an expected error the first time I >>>> access the URL, but for each URL access after that I get the error >> >>>> IOError: closed stream >> >>> <snip/> >> >>>> which appears to be because rspec does not expect me to be assigning a >>>> new output to reporter on each execution. >> >>>> Is there a supported way to re-execute rspec multiple times without >>>> restarting my webserver? >> >>> No. >> >>>> Or does rspec expect to only be called once? >> >>> Yes. >> >>> RSpec is designed to automate other things, but you are trying to automate it instead. >> >>> There is an open feature request that would probably satisfy your use case:https://github.com/rspec/rspec-core/issues/359. Please feel free to add comments there. >> >> Actually, after further review, you can do this (something I never actually do - except in RSpec''s own suite!): >> >> RSpec::Core::Runner::run(options, err, out) >> >> - options is an array of command line options (which includes a list of at least one directory and/or file). Run ''rspec --help'' to see the available options. >> - err is the error stream or file. It can be any IO object. >> - out is the output stream of file. It can be any IO object. >> >> HTH, >> David >> _______________________________________________ >> rspec-users mailing list >> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users