Sha256: a77592493cb6c03dac27efdb7afd1f6901a02ce973461758a6442598b329890e
Contents?: true
Size: 1.55 KB
Versions: 2
Compression:
Stored size: 1.55 KB
Contents
require 'spec_helper' require './lib/database/export' module Contentful module Exporter module Database describe Export do include_context 'shared_configuration' before do @exporter = Export.new(@config) end it 'initialize' do expect(@exporter.config).to be_kind_of Contentful::Configuration expect(@exporter.mapping).to be_a Hash expect(@exporter.tables).to be_a Array end it 'tables_name' do expect_any_instance_of(Contentful::Configuration).to receive_message_chain("db.tables") { %w(table_name table_name2) } @exporter.tables_name table_names = JSON.parse(File.read('spec/fixtures/database/table_names.json')) expect(table_names).to include('table_name', 'table_name2') end it 'create_data_relations' do expect_any_instance_of(Export).to receive(:relations_from_mapping) { ['table', 'table2'] } expect_any_instance_of(Export).to receive(:generate_relations_helper_indexes).exactly(2).times expect_any_instance_of(Export).to receive(:map_relations_to_links).exactly(2).times @exporter.create_data_relations end it 'mapping_structure' do mapping = @exporter.mapping_structure expect(mapping.count).to eq 6 end it 'load_tables' do tables = @exporter.load_tables expect(tables.count).to eq 2 expect(tables).to include(:example_model_name, :example_model_name_two) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
database-exporter-0.0.2 | spec/lib/database/export_spec.rb |
database-exporter-0.0.1 | spec/lib/database/export_spec.rb |