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

Convert Rails tests to RSpec #846

Merged
merged 25 commits into from
Dec 10, 2019
Merged

Convert Rails tests to RSpec #846

merged 25 commits into from
Dec 10, 2019

Conversation

marcotc
Copy link
Member

@marcotc marcotc commented Oct 25, 2019

This PR converts most Rails tests from minitest to RSpec.

Also, added a few enhancements to tracer_helpers.rb to allow for easier assertions around tracer and span instances.

Given this PR is already sizeable, I chose to defer the last couple large minitest files, to allow for easier reviewing.

@marcotc marcotc added the dev/testing Involves testing processes (e.g. RSpec) label Oct 25, 2019
@marcotc marcotc requested a review from a team October 25, 2019 22:13
@marcotc marcotc self-assigned this Oct 25, 2019
@@ -312,7 +312,6 @@ elsif Gem::Version.new('2.2.0') <= Gem::Version.new(RUBY_VERSION) \
appraise 'rails5-postgres-redis-activesupport' do
gem 'rails', '~> 5.2.1'
gem 'pg', '< 1.0', platform: :ruby
gem 'redis-rails'
Copy link
Member Author

@marcotc marcotc Oct 25, 2019

Choose a reason for hiding this comment

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

redis-rails functionality is now supported out of the box by Rails, since v5.2, effectively deprecating this gem since then: https://github.com/redis-store/redis-rails#a-quick-note-about-rails-52

@@ -12,7 +12,7 @@ desc 'Run RSpec'
# rubocop:disable Metrics/BlockLength
namespace :spec do
task all: [:main,
:rails, :railsredis, :railssidekiq, :railsactivejob,
:rails, :railsredis, :railsactivejob,
Copy link
Member Author

Choose a reason for hiding this comment

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

:railssidekiq had one file with no tests.

All relevant Rails+Sidekiq related tests have been merged with the :railsactivejob task.

@delner delner added this to In progress in Active work Nov 21, 2019
@delner delner moved this from In progress to In review in Active work Nov 21, 2019
end
end

xcontext '#write' do
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's convert any xcontext to context.


# Re-configure the tracer with a new test writer
# since priority sampling will wipe out the old test writer.
unless @writer.is_a?(FauxWriter)
Copy link
Contributor

Choose a reason for hiding this comment

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

This part of the code is super hairy; we'd like to get rid of it, probably with #879.

@marcotc marcotc merged commit f64a90c into master Dec 10, 2019
Active work automation moved this from In review to Merged & awaiting release Dec 10, 2019
@marcotc marcotc deleted the test/rails-rspec branch December 10, 2019 21:07
delner pushed a commit that referenced this pull request Dec 30, 2019
@delner delner mentioned this pull request Dec 30, 2019
@marcotc marcotc added this to the 0.31.0 milestone Jan 7, 2020
@marcotc marcotc changed the title Covert Rails tests to RSpec Convert Rails tests to RSpec Jan 7, 2020
@delner delner moved this from Merged & awaiting release to Released in Active work Mar 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev/testing Involves testing processes (e.g. RSpec)
Projects
Active work
  
Released
Development

Successfully merging this pull request may close these issues.

None yet

2 participants