Sha256: 44911665cffeb81bcc65e4eefa627a0b0eaa407823e199d1047fe0621de207f5

Contents?: true

Size: 864 Bytes

Versions: 1

Compression:

Stored size: 864 Bytes

Contents

require "test_helper"

class RerunSnippetTest < PARENT_TEST_CASE
  context "A Rails application with shoulda-context added to it" do
    should "display the correct rerun snippet when a test fails" do
      if app.rails_version >= 5 && TEST_FRAMEWORK == "minitest"
        app.create

        app.write_file("test/models/failing_test.rb", <<~RUBY)
          ENV["RAILS_ENV"] = "test"
          require_relative "../../config/environment"

          class FailingTest < #{PARENT_TEST_CASE}
            should "fail" do
              assert false
            end
          end
        RUBY

        command_runner = app.run_n_unit_test_suite

        assert_includes(
          command_runner.output,
          "bin/rails test test/models/failing_test.rb:5"
        )
      end
    end
  end

  def app
    @_app ||= RailsApplicationWithShouldaContext.new
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shoulda-context-2.0.0.rc2 test/shoulda/rerun_snippet_test.rb