Sha256: 3442c0ea5e4c42ae34aef12f645e5a7ad4f86c21e0cd4ca71ad91976c1ed0fc0
Contents?: true
Size: 845 Bytes
Versions: 8
Compression:
Stored size: 845 Bytes
Contents
require 'spec_helper' describe CMSScanner::Formatter::Json do it_behaves_like CMSScanner::Formatter::Buffer subject(:formatter) { described_class.new } let(:output_file) { File.join(FIXTURES, 'output.txt') } before { formatter.views_directories << FIXTURES_VIEWS } describe '#format' do its(:format) { should eq 'json' } end describe '#output' do it 'puts the rendered text in the buffer' do 2.times { formatter.output('@render_me', test: 'Working') } expect(formatter.buffer).to eq "\"test\": \"Working\",\n" * 2 end end describe '#beautify' do it 'writes the buffer in the file' do 2.times { formatter.output('@render_me', test: 'yolo') } expect($stdout).to receive(:puts).with(JSON.pretty_generate(JSON.parse('{"test": "yolo"}'))) formatter.beautify end end end
Version data entries
8 entries across 8 versions & 1 rubygems