From d29566188211e5511efece9319c524f7a278655c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Tue, 10 Jul 2012 01:18:34 -0700 Subject: [PATCH] specs: do not fail tests if MAC address can't be fetched. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's very well possible that depending on the capabilities of the process (and user) running the specs, the MAC address is not available. In this case, do not fail tests, simply skip over those if the mac address is unset. Solves issue #12. Signed-off-by: Diego Elio Pettenò --- spec/uuidtools/mac_address_spec.rb | 6 +----- spec/uuidtools/uuid_creation_spec.rb | 2 +- spec/uuidtools/uuid_parsing_spec.rb | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/spec/uuidtools/mac_address_spec.rb b/spec/uuidtools/mac_address_spec.rb index 987ae36..f0ee146 100644 --- a/spec/uuidtools/mac_address_spec.rb +++ b/spec/uuidtools/mac_address_spec.rb @@ -1,14 +1,10 @@ require File.expand_path("../../spec_helper.rb", __FILE__) -describe UUIDTools::UUID, "when obtaining a MAC address" do +describe UUIDTools::UUID, "when obtaining a MAC address", :unless => UUIDTools::UUID.mac_address.nil? do before do @mac_address = UUIDTools::UUID.mac_address end - it "should obtain a MAC address" do - @mac_address.should_not be_nil - end - it "should cache the MAC address" do @mac_address.object_id.should == UUIDTools::UUID.mac_address.object_id end diff --git a/spec/uuidtools/uuid_creation_spec.rb b/spec/uuidtools/uuid_creation_spec.rb index 6f6b497..45b78a2 100644 --- a/spec/uuidtools/uuid_creation_spec.rb +++ b/spec/uuidtools/uuid_creation_spec.rb @@ -13,7 +13,7 @@ describe UUIDTools::UUID, "when generating" do ).to_s.should == "15074785-9071-3fe3-89bd-876e4b9e919b" end - it "should correctly generate timestamp variant UUIDs" do + it "should correctly generate timestamp variant UUIDs", :unless => UUIDTools::UUID.mac_address.nil? do UUIDTools::UUID.timestamp_create.should_not be_random_node_id UUIDTools::UUID.timestamp_create.to_s.should_not == UUIDTools::UUID.timestamp_create.to_s diff --git a/spec/uuidtools/uuid_parsing_spec.rb b/spec/uuidtools/uuid_parsing_spec.rb index 56cfeee..fcfafeb 100644 --- a/spec/uuidtools/uuid_parsing_spec.rb +++ b/spec/uuidtools/uuid_parsing_spec.rb @@ -23,7 +23,7 @@ describe UUIDTools::UUID, "when parsing" do UUIDTools::UUID.timestamp_create.should_not be_nil_uuid end - it "should not treat a timestamp version UUID as a random node UUID" do + it "should not treat a timestamp version UUID as a random node UUID", :unless => UUIDTools::UUID.mac_address.nil? do UUIDTools::UUID.timestamp_create.should_not be_random_node_id end -- 1.7.8.6