Module: SpecViews::Support::SpecViewExample

Defined in:
lib/spec_views/support.rb

Instance Method Summary collapse

Instance Method Details

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



144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/spec_views/support.rb', line 144

def render(description = nil, focus: nil, pending: nil, status: :ok, &block)
  context do # rubocop:disable RSpec/MissingExampleGroupArgument
    render_views
    options = {}
    options[:focus] = focus unless focus.nil?
    options[:pending] = pending unless pending.nil?
    it(description, options) do
      instance_eval(&block)
      spec_view.write_last_run
      write = status.in?(
        [
          response.message.parameterize.underscore.to_sym,
          response.status,
        ],
      )
      spec_view.write_challenger if write
      spec_view.expect_eq
    end
  end
end