fails but will be considered as passing' end # What's the difference between both test 'example test' do skip('This test is failing lets not run it') if running_on_rails_next? raise StandardError, 'This test fails but will be skipped' end
fails but will be considered as passing' end desc 'This task is great' task :great_task do # ... end desc 'Another cool task' task :cool_task do # ... end
= Hash.new { |hash, key| hash[key] = [] } end tags.each do |tag| next if method_defined?("#{tag}?") define_method "#{tag}?" do self.class.metadata[tag].include?(name.to_sym) end define_singleton_method :method_added do |name| tags.each do |tag| metadatas[tag] << name end singleton_class.send(:remove_method, :method_added) end module MarkingModule extend ActiveSupport::Concern module ClassMethods def mark_as(*tags) end end end
def test_example end mark_as :slow def another_example end include MarkingModule # The `metadata` hash will look like this { failing_on_rails_next: ['test_example'], slow: ['another_example'] } puts MyTest.new('test_example').failing_on_rails_next? # true
:allowed FIXED = :fixed attr_writer :state def after_test(test) return unless test_will_fail?(test) @state = else ALLOWED end end def test_will_fail?(test) return false unless options[:rails_next] test.respond_to?(:failing_on_rails_next?) && test.failing_on_rails_next? end if test.failures.none? FIXED def record(result) case @state when ALLOWED result.failures.clear end end when FIXED make_ci_fail end end end
@default_lockfile = path end def default_lockfile @default_lockfile ||= Pathname.new("#{default_gemfile}.lock") end end Bundler::SharedHelpers.default_lockfile = Pathname.new("#{Bundler::SharedHelpers.default_gemfile}_next.lock") class Bundler::Dsl unless self.method_defined? :to_definition_unpatched alias_method :to_definition_unpatched, :to_definition end def to_definition(bad_lockfile, unlock) to_definition_unpatched(Bundler::SharedHelpers.default_lockfile, unlock) end end end if ENV['SHOPIFY_NEXT'] else gem 'rails', '~> 5.1.0' end gem 'rails', '~> 5.2.0'
DEPRECATION WARNING: Another deprecation test_bar - DEPRECATION WARNING: This code is deprecated class MyTest < MiniTest::Test def test_foo ActiveSupport::Deprecation.warn(‘This code is deprecated') ActiveSupport::Deprecation.warn(‘Another deprecation’) end def test_bar ActiveSupport::Deprecation.warn(‘This code is deprecated’) end end