<commit_before>require 'test_helper'

class WoeidControllerTest < ActionController::TestCase

  include Devise::TestHelpers

  setup do
    @ad = FactoryGirl.create(:ad)
  end

  test "should get listall - want" do 
    assert_generates '/ad/listall/ad_type/want', {controller: 'woeid', action: 'show', type: 'want' }
    get :show, {type: 'want'}
    assert_response :success
  end

  test "should get listall and give (available, delivered, booked)" do 
    get :show, type: "give", status: "available"
    assert_response :success
    get :show, type: "give", status: "booked"
    assert_response :success
    get :show, type: "give", status: "delivered"
    assert_response :success
    assert_generates '/ad/listall/ad_type/give', {controller: 'woeid', action: 'show', type: 'give' }
  end

  test "should get WOEID and give (available, delivered, booked)" do 
    get :show, type: "give", status: "available", id: @ad.woeid_code
    assert_response :success
    get :show, type: "give", status: "booked", id: @ad.woeid_code
    assert_response :success
    get :show, type: "give", status: "delivered", id: @ad.woeid_code
    assert_response :success
  end

  test "should get WOEID and want" do 
    get :show, type: "want", id: @ad.woeid_code
    assert_response :success
  end

end<commit_msg>[tests] add should get 404 on unexisting WOEID skip<commit_after>require 'test_helper'

class WoeidControllerTest < ActionController::TestCase

  include Devise::TestHelpers

  setup do
    @ad = FactoryGirl.create(:ad)
  end

  test "should get listall - want" do 
    assert_generates '/ad/listall/ad_type/want', {controller: 'woeid', action: 'show', type: 'want' }
    get :show, {type: 'want'}
    assert_response :success
  end

  test "should get listall and give (available, delivered, booked)" do 
    get :show, type: "give", status: "available"
    assert_response :success
    get :show, type: "give", status: "booked"
    assert_response :success
    get :show, type: "give", status: "delivered"
    assert_response :success
    assert_generates '/ad/listall/ad_type/give', {controller: 'woeid', action: 'show', type: 'give' }
  end

  test "should get WOEID and give (available, delivered, booked)" do 
    get :show, type: "give", status: "available", id: @ad.woeid_code
    assert_response :success
    get :show, type: "give", status: "booked", id: @ad.woeid_code
    assert_response :success
    get :show, type: "give", status: "delivered", id: @ad.woeid_code
    assert_response :success
  end

  test "should get WOEID and want" do 
    get :show, type: "want", id: @ad.woeid_code
    assert_response :success
  end

  test "should get 404 on unexisting WOEID" do 
    skip
    get :show, type: "want", id: "222222"
    assert_response :error
  end

end
{'fraction_non_alphanumeric': 0.12252252252252252, 'fraction_numerical': 0.004324324324324324, 'mean_word_length': 3.8787346221441124, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '6707844', 'n_tokens_mistral': 973, 'n_tokens_neox': 907, 'n_words': 293}