-
Notifications
You must be signed in to change notification settings - Fork 367
keep_source_order is using test run order, not source order #192
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
Comments
Looking at the source code I don't know if it ever kept the examples in the source order if rspec was running them in a random order. The only thing it does is not sort by description, see here. I think the way around this is already built in. Can you try |
@oestrich I am running into trouble with I was trying to dig around the t.rspec_opts = ["--format RspecApiDocumentation::ApiFormatter", "--order default"] What is I know that most people create or comment on issues about stuff that is broken or that they don't like. But just know that I think this project is awesome, and I love the work you guys are doing on it. Keep it up! 😃 UPDATE: UPDATE: require 'rails_helper'
require 'rspec_api_documentation'
require 'rspec_api_documentation/dsl'
RspecApiDocumentation.configure do |config|
config.format = :json
config.curl_host = 'http://localhost:3000'
config.keep_source_order = true
config.api_name = "Rales Engine API V1"
end I didn't realize that had to be set in order for |
@indiesquidge Glad I could help! Got everything working? |
@oestrich well, now I'm curious about the difference in these rake tasks. When I have Let's say, hypothetically, that I would like to have both tasks working, where I suppose it all comes back to that one line I mentioned in my first comment and what that line is even doing for me/how I can manipulate it to do something different. |
I think at one point we didn't order tests at all so the rspec
|
Ah, I see. So at this point, the |
I was thinking I could just configure it in the rake task, like so desc 'Generate API request documentation from API specs'
RSpec::Core::RakeTask.new('docs:generate') do |t|
RspecApiDocumentation.configure do |config|
config.keep_source_order = false
end
t.pattern = 'spec/acceptance/**/*_spec.rb'
t.rspec_opts = ["--format RspecApiDocumentation::ApiFormatter"]
end and the respective desc 'Generate API request documentation from API specs in source order'
RSpec::Core::RakeTask.new('docs:generate:ordered') do |t|
RspecApiDocumentation.configure do |config|
config.keep_source_order = true
end
t.pattern = 'spec/acceptance/**/*_spec.rb'
t.rspec_opts = ["--format RspecApiDocumentation::ApiFormatter"]
end But this doesn't seem to work. Its back to having |
I've been facing the same problem. Multiple times, I thought I'd solved it after changing something in the way I generate the doc, but nothing works. Note that, as @zofrex, I have
Now checking RSpec documentation ( I also confirmed that no backwards compatibility is assured by running |
As I didn't know for sure what exact version the change happened (major > 2?), I checked inside RSpec::Core::Ordering::Registry. If we're comfortable with making the switch on version 2 to 3 of RSpec, I can change the condition to check `Gem.latest_spec_for('rspec-core').version.segments[0]`. This should fix zipmark#192.
If I may, I'd like to detail what I understood, so that it's not lost.
|
I've set
config.keep_source_order = true
but my output is ordered by the order the tests run in, not the order they appear in the source code. Is this expected?Edit: I have
config.order = "random"
in my RSpec configuration, that's probably important information.The text was updated successfully, but these errors were encountered: