Module: SpecViews::Support::SpecViewExample

Defined in:
lib/spec_views/support.rb

Instance Method Summary collapse

Instance Method Details

#it_renders(description = nil, focus: nil, pending: nil, status: :ok, &block) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/spec_views/support.rb', line 8

def it_renders(description = nil, focus: nil, pending: nil, status: :ok, &block)
  context do
    render_views if respond_to?(:render_views)
    options = {}
    options[:focus] = focus unless focus.nil?
    options[:pending] = pending unless pending.nil?
    description = "renders #{description}" if description.is_a?(String)
    it(description, options) do
      instance_eval(&block)
      expect(response).to match_html_fixture.for_status(status)
    end
  end
end