Sha256: 30505474780b98562d3625dfbb242d38aed58fc18843c3af35a850229085ec7e
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
require 'dry/view/null_part' RSpec.describe Dry::View::NullPart do subject(:part) do Dry::View::NullPart.new(renderer, data) end let(:name) { :user } let(:data) { { user: nil } } let(:renderer) { double(:renderer) } describe '#[]' do it 'returns nil for any data value names' do expect(part[:email]).to eql(nil) end end describe '#method_missing' do it 'renders a template with the _missing suffix' do expect(renderer).to receive(:lookup).with('_row_missing').and_return('_row_missing.slim') expect(renderer).to receive(:render).with('_row_missing.slim', part) part.row end it 'renders a _missing template within another when block is passed' do block = proc { part.fields } expect(renderer).to receive(:lookup).with('_form_missing').and_return('form_missing.slim') expect(renderer).to receive(:lookup).with('_fields_missing').and_return('fields_missing.slim') expect(renderer).to receive(:render).with('form_missing.slim', part, &block) expect(renderer).to receive(:render).with('fields_missing.slim', part) part.form(block) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dry-view-0.1.1 | spec/unit/null_part_spec.rb |
dry-view-0.1.0 | spec/unit/null_part_spec.rb |