diff options
author | Adam Edwards <adamed@opscode.com> | 2014-05-17 07:55:12 -0700 |
---|---|---|
committer | Adam Edwards <adamed@opscode.com> | 2014-05-17 07:55:12 -0700 |
commit | 9dab7d27e325afd17b337e8124e5e9269f46eaaa (patch) | |
tree | 050bc674aad1ac7f9d20a2b0abfc4173cfcc8090 /spec | |
parent | 3f1bedee506d46daff4a80e1c21db780accf1f4d (diff) | |
download | wmi-lite-9dab7d27e325afd17b337e8124e5e9269f46eaaa.tar.gz |
Stub windows only constants / methods in unit tests to work outside of Windows
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/wmi_spec.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/unit/wmi_spec.rb b/spec/unit/wmi_spec.rb index 3ab648d..6ce84fb 100644 --- a/spec/unit/wmi_spec.rb +++ b/spec/unit/wmi_spec.rb @@ -149,6 +149,10 @@ describe WmiLite::Wmi do end shared_examples_for 'an invalid query' do + before(:each) do + stub_const('WIN32OLE', Class.new) + WIN32OLE.stub(:new).with("WbemScripting.SWbemLocator").and_return(wbem_locator) + end let(:unparseable_error) { 'unparseableerror' } it 'should raise an exception' do wbem_connection.should_receive(:ExecQuery).and_raise(WIN32OLERuntimeError.new(unparseable_error)) @@ -169,6 +173,10 @@ describe WmiLite::Wmi do end shared_examples_for 'an invalid namespace' do + before(:each) do + stub_const('WIN32OLE', Class.new) + WIN32OLE.stub(:new).with("WbemScripting.SWbemLocator").and_return(wbem_locator) + end let(:unparseable_error) { 'unparseableerror' } it 'should raise an exception' do wbem_locator.should_receive(:ConnectServer).and_raise(WIN32OLERuntimeError.new('unparseableerror')) |