<commit_before>require 'spec_helper'

describe OutletsController do
  render_views

  before(:each) do
    @good_token = AuthToken.create!(
      :email => "<EMAIL>", 
      :phone => "555-1212",
    )
    @agency = Agency.create!(:name => "Department of Examples", :shortname => "example")
  end
  
  describe "GET 'add'" do
    it "should be successful" do
      get :add, :auth_token => @good_token.token
      response.should be_success
    end
        
    describe "with a service_url" do
      it "should display the full form" do
        service_url = 'http://twitter.com/somethingorother'
        get :add, :service_url => service_url, :auth_token => @good_token.token
        response.should have_selector("label", :content => "Sponsoring Agency:")
      end
    end
  end

  describe "POST 'update'" do
    
    describe "authorization checking" do

      before(:each) do
        @attr = {
          :auth_token => @good_token.token,
          :service_url => "http://twitter.com/example",
          :organization => "Example Project",
          :info_url => "http://example.gov",
          :language => "English"
        }
      end
      
      it "should reject a missing auth token" do
        post :update, @attr.merge(:auth_token => "")
        response.should redirect_to(howto_request_token_path)
      end<commit_msg>Fixed an out-of-date unit test.<commit_after>require 'spec_helper'

describe OutletsController do
  render_views

  before(:each) do
    @good_token = AuthToken.create!(
      :email => "<EMAIL>", 
      :phone => "555-1212",
    )
    @agency = Agency.create!(:name => "Department of Examples", :shortname => "example")
  end
  
  describe "GET 'add'" do
    it "should be successful" do
      get :add, :auth_token => @good_token.token
      response.should be_success
    end
        
    describe "with a service_url" do
      it "should display the full form" do
        service_url = 'http://twitter.com/somethingorother'
        get :add, :service_url => service_url, :auth_token => @good_token.token
        response.should have_selector("label", :content => "Sponsoring Top-Level Agency:")
      end
    end
  end

  describe "POST 'update'" do
    
    describe "authorization checking" do

      before(:each) do
        @attr = {
          :auth_token => @good_token.token,
          :service_url => "http://twitter.com/example",
          :organization => "Example Project",
          :info_url => "http://example.gov",
          :language => "English"
        }
      end
      
      it "should reject a missing auth token" do
        post :update, @attr.merge(:auth_token => "")
        response.should redirect_to(howto_request_token_path)
      end
{'fraction_non_alphanumeric': 0.12130177514792899, 'fraction_numerical': 0.005177514792899409, 'mean_word_length': 2.4768637532133675, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 33, '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': '2391199', 'n_tokens_mistral': 818, 'n_tokens_neox': 791, 'n_words': 210}