Sha256: 08da968028f01fd5265abaea11cd3d5418a9b99b98d3b3a932e4a4adebda8a55

Contents?: true

Size: 955 Bytes

Versions: 3

Compression:

Stored size: 955 Bytes

Contents

require 'spec_helper'
require 'moblues/generator/swift/human'

describe Moblues::Generator::Swift::Human do
  let(:output_dir) { Fixtures.generated_dir(:swift) }

  let(:entity) { Moblues::DataModel::Entity.new(name: 'Author') }

  after do
    Fixtures.delete_tmp_files(%w{Author.swift}, :swift)
  end

  describe '#generate' do
    it 'generates a human file' do
      subject.generate(output_dir, entity)

      expect(Fixtures.generated_file_content('Author.swift', :swift)).to eq(Fixtures.expected_content('Author.swift', :swift))
    end

    context 'if the file already exists' do
      before do
        File.open(File.join(Fixtures.generated_dir(:swift), 'Author.swift'), 'w+') do |f|
          f.write('do nothing')
        end
      end

      it 'does not overwrite the it' do
        subject.generate(output_dir, entity)

        expect(Fixtures.generated_file_content('Author.swift', :swift)).to eq('do nothing')
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
moblues-0.4.0 spec/lib/moblues/generator/swift/human_spec.rb
moblues-0.3.0 spec/lib/moblues/generator/swift/human_spec.rb
moblues-0.2.0 spec/lib/moblues/generator/swift/human_spec.rb