Commit 8cedcdc3039a8decdc34a66c1976a6aaee0d0ca9

Authored by Nathan Broadbent
1 parent 1480a66f
Exists in master and in 1 other branch production

Extracted test setup into a before block

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