Sha256: 1525bdae7422518770da2e559259f3bd80419b1994207388aba4e300c89b78b3

Contents?: true

Size: 812 Bytes

Versions: 1

Compression:

Stored size: 812 Bytes

Contents

require_relative "../base"

module Rsg
  module Testing
    class RspecGenerator < Generators::Base
      def banner
        say "Configuring rspec"
      end

      def add_rspec
        append_gem "rspec-rails", within_group: [:development, :test]
      end

      def gitignore
        append_file ".gitignore", "\n# Ignore rspec state\n/spec/examples.txt\n"
      end

      def install
        generate("rspec:install")
      end

      def enable_recommendations
        gsub_file "spec/spec_helper.rb", /^# The settings below[^=]+=begin\n(.+)\n=end/m, '\1'
      end

      def no_ci_focus
        gsub_file "spec/spec_helper.rb", /^  config\.filter_run_when_matching :focus$/ do
          "  if ENV.key?(\"CI\")\n    config.filter_run_when_matching :focus\n  end"
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rsg-0.0.1 lib/rsg/generators/testing/rspec_generator.rb