require 'rodakase/view' RSpec.describe 'Rodakase View' do let(:view_class) do klass = Class.new(Rodakase::View::Layout) klass.configure do |config| config.renderer = renderer config.engine = :slim config.name = 'app' config.template = 'users' end klass end let(:renderer) do Rodakase::View::Renderer.new(SPEC_ROOT.join('fixtures/templates'), engine: :slim) end let(:scope) do Struct.new(:title).new('Rodakase Rocks!') end it 'renders within a layout using provided scope' do view = view_class.new users = [ { name: 'Jane', email: 'jane@doe.org' }, { name: 'Joe', email: 'joe@doe.org' } ] expect(view.(scope: scope, locals: { users: users })).to eql( '
Jane | jane@doe.org |
Joe | joe@doe.org |