Commit f877c228a2de385febffe8cc8f357bea5d64866d

Authored by Vasiliy Ermolovich
1 parent a18f42dd
Exists in master and in 1 other branch production

refactor notices view spec

don't use iVars in spec
spec/views/notices/_backtrace.html.haml_spec.rb
... ... @@ -2,17 +2,15 @@ require 'spec_helper'
2 2  
3 3 describe "notices/_backtrace.html.haml" do
4 4 describe 'missing file in backtrace' do
5   - before do
6   - @notice = Fabricate(:notice, :backtrace => [{
7   - 'number' => rand(999),
8   - 'file' => nil,
9   - 'method' => ActiveSupport.methods.shuffle.first
10   - }])
11   - assign :app, @notice.err.app
  5 + let(:notice) do
  6 + backtrace = { 'number' => rand(999), 'file' => nil, 'method' => ActiveSupport.methods.shuffle.first }
  7 + Fabricate(:notice, :backtrace => [backtrace])
12 8 end
13 9  
14 10 it "should replace nil file with [unknown source]" do
15   - render "notices/backtrace", :lines => @notice.backtrace
  11 + assign :app, notice.err.app
  12 +
  13 + render "notices/backtrace", :lines => notice.backtrace
16 14 rendered.should match(/\[unknown source\]/)
17 15 end
18 16 end
... ...