Sha256: 2740ca4f4907f6b5ae3c1cf2ac092c0744bd41f517cb8fa88b7d124f19cfd1aa

Contents?: true

Size: 1.09 KB

Versions: 30

Compression:

Stored size: 1.09 KB

Contents

class FakeHeroku
  RECORDER = File.expand_path(File.join('..', '..', 'tmp', 'heroku_commands'), File.dirname(__FILE__))

  def initialize(args)
    @args = args
  end

  def run!
    File.open(RECORDER, 'a') do |file|
      file.puts @args.join(' ')
    end
  end

  def self.clear!
    FileUtils.rm_rf RECORDER
  end

  def self.has_gem_included?(project_path, gem_name)
    gemfile = File.open(File.join(project_path, 'Gemfile'), 'a')

    File.foreach(gemfile).any? do |line|
      line.match(/#{Regexp.quote(gem_name)}/)
    end
  end

  def self.has_created_app_for?(environment, flags = nil)
    app_name = "#{SuspendersTestHelpers::APP_NAME.dasherize}-#{environment}"

    command = if flags
                "create #{app_name} #{flags} --remote #{environment}\n"
              else
                "create #{app_name} --remote #{environment}\n"
              end

    File.foreach(RECORDER).any? { |line| line == command }
  end

  def self.has_configured_vars?(remote_name, var)
    File.foreach(RECORDER).any? do |line|
      line =~ /^config:add #{var}=.+ --remote #{remote_name}\n$/
    end
  end
end

Version data entries

30 entries across 30 versions & 3 rubygems

Version Path
philosophies-suspenders-2.2.6 spec/support/fake_heroku.rb
philosophies-suspenders-2.2.4 spec/support/fake_heroku.rb
philosophies-suspenders-2.2.3 spec/support/fake_heroku.rb
philosophies-suspenders-2.2.2 spec/support/fake_heroku.rb
philosophies-suspenders-2.2.1 spec/support/fake_heroku.rb
philosophies-suspenders-2.2.0 spec/support/fake_heroku.rb
philosophies-suspenders-2.1.2 spec/support/fake_heroku.rb
philosophies-suspenders-2.1.1 spec/support/fake_heroku.rb
philosophies-suspenders-2.1.0 spec/support/fake_heroku.rb
welaika-suspenders-2.20.0 spec/support/fake_heroku.rb
welaika-suspenders-2.19.0 spec/support/fake_heroku.rb
suspenders-1.33.0 spec/support/fake_heroku.rb
suspenders-1.32.0 spec/support/fake_heroku.rb
welaika-suspenders-2.17.0 spec/support/fake_heroku.rb
suspenders-1.31.0 spec/support/fake_heroku.rb
welaika-suspenders-2.15.0 spec/support/fake_heroku.rb
philosophies-suspenders-2.0.2 spec/support/fake_heroku.rb
suspenders-1.30.0 spec/support/fake_heroku.rb
welaika-suspenders-2.13.0 spec/support/fake_heroku.rb
welaika-suspenders-2.12.0 spec/support/fake_heroku.rb