Sha256: 0d3ef278b362093ac5b1b22cb7d21033bb118b5c6e7d8671b11058e7176a81ad
Contents?: true
Size: 1.54 KB
Versions: 3
Compression:
Stored size: 1.54 KB
Contents
require 'rails_helper' require 'generators/csv_import_magic/install_generator' RSpec.describe CsvImportMagic::Generators::InstallGenerator, type: :generator do destination File.expand_path('../../../../../../tmp', __FILE__) before do travel_to Time.zone.parse('20170101235959') allow(Rails).to receive(:version).and_return('5.1') Rails::VERSION::MAJOR = 5 Rails::VERSION::MINOR = 1 prepare_destination FileUtils.mkdir_p('tmp/config') out_file = File.new(File.join(ENGINE_RAILS_ROOT, 'tmp/config/routes.rb'), 'w+') out_file.puts("Rails.application.routes.draw do\nend") out_file.close run_generator end after do travel_back prepare_destination end specify 'check migrations' do migration_content = <<-EOF class CreateImporters < ActiveRecord::Migration[5.1] def change create_table :importers do |t| t.attachment :attachment t.attachment :attachment_error t.string :source t.string :parser t.string :columns t.string :message t.string :status, default: 'pending' t.string :additional_data t.references :importable, polymorphic: true t.timestamps null: false end add_index :importers, [:importable_id, :importable_type] end end EOF expect(destination_root).to have_structure { directory 'db' do directory 'migrate' do file '20170101235959_create_importers.rb' migration 'create_importers' do contains migration_content end end end } end end
Version data entries
3 entries across 3 versions & 1 rubygems