Guest User

Untitled

a guest
Mar 31st, 2014
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. require 'spec_helper'
  2.  
  3. describe KIR::Validation::AttachedDevicePrimaryIPCheck do
  4.  
  5. before(:each) do
  6. @primary_ip = stub("PrimaryIpStub", :is_primary? => true)
  7. @ip = stub("IpStub", :is_primary? => false)
  8. @device1 = stub("DeviceStub1", :number => 9, :ip_addresses => [@primary_ip])
  9. @device2 = stub("DeviceStub2", :number => 20, :ip_addresses => [@ip])
  10. @environment = stub("NetworkEnvironmentStub", :number => "ENV1234", :network_devices => [@device1, @device2])
  11. end
  12.  
  13. context "running" do
  14. context "when devices are missing their primary ip" do
  15. it "reports the the device_ids that are missing ips" do
  16. validation = KIR::Validation::AttachedDevicePrimaryIPCheck.new(@environment)
  17.  
  18. validation.stubs(:attached_device_with_no_primary).returns([@device2])
  19.  
  20. validation.run.should == ["the following attached devices are missing primary ip #{ ([@device2]).map(&:number).join(",")}"]
  21. end
  22. end
  23.  
  24. context "when devices are not missing primary ip" do
  25. it "returns an empty set" do
  26. validation = KIR::Validation::AttachedDevicePrimaryIPCheck.new(@environment)
  27.  
  28. validation.stubs(:attached_device_with_no_primary).returns([@device1])
  29. validation.run.should == nil
  30. end
  31. end
  32. end
  33. end
  34.  
  35. getting this error :
  36. 'KIR::Validation::AttachedDevicePrimaryIPCheck running when devices are missing their primary ip reports the the device_ids that are missing ips' FAILED
  37. expected: ["the following attached devices are missing primary ip 20"],
  38. got: nil (using ==)
  39. ./spec/models/kir/validation/attached_device_primary_ip_check_spec.rb:20:
  40. /Users/mary5030/.rvm/gems/ruby-1.8.7-p174/bin/ruby_noexec_wrapper:14:
  41.  
  42. one test failed
Advertisement
Add Comment
Please, Sign In to add comment