File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #
2+ # Cookbook Name:: template
3+ # Recipe:: default
4+ #
5+ # Copyright 2009, Opscode
6+ #
7+ # Licensed under the Apache License, Version 2.0 (the "License");
8+ # you may not use this file except in compliance with the License.
9+ # You may obtain a copy of the License at
10+ #
11+ # http://www.apache.org/licenses/LICENSE-2.0
12+ #
13+ # Unless required by applicable law or agreed to in writing, software
14+ # distributed under the License is distributed on an "AS IS" BASIS,
15+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+ # See the License for the specific language governing permissions and
17+ # limitations under the License.
18+ #
19+
20+ node . set [ :bawt ] = "is fujins bot"
21+ node . set [ :botsnack ] = "cheers!"
22+
23+ template "#{ node [ :tmpdir ] } /node.txt" do
24+ source "node.txt.erb"
25+ end
26+
Original file line number Diff line number Diff line change 1+ bawt <%= node[:bawt] %>
2+ !botsnack
3+ <%= @node[:botsnack] %>
Original file line number Diff line number Diff line change @@ -11,3 +11,13 @@ Feature: Templates
1111 Then the run should exit '0'
1212 And a file named 'template.txt' should contain 'sauce'
1313
14+ Scenario : Render a template accessing the node directly
15+ Given a validated node
16+ And it includes the recipe 'template::render_node_attrs'
17+ When I run the chef-client
18+ Then the run should exit '0'
19+ And a file named 'node.txt' should contain 'bawt is fujins bot'
20+ And a file named 'node.txt' should contain 'cheers!'
21+
22+
23+
You can’t perform that action at this time.
0 commit comments