Sha256: f4627d710bbd2171b88a9f51406d879ef9b82eb11d65d62bf299cd7b4b82c6b7

Contents?: true

Size: 810 Bytes

Versions: 5

Compression:

Stored size: 810 Bytes

Contents

require 'spec_helper'

describe 'Ruby uses new hash synax' do
  before do
    Synvert::Configuration.instance.set :path, '.'
    allow_any_instance_of(Synvert::Rewriter::GemSpec).to receive(:match?).and_return(true)
    rewriter_path = File.join(File.dirname(__FILE__), '../../../../lib/synvert/snippets/ruby/new_hash_syntax.rb')
    @rewriter = eval(File.read(rewriter_path))
  end

  describe 'with fakefs', fakefs: true do
    let(:test_content) {"""
{:foo => 'bar', 'foo' => 'bar'}
{:key1 => 'value1', :key2 => 'value2'}
    """}
    let(:test_rewritten_content) {"""
{foo: 'bar', 'foo' => 'bar'}
{key1: 'value1', key2: 'value2'}
    """}

    it 'process' do
      File.write 'test.rb', test_content
      @rewriter.process
      expect(File.read 'test.rb').to eq test_rewritten_content
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
synvert-0.0.17 spec/synvert/snippets/ruby/new_hash_syntax_spec.rb
synvert-0.0.16 spec/synvert/snippets/ruby/new_hash_syntax_spec.rb
synvert-0.0.15 spec/synvert/snippets/ruby/new_hash_syntax_spec.rb
synvert-0.0.14 spec/synvert/snippets/ruby/new_hash_syntax_spec.rb
synvert-0.0.13 spec/synvert/snippets/ruby/new_hash_syntax_spec.rb