Sha256: de79f4c2e244190e1f67321517931ac5758b5fc4e83981e9dbf9e86b58649a22

Contents?: true

Size: 940 Bytes

Versions: 16

Compression:

Stored size: 940 Bytes

Contents

require_relative './postgres_helper'

def test_app_path
  File.expand_path(File.join(File.dirname(__FILE__), '../spec/dummy'))
end

def reload_application_gemfile
  ENV['BUNDLE_GEMFILE'] = File.expand_path('../../Gemfile', __FILE__)
end

def application_file_path(file)
  File.join test_app_path, file
end

def application_file(file)
  File.read(application_file_path file)
end

def drop_qbrick_scaffold_for(name)
  app_path = test_app_path
  unless File.exist? app_path
    puts "won't destroy scaffold for #{name.inspect} while app #{app_path} doesn't exist."
    return
  end

  Dir.chdir(app_path) do
    database_name = app_path.split('/').last
    rails "destroy scaffold #{name}"
    rails "destroy scaffold #{name.pluralize}"
    rails "destroy scaffold cms/#{name.pluralize}"
    database = "#{database_name}_test"
    next unless Postgres.database_exists? database

    Postgres.drop_table database_name, database, name
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
qbrick-2.7.1 spec/features_helper.rb
qbrick-2.7 spec/features_helper.rb
qbrick-2.6.10 spec/features_helper.rb
qbrick-2.6.9 spec/features_helper.rb
qbrick-2.6.8 spec/features_helper.rb
qbrick-2.6.7 spec/features_helper.rb
qbrick-2.6.6 spec/features_helper.rb
qbrick-2.6.5 spec/features_helper.rb
qbrick-2.6.4 spec/features_helper.rb
qbrick-2.6.3 spec/features_helper.rb
qbrick-2.6.2 spec/features_helper.rb
qbrick-2.6.1 spec/features_helper.rb
qbrick-2.6.0 spec/features_helper.rb
qbrick-2.5.2 spec/features_helper.rb
qbrick-2.5.1 spec/features_helper.rb
qbrick-2.5.0 spec/features_helper.rb