<commit_before>require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + "/../fixtures/config/environments/test.rb")  
require 'fakeweb'

describe LyberCore::Destroyer do
  
  before :all do
    FakeWeb.allow_net_connect = false
    fixture_metadata = open(File.expand_path(File.dirname(__FILE__) + "/../fixtures/objects.xml")) { |f| f.read }
    FakeWeb.allow_net_connect = false
    FakeWeb.register_uri(:get, %r|lyberservices|, :body => fixture_metadata)
    @dfo = LyberCore::Destroyer.new("dor","googleScannedBookWF", "register-object")
  end

  after :all do
    FakeWeb.clean_registry
    FakeWeb.allow_net_connect = true
  end

    
  context "fetching druids" do   
      
    it "accepts a repository, a workflow, and the name of the registration robot" do
      @dfo.repository.should eql("dor")
      @dfo.workflow.should eql("googleScannedBookWF")
      @dfo.registration_robot.should eql("register-object")
    end
  
    it "knows its WORKFLOW_URI" do
      WORKFLOW_URI.should eql("http://lyberservices-dev.stanford.edu/workflow")
    end

    it "can get all the druids for a workflow" do
      @dfo.druid_list.length.should eql(11)<commit_msg>This spec is passing on my laptop but failing on the server. Just trying a few things to figure out why.<commit_after>require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + "/../fixtures/config/environments/test.rb")  
require 'fakeweb'

describe LyberCore::Destroyer do
  
  before :all do
    FakeWeb.allow_net_connect = false
    fixture_metadata = open(File.expand_path(File.dirname(__FILE__) + "/../fixtures/objects.xml")) { |f| f.read }
    FakeWeb.register_uri(:get, %r|lyberservices-dev\.stanford\.edu|, :body => fixture_metadata)
    @dfo = LyberCore::Destroyer.new("dor","googleScannedBookWF", "register-object")
  end

  after :all do
    FakeWeb.clean_registry
    FakeWeb.allow_net_connect = true
  end

    
  context "fetching druids" do   
      
    it "accepts a repository, a workflow, and the name of the registration robot" do
      @dfo.repository.should eql("dor")
      @dfo.workflow.should eql("googleScannedBookWF")
      @dfo.registration_robot.should eql("register-object")
    end
  
    it "knows its WORKFLOW_URI" do
      WORKFLOW_URI.should eql("http://lyberservices-dev.stanford.edu/workflow")
    end

    it "can get all the druids for a workflow" do
      @dfo.druid_list.length.should eql(11)
{'fraction_non_alphanumeric': 0.11883942766295708, 'fraction_numerical': 0.001589825119236884, 'mean_word_length': 3.7134831460674156, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4533542', 'n_tokens_mistral': 856, 'n_tokens_neox': 827, 'n_words': 183}