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

Add rake task to run spec for all Ruby versions #129

Merged
merged 8 commits into from
Jun 29, 2016
Merged

Add rake task to run spec for all Ruby versions #129

merged 8 commits into from
Jun 29, 2016

Conversation

lokeshh
Copy link
Member

@lokeshh lokeshh commented May 19, 2016

For #124

Create a rake task to test the specs in all Ruby versions automatically and display the result.

Tests for all versions are ran using rake all.

@lokeshh lokeshh changed the title Rake task Add rake task to run spec for all Ruby versions May 19, 2016
task :all do |task|
RUBIES.each do |ruby_v|
puts "\n\n\nUsing #{ruby_v}\n\n\n"
puts `bash -lc "rvm use #{ruby_v}; rspec spec"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rspec provides a class for defining rake tasks. I think RVM has it's own Ruby API too. Use that. What if the user is not using bash? Or if he does not have bash?

Copy link
Member Author

@lokeshh lokeshh May 21, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the user is not using bash? Or if he does not have bash?

Point! I will have a look upon what RVM API has to offer.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checkout the new solution. It makes use of RVM generated wrappers.

@v0dro
Copy link
Member

v0dro commented May 22, 2016

OK so this is one part of the solution. But if there is a failure in Ruby 2.0.0, I will need to scroll all the way up to see that. It should ideally print the test report (number of tests passed and failures) for each ruby version at the bottom of the terminal output, so that in case there are failures, I know where to look instantly.

@v0dro
Copy link
Member

v0dro commented May 23, 2016

Btw it should also run rubocop.

@lokeshh
Copy link
Member Author

lokeshh commented Jun 1, 2016

How about just printing the number of passed/failed for each Ruby? The user can just change Ruby version and run rspec if he wants to know about the failures.

@v0dro
Copy link
Member

v0dro commented Jun 1, 2016

Yeah that works too. Make sure you use appropriate colours (red for fail, green for pass).

@lokeshh
Copy link
Member Author

lokeshh commented Jun 7, 2016

Ok. I did like I said but adding colors would need a little more work.

Should the rubocop also run in this same task or should I create another task for it?

@v0dro
Copy link
Member

v0dro commented Jun 7, 2016

You can add the :cop task as a subtask of :all.

@lokeshh
Copy link
Member Author

lokeshh commented Jun 8, 2016

:cop doesn't need to run for all rubies right?

@lokeshh
Copy link
Member Author

lokeshh commented Jun 9, 2016

Color support is added. Now :all firstly runs rubocop then it writes the summary for all rubies.

"(files took #{message.formatted_load_time} to load)\n" \
"#{message.colorized_totals_line(colorizer)}\n"
end
end
Copy link
Member Author

@lokeshh lokeshh Jun 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks to Patrick Koperwas for he made it possible just print the number of pass/failed examples with colors. Here's his answer that helped me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about rename this file to .rspec_formatter.rb so that its explicit that it's rspec and it stays hidden too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@lokeshh
Copy link
Member Author

lokeshh commented Jun 29, 2016

@v0dro I think this is ready to be merged. Just a small thing. Please specify the complete versions names to be tested. Currently I have these: https://github.com/v0dro/daru/pull/129/files#diff-52c976fc38ed2b4e3b1192f8a8e24cffR7

@v0dro v0dro merged commit cadea4f into SciRuby:master Jun 29, 2016
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 this pull request may close these issues.

2 participants