Sha256: 84b3e758fb111eec90e75dee4f97ae36435b008fc6386d9eb9f9aa20a680462f

Contents?: true

Size: 1007 Bytes

Versions: 8

Compression:

Stored size: 1007 Bytes

Contents

require 'spec_helper'

describe 'Data commands' do
  delegate :run_cmd, to: :TestCodebase
  def en_data
    {'en' => {'a' => '1', 'common' => {'hello' => 'Hello'}}}
  end

  def en_data_2
    {'en' => {'common' => {'hi' => 'Hi'}}}
  end


  before do
    TestCodebase.setup('config/locales/en.yml' => en_data.to_yaml)
  end

  after do
    TestCodebase.teardown
  end

  it '#data' do
    expect(JSON.parse(run_cmd :data, format: 'json')).to eq(en_data)
  end

  it '#data-merge' do
    expect(JSON.parse(run_cmd :data_merge, format: 'json', arguments: [en_data_2.to_json], nostdin: true)).to eq(en_data.deep_merge en_data_2)
  end

  it '#data-write' do
    expect(JSON.parse(run_cmd :data_write, format: 'json', arguments: [en_data_2.to_json])).to eq(en_data_2)
  end

  it '#data-remove' do
    to_remove = {'en' => {'common' => {'hello' => ''}}}
    expect(JSON.parse(run_cmd :data_remove, format: 'json', arguments: [to_remove.to_json])).to eq('en' => {'common' => en_data['en']['common'] })
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
i18n-tasks-0.7.7 spec/commands/data_commands_spec.rb
i18n-tasks-0.7.6 spec/commands/data_commands_spec.rb
i18n-tasks-0.7.5 spec/commands/data_commands_spec.rb
i18n-tasks-0.7.4 spec/commands/data_commands_spec.rb
i18n-tasks-0.7.3 spec/commands/data_commands_spec.rb
i18n-tasks-0.7.2 spec/commands/data_commands_spec.rb
i18n-tasks-0.7.1 spec/commands/data_commands_spec.rb
i18n-tasks-0.7.0 spec/commands/data_commands_spec.rb