Sha256: 1b7cacefa38f37340b94d5a35d2b165663e6de6555a0ad5df98b63f2ae3c724a
Contents?: true
Size: 1.69 KB
Versions: 2
Compression:
Stored size: 1.69 KB
Contents
require 'spec_helper' require './lib/database/modules/json_export' require './lib/database/export' module Contentful module Exporter module Database describe JsonExport do include_context 'shared_configuration' before do @exporter = Export.new(@config) end it 'asset?' do result = @exporter.asset?('Images') expect(result).to be true end it 'save_object_to_file' do expect_any_instance_of(Contentful::Configuration).to receive(:db).exactly(1).times { {table_name: [load_fixture('json_row/row')]} } @exporter.save_object_to_file(:table_name, 'Users', 'Users', @config.entries_dir) transformed_json = load_fixture('json_responses/transformed_row') expect(transformed_json).to include('id' => 'model_name_12', 'name' => 'Test name', 'description' => 'awesome exporter', 'rate' => 100, 'database_id' => 12) end it 'model id' do result = @exporter.model_id('Images', 'image', 444) expect(result).to eq 'image_444' end it 'format_value' do result = @exporter.format_value('u---test--string!') expect(result).to eq 'u-test-string' end it 'copy_field_value' do copy_result = {} expect_any_instance_of(Export).to receive(:mapping) { {'model_name' => {copy: {'field_name' => 'save_as'}}} } expect_any_instance_of(Export).to receive(:format_value) { 'field_value_copied' } @exporter.copy_field_value('field_name', 'some_value', 'model_name', copy_result) expect(copy_result).to include('save_as' => 'field_value_copied') 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/json_export_spec.rb |
database-exporter-0.0.1 | spec/lib/database/json_export_spec.rb |