Sha256: c6ab0faecf4dd26c3ffdb8351dca2b6aae9d5e5f529de123dbef1dea21da73e1
Contents?: true
Size: 896 Bytes
Versions: 4
Compression:
Stored size: 896 Bytes
Contents
require 'fakefs/spec_helpers' require 'spec_helper' require 'meetupinator/formatter' describe Meetupinator::Formatter do include FakeFS::SpecHelpers::All let(:template) { 'template content' } let(:template_file) { 'template.erb' } let(:events) { double('events') } let(:output) { 'output' } let(:output_file) { 'output.blah' } let(:erb) { instance_double(ERB) } describe '#format' do before do File.write(template_file, template) end it 'passes the events to the formatter and saves the result to file' do expect(ERB).to receive(:new).with(template).and_return(erb) expect(erb).to receive(:result) do |binding| expect(eval('events', binding)).to eq(events) # rubocop:disable Lint/Eval output end subject.format(events, template_file, output_file) expect(File.read(output_file)).to eq(output) end end end
Version data entries
4 entries across 4 versions & 1 rubygems