Sha256: f3bc5e66fb8a6207ac657725e7f39f2f91148850d867f87845cb650317c62e19
Contents?: true
Size: 1.28 KB
Versions: 3
Compression:
Stored size: 1.28 KB
Contents
require 'tempfile' module Helpers def new_project_from(fixture_name) rm_rf rails_project_path cp_r fixture_path(fixture_name), rails_project_path cd rails_project_path end def append_to(path, content) rails_project_path.join(path).open('a') { |f| f.write content } end def create_file(path, content) file = rails_project_path.join(path) mkdir_p file.dirname file.open('w') { |f| f.write content } end attr_accessor :output def run(command) self.output = Bundler.with_clean_env { `#{command} 2>&1` } log "$ #{command}" log self.output raise "`#{command}` failed with:\n#{output}" unless $?.success? end def path(path) rails_project_path.join(path) end def content_of(path) File.read path(path) end def cd(*args) silence_warnings { Dir.chdir(*args) } end def rm_rf(*args) FileUtils.rm_rf *args end def cp_r(*args) FileUtils.cp_r *args end def mkdir_p(*args) FileUtils.mkdir_p *args end def root_path Bundler.root end def rails_project_path Pathname.new(Dir.tmpdir).join('rails_project') end def fixture_path(name = '.') root_path.join('spec', 'fixtures', name.to_s) end def log(text) puts text if ENV['TRACE'] end end RSpec.configuration.include Helpers
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
steak-2.0.0 | spec/support/helpers.rb |
steak-2.0.0.beta2 | spec/support/helpers.rb |
steak-2.0.0.beta1 | spec/support/helpers.rb |