Skip to content

Instantly share code, notes, and snippets.

@searls
Forked from myronmarston/rspec_suite_example.rb
Created September 15, 2021 21:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save searls/85696cbee883c94dfdb6a7a399b08954 to your computer and use it in GitHub Desktop.
Save searls/85696cbee883c94dfdb6a7a399b08954 to your computer and use it in GitHub Desktop.
require "bundler/inline"
gemfile do
source 'https://rubygems.org'
gem "rspec", "~> 3.10"
end
require "rspec/autorun"
RSpec.configure do |config|
config.register_ordering :global do |items|
by_suite = items.group_by { |g| g.metadata.fetch(:suite) }
# run veggies before fruits
by_suite.fetch(:veggie) { [] }.shuffle + by_suite.fetch(:fruit) { [] }.shuffle
end
end
RSpec.describe "Broccoli", suite: :veggie do
it "runs" do
puts("🥦")
end
end
RSpec.describe "Pear", suite: :fruit do
it "runs" do
puts("🍐")
end
end
RSpec.describe "Pepper", suite: :veggie do
it "runs" do
puts("🌶")
end
end
RSpec.describe "Apple", suite: :fruit do
it "runs" do
puts("🍎")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment