<commit_before># == Schema Information
# Schema version: 20100420102749
#
# Table name: routes
#
#  id                :integer         not null, primary key
#  transport_mode_id :integer
#  number            :string(255)
#  created_at        :datetime
#  updated_at        :datetime
#

require 'spec_helper'

describe Route do
  before(:each) do
    @valid_attributes = {
      :transport_mode_id => 1,
      :number => "value for number"
    }
  end

  it "should create a new instance given valid attributes" do
    Route.create!(@valid_attributes)
  end
  
  describe 'when finding existing routes' do 
    
    fixtures :stops, :routes, :route_stops
  
    it 'should include in the results returned a route with the same number, mode of transport and stop codes' do 
      attributes = { :number => '1F50', 
                     :transport_mode_id => 5, 
                     :stop_codes => ['9100VICTRIC', '9100CLPHMJC', '9100ECROYDN', '9100GTWK', '9100HYWRDSH'] }
      Route.find_existing(attributes).include?(routes(:victoria_to_haywards_heath)).should be_true
    end
    
  end
  
end
<commit_msg>Fix route spec to avoid contraint violation<commit_after># == Schema Information
# Schema version: 20100420102749
#
# Table name: routes
#
#  id                :integer         not null, primary key
#  transport_mode_id :integer
#  number            :string(255)
#  created_at        :datetime
#  updated_at        :datetime
#

require 'spec_helper'

describe Route do
  before(:each) do
    @valid_attributes = {
      :transport_mode_id => 1,
      :number => "value for number"
    }
  end

  it "should create a new instance given valid attributes" do
    route = Route.new(@valid_attributes)
    route.valid?.should be_true
  end
  
  describe 'when finding existing routes' do 
    
    fixtures :stops, :routes, :route_stops
  
    it 'should include in the results returned a route with the same number, mode of transport and stop codes' do 
      attributes = { :number => '1F50', 
                     :transport_mode_id => 5, 
                     :stop_codes => ['9100VICTRIC', '9100CLPHMJC', '9100ECROYDN', '9100GTWK', '9100HYWRDSH'] }
      Route.find_existing(attributes).include?(routes(:victoria_to_haywards_heath)).should be_true
    end
    
  end
  
end

{'fraction_non_alphanumeric': 0.09246275197195443, 'fraction_numerical': 0.03680981595092025, 'mean_word_length': 2.664526484751204, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '5906544', 'n_tokens_mistral': 769, 'n_tokens_neox': 700, 'n_words': 201}