Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not picking up specs wrapped in context or additional describe blocks #6

Closed
aaronmallen opened this issue Apr 13, 2017 · 7 comments · May be fixed by #7
Closed

not picking up specs wrapped in context or additional describe blocks #6

aaronmallen opened this issue Apr 13, 2017 · 7 comments · May be fixed by #7

Comments

@aaronmallen
Copy link

aaronmallen commented Apr 13, 2017

given the spec file:

RSpec.describe MyModule do
  context 'Some context' do
    describe '.myInstanceMethod' do
      it 'should equal foo' do
        expect(MyModule.myInstanceMethod).to eq 'foo'
      end
    end
  end
  context 'Some other context' do
    describe '.myInstanceMethod' do
      it 'should not equal foo' do
        expect(MyModule.myInstanceMethod).not_to eq 'foo'
      end
    end
  end
end

or even given:

RSpec.describe MyModule do
  context 'Some context' do
    describe MyModule.myInstanceMethod do
      it 'should equal foo' do
        expect(MyModule.myInstanceMethod).to eq 'foo'
      end
    end
  end
  context 'Some other context' do
    describe MyModule.myInstanceMethod do
      it 'should not equal foo' do
        expect(MyModule.myInstanceMethod).not_to eq 'foo'
      end
    end
  end
end

Problem:

The plugin doesn't seem to append the specifications to the docs.

Expectation

The plugin should both find these specs (including the string variants in the first example) and respect the context of each spec in the Specifications outline:

.myInstanceMethod

Specifications:

  • Some context
    • should equal foo
  • Some other context
    • should not equal foo

Other relevant information:

$ ruby -v
#=> ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin16]
$ rspec -v
#=> 3.5.4
$ yard -v
#=> yard 0.9.8
# .yardopts
--exclude lib/task/*
--plugin rspec
-r README.md
-
CODE_OF_CONDUCT.md
LICENSE

My file structure is:

  • lib/my_module.rb
  • spec/lib/my_module_spec.rb

and is being invoked via rake task:

YARD::Rake::YardocTask.new do |t|
  t.files         = ['lib/**/*.rb', 'spec/**/*_spec.rb']
  t.stats_options = ['--list-undoc']
end
@aaronmallen
Copy link
Author

this also doesn't work if you use describe in place of context in either of my examples as well.

@aaronmallen aaronmallen changed the title not picking up specs wrapped in context or addition describe blocks not picking up specs wrapped in context or additional describe blocks Apr 13, 2017
@lsegal
Copy link
Owner

lsegal commented Apr 15, 2017

This plugin doesn't support nested definitions. When this was written, that feature was not available in RSpec.

@aaronmallen
Copy link
Author

ah, ok so less of a bug more of a feature request.

@lsegal
Copy link
Owner

lsegal commented Apr 15, 2017

@aaronmallen PRs accepted, I don't really update this repository anymore. If you want to take over maintainership of yard-rspec, I'm all for it.

@aaronmallen
Copy link
Author

aaronmallen commented Apr 15, 2017

@isegal not to pass the buck, but it definitely seems that offer would be better extended to:

They all seem to have done a lot of great work on top of yours already and might be a little more qualified for the task. I'll def. look into doing a PR though.

Jesus added a commit to Jesus/yard-tests-rspec that referenced this issue Aug 6, 2019
Two changes:

- Handle calls to 'context' just the same way as 'describe'.
- Allow additional intermediate blocks.

Closes lsegal#6.
@Jesus
Copy link

Jesus commented Aug 6, 2019

I'd be interested in doing some updates to this plugin, I'd take the offer to be a contributor.

@Jesus
Copy link

Jesus commented Aug 8, 2019

I'm sorry to bother again, but ping @lsegal 😅

Jesus added a commit to Jesus/yard-tests-rspec that referenced this issue Aug 8, 2019
Two changes:

- Handle calls to 'context' just the same way as 'describe'.
- Allow additional intermediate blocks.

Closes lsegal#6.
@aaronmallen aaronmallen closed this as not planned Won't fix, can't repro, duplicate, stale Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants