Sha256: 3512b6aed9aa23288ed9e2f5f700de01b45e46d80fd4d733c6f784d66683fec1

Contents?: true

Size: 937 Bytes

Versions: 1

Compression:

Stored size: 937 Bytes

Contents

<%
    spec_opts = ENV['SPEC_OPTS']
    if spec_opts && !spec_opts.empty?
%>
    RSpec.configure do |config|
<%
        if (match = /--(no-)?color\b/.match(spec_opts))
            color_value = !match.captures[0]
            # Have to use instance_variable_set because config.color= is designed to not allow overriding color once it's set, but
            # we do not yet have true SPEC_OPTS parsing via RSpec config to get it initially set
%>
            config.instance_variable_set(:@color, <%=color_value.to_s%>)
<%
        end
        if (requires = spec_opts.scan(/--require \S+/)).any?
            requires.map {|r| /--require (.*)/.match(r).captures[0]}.each do |req| %>

            require "<%= req %>"

<%          end
        end
        if (match = spec_opts.scan(/(?:--format (\S+)|-f ?(\S+))/).flatten.compact).any?
%>
            <%= match.inspect %>.each { |f| config.add_formatter f }
<%      end %>
     end
<% end %>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opal-rspec-0.6.2 opal/opal/rspec/spec_opts.rb.erb