Jarmo Pertman
2010-Nov-04 19:21 UTC
[rspec-users] Upgrade problems/questions regarding RSpec 1.3.0 to 2.0.1
Hello! I''m trying to migrate my scripts from RSpec 1.3.0 to 2.0.1 having some issues so far. 1) I don''t like is that ".rspec" has to be in the working directory and cannot be anymore in "spec". Okay, i can issue "mv spec/ spec.opts .rspec" in my projects, but why isn''t it supported? 2) If there is somewhere "require ''spec''" in existing specs or spec_helper or anywhere then test will not be run and this will be shown instead: Finished in 0 seconds 0 examples, 0 failures It is also possible to reproduce it like this from command line: rspec -rspec blah_spec.rb 3) Why does html formatter snippet show always failing line as: raise(RSpec::Expectations::ExpectationNotMetError.new(message)) in 1.x it would show the failing line in the spec file instead... is this a bug? 4) In 1.x i modified ExampleGroup''s description in my html formatter to have some additional information in it like timestamp. I did it in example_group_started where the passed variable example_group was an instance of the ExampleGroup. In 2.x this is just a class name. How can i accomplish the similar functionality? 5) I don''t understand how to use multiple formatters together. In RSpec 1.x it is possible to use multiple formatters like this: spec --format nested --format html:output/blah.html In RSpec 2.x it seems to me that only the last --format is used. The command below: rspec -f html -f d blah_spec.rb Uses only nested formatter. In RSpec 1.x you had to specify the file path like this: rspec -f html:path_to_output But it seems that in 2.x you have to use --out for that which overrides all the output of course. And on top of if there is everywhere used a term "formatter" in RSpec::Core::Configuration, but "formatters" (in plural) in RSpec::Core::Reporter. It''s constructor also allows to pass multiple formatters into it. I''d like to use two formatters together - documentation and html. Documentation would be helpful for faster feedback and for an indication of end of the testrun on the command line, but (custom) html formatter would include more information for better troubleshooting. I managed to do that currently by little monkey-patching and manual coding: module RSpec module Core class Configuration def reporter=(reporter) @reporter = reporter end public :built_in_formatter end end end and in spec_helper or somewhere: config = RSpec.configuration config.color_enabled = true documentation_formatter config.built_in_formatter(:documentation).new(config.output) @@html_formatter = MyHtmlFormatter.new("blah/index.html") # it takes file path as a string due to archival and file in use needs config.reporter = RSpec::Core::Reporter.new(documentation_formatter, @@html_formatter) Is there some easier/more normal way to do this? Does this mean that RSpec 2 is meant to be used with only 1 formatter simultaneously?
Jarmo Pertman
2010-Nov-04 19:52 UTC
[rspec-users] Upgrade problems/questions regarding RSpec 1.3.0 to 2.0.1
On Nov 4, 9:21?pm, Jarmo Pertman <jarm... at gmail.com> wrote:> 3) Why does html formatter snippet show always failing line as: > ? raise(RSpec::Expectations::ExpectationNotMetError.new(message)) > > in 1.x it would show the failing line in the spec file instead... is > this a bug?I cannot reproduce this problem currently with standard html formatter although i don''t do anything with snippet extractor in my custom html formatter. I need to investigate why the problem happens now and then. Jarmo Pertman ----- IT does really matter - http://www.itreallymatters.net
Jarmo Pertman
2010-Nov-04 20:37 UTC
[rspec-users] Upgrade problems/questions regarding RSpec 1.3.0 to 2.0.1
There seems to be also a problem when using RCov raketask - it doesn''t seem to load RSpec. Consider the following project structure: # Rakefile require ''rspec/core/rake_task'' RSpec::Core::RakeTask.new(:spec) do |spec| end RSpec::Core::RakeTask.new(:rcov) do |spec| spec.rcov = true end # lib/my_lib.rb class MyLib end # spec/my_lib_spec.rb require "lib/my_lib" describe "should work" do it "doesn''t" do MyLib.new.should be end end Now, when executing `rake spec` everything works - RSpec itself gets loaded automatically. When executing `rake rcov` on the other hand then this will be the output: C:\Users\jarmo\Desktop\minu\projects\Ruby\blah>rake rcov (in C:/Users/jarmo/Desktop/minu/projects/Ruby/blah) c:/ruby/bin/ruby.exe -S rcov -Ispec "./spec/my_lib_spec.rb" ./spec/my_lib_spec.rb:1: undefined method `describe'' for main:Object (NoMethodError) from c:/ruby/lib/ruby/gems/1.8/gems/rcov-0.9.8/bin/rcov:511:in `load'' from c:/ruby/lib/ruby/gems/1.8/gems/rcov-0.9.8/bin/rcov:511 from c:/ruby/bin/rcov:19:in `load'' from c:/ruby/bin/rcov:19 rake aborted! ruby -S rcov -Ispec "./spec/my_lib_spec.rb" failed It will pass of course if i''ll add `require "rspec"` to somewhere. Jarmo Pertman ----- IT does really matter - http://www.itreallymatters.net
Jarmo Pertman
2010-Nov-04 21:28 UTC
[rspec-users] Upgrade problems/questions regarding RSpec 1.3.0 to 2.0.1
On Nov 4, 9:52?pm, Jarmo Pertman <jarm... at gmail.com> wrote:> I cannot reproduce this problem currently with standard html formatter > although i don''t do anything with snippet extractor in my custom html > formatter. I need to investigate why the problem happens now and then.I''ve managed to reproduce it again and always like this: # some_spec.rb describe "something" do it "doesn''t work" do true.should be_false end end C:\Users\jarmo\Desktop\minu\projects\Ruby\blah2>rspec some_spec.rb -f html -o out.html And this is the output: http://dl.dropbox.com/u/2731643/misc/out.html with -b the whole stacktrace is as following: c:/ruby/lib/ruby/gems/1.8/gems/rspec-expectations-2.0.1/lib/rspec/ expectations/fail_with.rb:29:in `fail_with'' c:/ruby/lib/ruby/gems/1.8/gems/rspec-expectations-2.0.1/lib/rspec/ expectations/handler.rb:21:in `handle_matcher'' c:/ruby/lib/ruby/gems/1.8/gems/rspec-expectations-2.0.1/lib/rspec/ expectations/extensions/kernel.rb:27:in `should'' ./some_spec.rb:3 c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ example.rb:47:in `instance_eval'' c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ example.rb:47:in `run'' c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ example.rb:86:in `call'' c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ example.rb:86:in `with_around_hooks'' c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ example.rb:44:in `run'' c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ example.rb:80:in `call'' c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ example.rb:80:in `with_pending_capture'' c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ example.rb:79:in `catch'' c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ example.rb:79:in `with_pending_capture'' c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ example.rb:43:in `run'' c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ example_group.rb:260:in `run_examples'' c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ example_group.rb:256:in `map'' c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ example_group.rb:256:in `run_examples'' c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ example_group.rb:230:in `run'' c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ command_line.rb:26:in `run'' c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ command_line.rb:26:in `map'' c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ command_line.rb:26:in `run'' c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ reporter.rb:11:in `report'' c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ command_line.rb:23:in `run'' c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ runner.rb:55:in `run_in_process'' c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ runner.rb:46:in `run'' c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ runner.rb:10:in `autorun'' c:/Ruby/bin/rspec:19 Jarmo Pertman ----- IT does really matter - http://www.itreallymatters.net
Jarmo Pertman
2010-Nov-04 23:14 UTC
[rspec-users] Upgrade problems/questions regarding RSpec 1.3.0 to 2.0.1
It also fails with RCov very strangely when including module in RSpec.configure block like this: # spec/my_lib_spec.rb require "rspec" describe "should work" do it "with rcov also" do MyLib.should be my_method.should == "works" end end # lib/my_lib.rb require "rspec" module MyLib def my_method "works" end end RSpec.configure do |config| config.include(MyLib) end # .rspec -r lib/my_lib and Rakefile is the same as before. When using `rake spec` then example passes, but with `rake rcov` i see this: C:\Users\jarmo\Desktop\minu\projects\Ruby\blah>rake rcov (in C:/Users/jarmo/Desktop/minu/projects/Ruby/blah) c:/ruby/bin/ruby.exe -S rcov -Ispec "./spec/my_lib_spec.rb" F Failures: 1) should work with rcov also Failure/Error: my_method.should == "works" undefined local variable or method `my_method'' for #<RSpec::Core::ExampleGroup::Nested_1:0x59cb488 @__memoized={}> # ./spec/my_lib_spec.rb:6 Finished in 0.014 seconds 1 example, 1 failure rake aborted! ruby -S rcov -Ispec "./spec/my_lib_spec.rb" failed (See full trace by running task with --trace) When i put a breakpoint into example block then with `rake spec` i can see that module is included, but not with `rake rcov` although my_lib.rb is loaded because the first expectation succeeds as seen above. With `rake spec`: (rdb:1) l [3, 12] in C:/Users/jarmo/Desktop/minu/projects/Ruby/blah/spec/ my_lib_spec.rb 3 describe "should work" do 4 it "with rcov also" do 5 MyLib.should be 6 require "ruby-debug" 7 debugger => 8 my_method.should == "works" 9 end 10 end (rdb:1) self.class.included_modules [MyLib, RSpec::Matchers, RSpec::Core::MockFrameworkAdapter, RSpec::Core::Pending, RSpec::Core::Let::InstanceMethods, RSpec::Core::Let, RSpec::Core::Subject, RSpec::Core::Extensions::InstanceEvalWithArgs, RSpec::Mocks::Methods, PP::ObjectMixin, RSpec::Core::SharedExampleGroup, RSpec::Core::ObjectExtensions, Kernel] With `rake rcov`: (rdb:1) self.class.included_modules [RSpec::Matchers, RSpec::Core::MockFrameworkAdapter, RSpec::Core::Pending, RSpec::Core::Let::InstanceMethods, RSpec::Core::Let, RSpec::Core::Subject, RSpec::Core::Extensions::InstanceEvalWithArgs, RSpec::Mocks::Methods, PP::ObjectMixin, RSpec::Core::SharedExampleGroup, RSpec::Core::ObjectExtensions, Kernel] So, for some reason the module is not included when running with RCov. By the way all the specs were working before with 1.3.0. Jarmo Pertman ----- IT does really matter - http://www.itreallymatters.net On Nov 4, 10:37?pm, Jarmo Pertman <jarm... at gmail.com> wrote:> There seems to be also a problem when using RCov raketask - it doesn''t > seem to load RSpec.
Jarmo Pertman
2010-Nov-05 00:18 UTC
[rspec-users] Upgrade problems/questions regarding RSpec 1.3.0 to 2.0.1
Upgrade to RSpec 2.x has been more painful than i expected. A lot more painful. Subject#subject behavior with "self" is also broken! This fails in RSpec 2 with stack overflow: describe "something" do subject { self } it "is ok?" do should be_ok end def ok? true end end It is passing in RSpec 1.3. See the original discussion of that feature that i myself suggested/needed http://groups.google.com/group/rspec/browse_thread/thread/89d6dd78b8f76df7/21109b78fc61a0e6 It also seems to me that the #subject specs provided with the patch for 1.x have been deleted also during some refactoring or something. At least i couldn''t find the specs testing that explicit functionality from rspec-core. They still exist at 1.x repo though https://github.com/dchelimsky/rspec/blob/master/spec/spec/example/example_methods_spec.rb I''m really sorry if some of the problems in this thread are already fixed in master, but i couldn''t see any open bugs relating to any of the problems described here. Waiting for some solutions-explanations how to solve most of the problems hopefully. Jarmo Pertman ----- IT does really matter - http://www.itreallymatters.net
David Chelimsky
2010-Nov-05 03:11 UTC
[rspec-users] Upgrade problems/questions regarding RSpec 1.3.0 to 2.0.1
On Nov 4, 2010, at 7:18 PM, Jarmo Pertman wrote:> Upgrade to RSpec 2.x has been more painful than i expected. A lot more > painful. > > Subject#subject behavior with "self" is also broken! > > This fails in RSpec 2 with stack overflow: > describe "something" do > subject { self } > > it "is ok?" do > should be_ok > end > > def ok? > true > end > end > > It is passing in RSpec 1.3. See the original discussion of that > feature that i myself suggested/needed > http://groups.google.com/group/rspec/browse_thread/thread/89d6dd78b8f76df7/21109b78fc61a0e6 > > It also seems to me that the #subject specs provided with the patch > for 1.x have been deleted also during some refactoring or something. > At least i couldn''t find the specs testing that explicit functionality > from rspec-core. They still exist at 1.x repo though > https://github.com/dchelimsky/rspec/blob/master/spec/spec/example/example_methods_spec.rb > > I''m really sorry if some of the problems in this thread are already > fixed in master, but i couldn''t see any open bugs relating to any of > the problems described here. > > Waiting for some solutions-explanations how to solve most of the > problems hopefully.Hey Jarmo, Sorry for all the trouble, and thanks for all of the feedback. I''m completely consumed with getting last minute things together for The RSpec Book to go to the printer (yay), and preparing for my talk next week at RubyConf, so I''m not quite sure when I''ll be able to review/respond. Hopefully sometime over the weekend, but no guarantees. In the meantime, be sure to search the closed issues on github (unfortunately, they don''t show up if you search the open issues), and please feel free to open new issues for the problems you are experiencing. Cheers, David
David Chelimsky
2010-Nov-05 11:52 UTC
[rspec-users] Upgrade problems/questions regarding RSpec 1.3.0 to 2.0.1
On Nov 4, 2010, at 2:21 PM, Jarmo Pertman wrote:> Hello!Hello!> I''m trying to migrate my scripts from RSpec 1.3.0 to 2.0.1 having some > issues so far. > > 1) I don''t like is that ".rspec" has to be in the working directory > and cannot be anymore in "spec". Okay, i can issue "mv spec/ > spec.opts .rspec" in my projects, but why isn''t it supported?It''s more common across other libraries to put "dot files" in your home and/or project root directories.> 2) If there is somewhere "require ''spec''" in existing specs or > spec_helper or anywhere then test will not be run and this will be > shown instead: > Finished in 0 seconds > 0 examples, 0 failures > > It is also possible to reproduce it like this from command line: > rspec -rspec blah_spec.rbSounds like a new bug. Please report to http://github.com/rspec/rspec-core/issues.> 3) Why does html formatter snippet show always failing line as: > raise(RSpec::Expectations::ExpectationNotMetError.new(message)) > > in 1.x it would show the failing line in the spec file instead... is > this a bug?Yes. Please report to http://github.com/rspec/rspec-core/issues.> 4) In 1.x i modified ExampleGroup''s description in my html formatter > to have some additional information in it like timestamp. I did it in > example_group_started where the passed variable example_group was an > instance of the ExampleGroup. In 2.x this is just a class name. How > can i accomplish the similar functionality?You can write a custom subclass of the HtmlFormatter and add whatever you like.> 5) I don''t understand how to use multiple formatters together.You can''t yet. rspec-core-2 was built from Micronaut, so a lot of the functionality had to be rebuilt. This is one feature I didn''t forward port from rspec-1 because I didn''t see the value in it for the complexity. RSpec-2 has been in the works for over a year now and you''re the first person to ask about this, so it''s obviously not a widely used feature, and I''m trying to keep unused features out. Feel free to report this to http://github.com/rspec/rspec-core/issues and we can discuss it further in the issue.> In > RSpec 1.x it is possible to use multiple formatters like this: > spec --format nested --format html:output/blah.html > > In RSpec 2.x it seems to me that only the last --format is used. The > command below: > rspec -f html -f d blah_spec.rb > > Uses only nested formatter. In RSpec 1.x you had to specify the file > path like this: > rspec -f html:path_to_output > > But it seems that in 2.x you have to use --out for that which > overrides all the output of course. And on top of if there is > everywhere used a term "formatter" in RSpec::Core::Configuration, but > "formatters" (in plural) in RSpec::Core::Reporter. It''s constructor > also allows to pass multiple formatters into it. > > I''d like to use two formatters together - documentation and html. > Documentation would be helpful for faster feedback and for an > indication of end of the testrun on the command line, but (custom) > html formatter would include more information for better > troubleshooting. > > I managed to do that currently by little monkey-patching and manual > coding: > module RSpec > module Core > class Configuration > def reporter=(reporter) > @reporter = reporter > end > > public :built_in_formatter > end > end > end > > and in spec_helper or somewhere: > config = RSpec.configuration > config.color_enabled = true > documentation_formatter > config.built_in_formatter(:documentation).new(config.output) > @@html_formatter = MyHtmlFormatter.new("blah/index.html") # it takes > file path as a string due to archival and file in use needs > config.reporter = RSpec::Core::Reporter.new(documentation_formatter, > @@html_formatter) > > Is there some easier/more normal way to do this? > > Does this mean that RSpec 2 is meant to be used with only 1 formatter > simultaneously? > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
David Chelimsky
2010-Nov-05 11:53 UTC
[rspec-users] Upgrade problems/questions regarding RSpec 1.3.0 to 2.0.1
On Nov 4, 2010, at 4:28 PM, Jarmo Pertman wrote:> On Nov 4, 9:52 pm, Jarmo Pertman <jarm... at gmail.com> wrote: >> I cannot reproduce this problem currently with standard html formatter >> although i don''t do anything with snippet extractor in my custom html >> formatter. I need to investigate why the problem happens now and then. > > I''ve managed to reproduce it again and always like this: > > # some_spec.rb > describe "something" do > it "doesn''t work" do > true.should be_false > end > end > > C:\Users\jarmo\Desktop\minu\projects\Ruby\blah2>rspec some_spec.rb -f > html -o out.html > > And this is the output: > http://dl.dropbox.com/u/2731643/misc/out.html > > with -b the whole stacktrace is as following: > c:/ruby/lib/ruby/gems/1.8/gems/rspec-expectations-2.0.1/lib/rspec/ > expectations/fail_with.rb:29:in `fail_with'' > c:/ruby/lib/ruby/gems/1.8/gems/rspec-expectations-2.0.1/lib/rspec/ > expectations/handler.rb:21:in `handle_matcher'' > c:/ruby/lib/ruby/gems/1.8/gems/rspec-expectations-2.0.1/lib/rspec/ > expectations/extensions/kernel.rb:27:in `should'' > ./some_spec.rb:3 > c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ > example.rb:47:in `instance_eval'' > c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ > example.rb:47:in `run'' > c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ > example.rb:86:in `call'' > c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ > example.rb:86:in `with_around_hooks'' > c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ > example.rb:44:in `run'' > c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ > example.rb:80:in `call'' > c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ > example.rb:80:in `with_pending_capture'' > c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ > example.rb:79:in `catch'' > c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ > example.rb:79:in `with_pending_capture'' > c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ > example.rb:43:in `run'' > c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ > example_group.rb:260:in `run_examples'' > c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ > example_group.rb:256:in `map'' > c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ > example_group.rb:256:in `run_examples'' > c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ > example_group.rb:230:in `run'' > c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ > command_line.rb:26:in `run'' > c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ > command_line.rb:26:in `map'' > c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ > command_line.rb:26:in `run'' > c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ > reporter.rb:11:in `report'' > c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ > command_line.rb:23:in `run'' > c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ > runner.rb:55:in `run_in_process'' > c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ > runner.rb:46:in `run'' > c:/ruby/lib/ruby/gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core/ > runner.rb:10:in `autorun'' > c:/Ruby/bin/rspec:19Please report this to http://github.com/rspec/rspec-core/issues.
David Chelimsky
2010-Nov-05 11:59 UTC
[rspec-users] Upgrade problems/questions regarding RSpec 1.3.0 to 2.0.1
On Nov 4, 2010, at 3:37 PM, Jarmo Pertman wrote:> There seems to be also a problem when using RCov raketask - it doesn''t > seem to load RSpec. > > Consider the following project structure: > > # Rakefile > require ''rspec/core/rake_task'' > RSpec::Core::RakeTask.new(:spec) do |spec| > end > > RSpec::Core::RakeTask.new(:rcov) do |spec| > spec.rcov = true > end > > # lib/my_lib.rb > class MyLib > end > > # spec/my_lib_spec.rb > require "lib/my_lib" > > describe "should work" do > it "doesn''t" do > MyLib.new.should be > end > end > > Now, when executing `rake spec` everything works - RSpec itself gets > loaded automatically. When executing `rake rcov` on the other hand > then this will be the output: > > C:\Users\jarmo\Desktop\minu\projects\Ruby\blah>rake rcov > (in C:/Users/jarmo/Desktop/minu/projects/Ruby/blah) > c:/ruby/bin/ruby.exe -S rcov -Ispec "./spec/my_lib_spec.rb" > ./spec/my_lib_spec.rb:1: undefined method `describe'' for main:Object > (NoMethodError) > from c:/ruby/lib/ruby/gems/1.8/gems/rcov-0.9.8/bin/rcov:511:in > `load'' > from c:/ruby/lib/ruby/gems/1.8/gems/rcov-0.9.8/bin/rcov:511 > from c:/ruby/bin/rcov:19:in `load'' > from c:/ruby/bin/rcov:19 > rake aborted! > ruby -S rcov -Ispec "./spec/my_lib_spec.rb" failed > > It will pass of course if i''ll add `require "rspec"` to somewhere.Bug. Please report this to http://github.com/rspec/rspec-core/issues.
Jarmo Pertman
2010-Nov-05 12:02 UTC
[rspec-users] Upgrade problems/questions regarding RSpec 1.3.0 to 2.0.1
I''d wait for some preliminary answers from you or anyone else from core before opening up any new issues. The main blockers for me to start using RSpec 2 are currently the subject {self} and html formatter snippet problems. Hopefully you''ll find some time to answer to my provided feedback. Jarmo Pertman ----- IT does really matter - http://www.itreallymatters.net On Nov 5, 5:11?am, David Chelimsky <dchelim... at gmail.com> wrote:> Hey Jarmo, > > Sorry for all the trouble, and thanks for all of the feedback. I''m completely consumed with getting last minute things together for The RSpec Book to go to the printer (yay), and preparing for my talk next week at RubyConf, so I''m not quite sure when I''ll be able to review/respond. Hopefully sometime over the weekend, but no guarantees. > > In the meantime, be sure to search the closed issues on github (unfortunately, they don''t show up if you search the open issues), and please feel free to open new issues for the problems you are experiencing. > > Cheers, > David
David Chelimsky
2010-Nov-05 12:10 UTC
[rspec-users] Upgrade problems/questions regarding RSpec 1.3.0 to 2.0.1
On Nov 4, 2010, at 7:18 PM, Jarmo Pertman wrote:> Upgrade to RSpec 2.x has been more painful than i expected. A lot more > painful. > > Subject#subject behavior with "self" is also broken! > > This fails in RSpec 2 with stack overflow: > describe "something" do > subject { self } > > it "is ok?" do > should be_ok > end > > def ok? > true > end > end > > It is passing in RSpec 1.3. See the original discussion of that > feature that i myself suggested/needed > http://groups.google.com/group/rspec/browse_thread/thread/89d6dd78b8f76df7/21109b78fc61a0e6 > > It also seems to me that the #subject specs provided with the patch > for 1.x have been deleted also during some refactoring or something.rspec-core-2 was a complete rewrite, so it''s not that specs or code were deleted, just not all were forward ported.> At least i couldn''t find the specs testing that explicit functionality > from rspec-core. They still exist at 1.x repo though > https://github.com/dchelimsky/rspec/blob/master/spec/spec/example/example_methods_spec.rbThese were largely about a module re-opening issue. I added a github issue for that: https://github.com/rspec/rspec-core/issues/issue/210 but I''m not sure it solves your need. If you don''t think it will, please report this one as well to https://github.com/rspec/rspec-core/issues.> I''m really sorry if some of the problems in this thread are already > fixed in master, but i couldn''t see any open bugs relating to any of > the problems described here.I don''t think any of these issues have been reported. Most of the problems you''re encountering have to do with unconventional use, which is why they haven''t come up before. Thanks again for all the feedback. Cheers, David> Waiting for some solutions-explanations how to solve most of the > problems hopefully.
David Chelimsky
2010-Nov-05 15:06 UTC
[rspec-users] Upgrade problems/questions regarding RSpec 1.3.0 to 2.0.1
On Nov 5, 2010, at 7:02 AM, Jarmo Pertman wrote:> I''d wait for some preliminary answers from you or anyone else from > core before opening up any new issues. The main blockers for me to > start using RSpec 2 are currently the subject {self} and html > formatter snippet problems. > > Hopefully you''ll find some time to answer to my provided feedback.I''d really prefer you just submit the issues to http://github.com/rspec/rspec-core/issues. Keeps the conversation about each issue separate and ensures they each stay on the radar and get addressed, even if not immediately. Thanks, David> > Jarmo Pertman > ----- > IT does really matter - http://www.itreallymatters.net > > On Nov 5, 5:11 am, David Chelimsky <dchelim... at gmail.com> wrote: >> Hey Jarmo, >> >> Sorry for all the trouble, and thanks for all of the feedback. I''m completely consumed with getting last minute things together for The RSpec Book to go to the printer (yay), and preparing for my talk next week at RubyConf, so I''m not quite sure when I''ll be able to review/respond. Hopefully sometime over the weekend, but no guarantees. >> >> In the meantime, be sure to search the closed issues on github (unfortunately, they don''t show up if you search the open issues), and please feel free to open new issues for the problems you are experiencing. >> >> Cheers, >> David > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
Jarmo Pertman
2010-Nov-05 19:24 UTC
[rspec-users] Upgrade problems/questions regarding RSpec 1.3.0 to 2.0.1
I didn''t refresh my browser before writing that reply thus didn''t see that you had already answered. Going to create those issues soon. Thanks for your feedback! Jarmo On Nov 5, 5:06?pm, David Chelimsky <dchelim... at gmail.com> wrote:> On Nov 5, 2010, at 7:02 AM, Jarmo Pertman wrote: > > > I''d wait for some preliminary answers from you or anyone else from > > core before opening up any new issues. The main blockers for me to > > start using RSpec 2 are currently the subject {self} and html > > formatter snippet problems. > > > Hopefully you''ll find some time to answer to my provided feedback. > > I''d really prefer you just submit the issues tohttp://github.com/rspec/rspec-core/issues. Keeps the conversation about each issue separate and ensures they each stay on the radar and get addressed, even if not immediately. > > Thanks, > David > > > > > > > > > > > > > Jarmo Pertman > > ----- > > IT does really matter -http://www.itreallymatters.net > > > On Nov 5, 5:11 am, David Chelimsky <dchelim... at gmail.com> wrote: > >> Hey Jarmo, > > >> Sorry for all the trouble, and thanks for all of the feedback. I''m completely consumed with getting last minute things together for The RSpec Book to go to the printer (yay), and preparing for my talk next week at RubyConf, so I''m not quite sure when I''ll be able to review/respond. Hopefully sometime over the weekend, but no guarantees. > > >> In the meantime, be sure to search the closed issues on github (unfortunately, they don''t show up if you search the open issues), and please feel free to open new issues for the problems you are experiencing. > > >> Cheers, > >> David > > _______________________________________________ > > rspec-users mailing list > > rspec-us... at rubyforge.org > >http://rubyforge.org/mailman/listinfo/rspec-users > > _______________________________________________ > rspec-users mailing list > rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users
Jarmo Pertman
2010-Nov-05 20:29 UTC
[rspec-users] Upgrade problems/questions regarding RSpec 1.3.0 to 2.0.1
On Nov 5, 1:52?pm, David Chelimsky <dchelim... at gmail.com> wrote:> > 4) In 1.x i modified ExampleGroup''s description in my html formatter > > to have some additional information in it like timestamp. I did it in > > example_group_started where the passed variable example_group was an > > instance of the ExampleGroup. In 2.x this is just a class name. How > > can i accomplish the similar functionality? > > You can write a custom subclass of the HtmlFormatter and add whatever you like.Since i don''t consider this as an issue to be reported at GitHub rather than a new way to do things then i just want to know how should i do this. I understand that i can write a custom subclass of the HtmlFormatter and do there whatever i like. This is the actual case - i already have an subclass of HtmlFormatter, but the problem is that super class is acting differently than it was in 1.x. In HtmlFormatter#example_group_started a parameter called example_group was an actual instance of the current ExampleGroup in 1.x thus i were able to modify it''s description so it would have additional information in my custom html formatter report. In 2.x the parameter example_group is not anymore an instance of an ExampleGroup, but just a class constant for runtime ExampleGroup class, thus there''s nothing useful to do with that parameter anymore. How should/could i modify the description now? I''m afraid that in HtmlFormatter#example_started where i could access the ExampleGroup from the Example instance it''s already too late since ExampleGroup description might be already flushed to the report. Haven''t tried that yet though. Hopefully you understand my concern better now. Jarmo Pertman
Jarmo Pertman
2010-Nov-05 20:33 UTC
[rspec-users] Upgrade problems/questions regarding RSpec 1.3.0 to 2.0.1
I''ve created the issues. I''m copying them to here also to give an overview of the outcome of this thread. 1) 0 examples will be run if requiring "spec" https://github.com/rspec/rspec-core/issues/issue/212 2) add possibility to use multiple formatters at the same time https://github.com/rspec/rspec-core/issues/issue/213 3) using HtmlFormatter shows RSpec''s internal snippet in the report https://github.com/rspec/rspec-core/issues/issue/214 4) RCov RakeTask doesn''t load RSpec https://github.com/rspec/rspec-core/issues/issue/215 5) using RCov RakeTask doesn''t include modules into example groups with RSpec.configure https://github.com/rspec/rspec-core/issues/issue/216 6) Subject#subject {self} causes stack overflow: https://github.com/rspec/rspec-core/issues/issue/217 Jarmo Pertman ----- IT does really matter - http://www.itreallymatters.net On Nov 5, 5:06?pm, David Chelimsky <dchelim... at gmail.com> wrote:> I''d really prefer you just submit the issues tohttp://github.com/rspec/rspec-core/issues. Keeps the conversation about each issue separate and ensures they each stay on the radar and get addressed, even if not immediately. > > Thanks, > David
Jarmo Pertman
2010-Nov-10 20:48 UTC
[rspec-users] Upgrade problems/questions regarding RSpec 1.3.0 to 2.0.1
Still no pointers about the small problem below? On Nov 5, 10:29?pm, Jarmo Pertman <jarm... at gmail.com> wrote:> On Nov 5, 1:52?pm, David Chelimsky <dchelim... at gmail.com> wrote: > > > > 4) In 1.x i modified ExampleGroup''s description in my html formatter > > > to have some additional information in it like timestamp. I did it in > > > example_group_started where the passed variable example_group was an > > > instance of the ExampleGroup. In 2.x this is just a class name. How > > > can i accomplish the similar functionality? > > > You can write a custom subclass of the HtmlFormatter and add whatever you like. > > Since i don''t consider this as an issue to be reported at GitHub > rather than a new way to do things then i just want to know how should > i do this. I understand that i can write a custom subclass of the > HtmlFormatter and do there whatever i like. This is the actual case - > i already have an subclass of HtmlFormatter, but the problem is that > super class is acting differently than it was in 1.x. > > In HtmlFormatter#example_group_started a parameter called > example_group was an actual instance of the current ExampleGroup in > 1.x thus i were able to modify it''s description so it would have > additional information in my custom html formatter report. In 2.x the > parameter example_group is not anymore an instance of an ExampleGroup, > but just a class constant for runtime ExampleGroup class, thus there''s > nothing useful to do with that parameter anymore. How should/could i > modify the description now? I''m afraid that in > HtmlFormatter#example_started where i could access the ExampleGroup > from the Example instance it''s already too late since ExampleGroup > description might be already flushed to the report. Haven''t tried that > yet though. > > Hopefully you understand my concern better now. > > Jarmo Pertman