File tree Expand file tree Collapse file tree 5 files changed +32
-2
lines changed Expand file tree Collapse file tree 5 files changed +32
-2
lines changed Original file line number Diff line number Diff line change 11Runfile linguist-language =Ruby
2+ * .gtx linguist-language =Ruby
Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ that is expected to be a part of the output.
8888Any other line, will be treated as Ruby code and will be enclosed using ERB's
8989` <%- ... -%> ` syntax.
9090
91- See the [ example template] ( examples/full.rb ) for additional nuances.
91+ See the [ example template] ( examples/full.gtx ) for additional nuances.
9292
9393## Usage
9494
File renamed without changes.
Original file line number Diff line number Diff line change 1+ > first line
2+ > second line
3+ >
4+
5+ 3.times do |i|
6+ > {{ " " * i * 2 }} this is loopy {{ i }}
7+ end
8+ >
9+
10+ if true
11+ > Welcome admin
12+ > WARNING: YOU HAVE ADMIN RIGHTS
13+ end
14+
15+ = "hello " * 3
16+
17+ # Fail here
18+ = 100 / 0
19+ = "hello " * 3
Original file line number Diff line number Diff line change 44 subject { described_class . new template }
55 let ( :context ) { double user : 'admin' }
66 let ( :template ) { "> some output\n ruby_code = 'yes'\n = ruby_code" }
7- let ( :example_path ) { "examples/full.rb " }
7+ let ( :example_path ) { "examples/full.gtx " }
88
99 describe 'full example' do
1010 subject { described_class . load_file example_path }
3434 expect ( subject . parse context ) . to match_approval ( 'gtx/parse' )
3535 end
3636
37+ context "on error" do
38+ subject { described_class . load_file "spec/fixtures/error.gtx" }
39+
40+ it "registers the correct file and line number in the backtrace" do
41+ expect { subject . parse } . to raise_error ( ZeroDivisionError ) do |e |
42+ expect ( e . backtrace . first ) . to include "spec/fixtures/error.gtx:18"
43+ end
44+ end
45+ end
46+
3747 context "when a Binding object is passed instead of a regular object" do
3848 let ( :context ) do
3949 module Context
You can’t perform that action at this time.
0 commit comments