Sha256: 59114b89a1a56299783f9765a54c1eff501bd390fe64d9b31ed690e4f9f79430
Contents?: true
Size: 1.57 KB
Versions: 3
Compression:
Stored size: 1.57 KB
Contents
require 'spec_helper' require 'moblues/generator/objc/human' require 'moblues/data_model' describe Moblues::Generator::Objc::Human do let(:entity) { Moblues::DataModel::Entity.new(name: 'Author') } let(:output_dir) { Fixtures.generated_dir(:objc) } after do Fixtures.delete_tmp_files(%w{Author.h Author.m}, :objc) end describe '#generate' do it 'generates a human header' do subject.generate(output_dir, entity) expect(Fixtures.generated_file_content('Author.h', :objc)).to eq(Fixtures.expected_content('Author.h', :objc)) end it 'generates a human implementation' do subject.generate(output_dir, entity) expect(Fixtures.generated_file_content('Author.m', :objc)).to eq(Fixtures.expected_content('Author.m', :objc)) end context 'if the header already exists' do before do File.open(File.join(Fixtures.generated_dir(:objc), 'Author.h'), 'w+') do |f| f.write('do nothing') end end it 'does not overwrite the header file' do subject.generate(output_dir, entity) expect(Fixtures.generated_file_content('Author.h', :objc)).to eq('do nothing') end end context 'if the implementation already exists' do before do File.open(File.join(Fixtures.generated_dir(:objc), 'Author.m'), 'w+') do |f| f.write('do nothing') end end it 'does not overwrite the implementation file' do subject.generate(output_dir, entity) expect(Fixtures.generated_file_content('Author.m', :objc)).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/objc/human_spec.rb |
moblues-0.3.0 | spec/lib/moblues/generator/objc/human_spec.rb |
moblues-0.2.0 | spec/lib/moblues/generator/objc/human_spec.rb |