Skip to content

Commit a6694f2

Browse files
committed
erl_call provider 100%
1 parent e99b140 commit a6694f2

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

chef/spec/unit/provider/erl_call_spec.rb

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,42 @@
5656
end
5757

5858
end
59+
60+
describe Chef::Provider::ErlCall, "action_run" do
61+
before(:each) do
62+
@node = mock("Chef::Node", :null_object => true)
63+
@new_resource = mock("Chef::Resource::ErlCall",
64+
:null_object => true,
65+
:code => "io:format(\"burritos\", []).",
66+
:cookie => nil,
67+
:distributed => false,
68+
:name_type => "name",
69+
:node_name => "chef@localhost",
70+
:name => "test"
71+
)
72+
73+
@provider = Chef::Provider::ErlCall.new(@node, @new_resource)
74+
75+
@status = mock("Status", :exitstatus => 0)
76+
@provider.stub!(:popen4).and_return(@status)
77+
@stdin = mock("STDIN", :null_object => true)
78+
@stdout = mock("STDOUT", :null_object => true)
79+
@stderr = mock("STDERR", :null_object => true)
80+
@pid = mock("PID", :null_object => true)
81+
end
82+
83+
it "should return a Chef::Provider::ErlCall object" do
84+
provider = Chef::Provider::ErlCall.new(@node, @new_resource)
85+
provider.should be_a_kind_of(Chef::Provider::ErlCall)
86+
end
87+
88+
it "should return true" do
89+
@provider.load_current_resource.should eql(true)
90+
end
91+
92+
it "should write to stdin of the erl_call command" do
93+
@provider.stub!(:popen4).and_yield(@pid, @stdin, @stdout, @stderr).and_return(@status)
94+
@provider.action_run
95+
end
96+
97+
end

0 commit comments

Comments
 (0)