Skip to content

Commit 9a382a2

Browse files
committed
Merge pull request #2039 from alphagov/add-flow-name-to-node
Add ability to read the flow name from within a node
2 parents 12d5f6e + 3b619e7 commit 9a382a2

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lib/smart_answer/node.rb

+4
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,9 @@ def template_directory
5353
load_path = FlowRegistry.instance.load_path
5454
Pathname.new(load_path).join(String(@flow.name))
5555
end
56+
57+
def flow_name
58+
@flow.name
59+
end
5660
end
5761
end

test/unit/node_test.rb

+6
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,11 @@ class NodeTest < ActiveSupport::TestCase
1818
expected_directory = Pathname.new(@load_path).join('flow-name')
1919
assert_equal expected_directory, @node.template_directory
2020
end
21+
22+
test '#flow_name returns the name of the flow' do
23+
@flow.name 'flow-name'
24+
25+
assert_equal @node.flow_name, @flow.name
26+
end
2127
end
2228
end

0 commit comments

Comments
 (0)