You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider the following project structure:
# 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
module MyLib
def my_method
"works"
end
end
require "rspec"
RSpec.configure do |config|
config.include(MyLib)
end
# .rspec
-r
lib/my_lib
# Rakefile
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
RSpec::Core::RakeTask.new(:rcov) do |spec|
spec.rcov = true
end
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 set a breakpoint into the 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]
Consider the following project structure:
# 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
When using
rake spec
then example passes, but withrake rcov
i seethis:
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 set a breakpoint into the example block then with
rake spec
i cansee that module is included, but not with
rake rcov
althoughmy_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]
For some reason the module is not included when running with RCov.
The text was updated successfully, but these errors were encountered: