Sha256: c8e516b04be27a8862f65f9b3e7deb0015674bdb8e68f8adccccf4566e1c48c1
Contents?: true
Size: 1.46 KB
Versions: 1
Compression:
Stored size: 1.46 KB
Contents
require_relative 'helpers/base_helpers' require_relative 'helpers/gem_helpers' module AcceptanceTests class AddShouldaToProject def self.call(options) new(options).call end include BaseHelpers include GemHelpers def initialize(options) @options = options end def call add_gem 'shoulda', gem_options unless options[:with_configuration] === false add_configuration_block_to_test_helper end end protected attr_reader :options private def test_framework options[:test_framework] end def libraries options.fetch(:libraries, []) end def gem_options gem_options = { path: fs.root_directory } if options[:manually] gem_options[:require] = false end gem_options end def add_configuration_block_to_test_helper content = <<-EOT Shoulda::Matchers.configure do |config| config.integrate do |with| #{test_framework_config} #{library_config} end end EOT if options[:manually] content = "require 'shoulda'\n#{content}" end fs.append_to_file('test/test_helper.rb', content) end def test_framework_config if test_framework "with.test_framework :#{test_framework}\n" else '' end end def library_config libraries.map { |library| "with.library :#{library}" }.join("\n") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shoulda-3.6.0 | test/support/acceptance/add_shoulda_to_project.rb |