<commit_before>require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "RegonlineConnector" do
  
  describe "without credentials" do
    it "shouldn't instantiate" do
      lambda { roc = RegonlineConnector.new }.should raise_exception(ArgumentError)
    end
  end
  
  describe "with any credentials" do
    before(:each) do
      @roc = RegonlineConnector.new(100, 'joeuser', 'password')
    end
    
    it "should not give read access to account_id" do
      lambda { @roc.account_id }.should raise_exception(NoMethodError)
    end
    
    it "should not give read access to username" do
      lambda { @roc.username }.should raise_exception(NoMethodError)
    end
    
    it "should not give read access to password" do
      lambda { @roc.password }.should raise_exception(NoMethodError)
    end
    
    it "should not give write access to account_id" do
      lambda { @roc.account_id=200 }.should raise_exception(NoMethodError)
    end
    
    it "should not give write access to username" do
      lambda { @roc.username='joeuser' }.should raise_exception(NoMethodError)
    end
    
    it "should not give write access to password" do
      lambda { @roc.password='password' }.should raise_exception(NoMethodError)
    end
  end
    
  describe "with valid credentials" do
    before(:each) do
      mock_client = mock('roc_client')
      mock_client.should_receive(:authenticate).and_return(true)
      RegonlineConnector::Client.should_receive(:new).with(100, 'joeuser', 'password').and_return(mock_client)
      @roc = RegonlineConnector.new(100, 'joeuser', 'password')
    end
    
    it "should successfully authenticate" do
      @roc.authenticate.should == true
    end
  end
    
  describe "with invalid credentials" do
    it "should not successfully authenticate" do
      mock_client = mock('roc_client')
      mock_client.should_receive(:authenticate).and_return(false)
      RegonlineConnector::Client.should_receive(:new).with(100, 'joeuser', '<PASSWORD>password').and_return(mock_client)
      roc = RegonlineConnector.new(100, 'joeuser', '<PASSWORD>')<commit_msg>Added a stub for a \"with invalid event id\" context.<commit_after>require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "RegonlineConnector" do
  
  describe "without credentials" do
    it "shouldn't instantiate" do
      lambda { roc = RegonlineConnector.new }.should raise_exception(ArgumentError)
    end
  end
  
  describe "with any credentials" do
    before(:each) do
      @roc = RegonlineConnector.new(100, 'joeuser', 'password')
    end
    
    it "should not give read access to account_id" do
      lambda { @roc.account_id }.should raise_exception(NoMethodError)
    end
    
    it "should not give read access to username" do
      lambda { @roc.username }.should raise_exception(NoMethodError)
    end
    
    it "should not give read access to password" do
      lambda { @roc.password }.should raise_exception(NoMethodError)
    end
    
    it "should not give write access to account_id" do
      lambda { @roc.account_id=200 }.should raise_exception(NoMethodError)
    end
    
    it "should not give write access to username" do
      lambda { @roc.username='joeuser' }.should raise_exception(NoMethodError)
    end
    
    it "should not give write access to password" do
      lambda { @roc.password='password' }.should raise_exception(NoMethodError)
    end
  end
    
  describe "with valid credentials" do
    before(:each) do
      mock_client = mock('roc_client')
      mock_client.should_receive(:authenticate).and_return(true)
      RegonlineConnector::Client.should_receive(:new).with(100, 'joeuser', 'password').and_return(mock_client)
      @roc = RegonlineConnector.new(100, 'joeuser', 'password')
    end
    
    it "should successfully authenticate" do
      @roc.authenticate.should == true
    end
    
    describe "with invalid event id" do
      
    end
  end
    
  describe "with invalid credentials" do
    it "should not successfully authenticate" do
      mock_client = mock('roc_client')
      mock_client.should_receive(:authenticate).and_return(false)
      RegonlineConnector::Client.should_receive(:new).with(100, 'joeuser', '<PASSWORD>').and_return(mock_client)
      roc = RegonlineConnector.new(100, 'joeuser', '<PASSWORD>')
{'fraction_non_alphanumeric': 0.09639389736477115, 'fraction_numerical': 0.008321775312066574, 'mean_word_length': 3.4700413223140494, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '2113027', 'n_tokens_mistral': 1314, 'n_tokens_neox': 1277, 'n_words': 347}