<commit_before>require 'spec_helper'

describe Sortable::ActiveRecord do
  
  it 'should have a sortable class method' do
    Quote.methods.include?(:sortable).should be_true
  end
  
  it 'should have a sort class method' do
    Quote.methods.include?(:sort).should be_true
  end
  
  describe '.sortable' do
    
    context 'given no parameters' do
      before(:each) do
        Quote.sortable()
      end
    
      it 'should set sort_columns to an empty hash' do
        Quote.sort_columns.should == {}
      end
      
      it 'should set default_sort_columns to an empty hash' do
        Quote.default_sort_columns.should == {}
      end
    end
    
  end
  
  describe '.sort' do
  
  end
  
end<commit_msg>adding tests for default sortable initialization<commit_after>require 'spec_helper'

describe Sortable::ActiveRecord do
  
  it 'should have a sortable class method' do
    Quote.methods.include?(:sortable).should be_true
  end
  
  it 'should have a sort class method' do
    Quote.methods.include?(:sort).should be_true
  end
  
  describe '.sortable' do
    
    context 'given no parameters' do
      before(:each) do
        Quote.sortable()
      end
    
      it 'should set sort_columns to an empty hash' do
        Quote.sort_columns.should == {}
      end
      
      it 'should set default_sort_columns to an empty hash' do
        Quote.default_sort_columns.should == {}
      end
    end
    
    context 'given a sort column with just the required sort options' do
      before(:each) do
        Quote.sortable :price => {:column_name => :price}
      end
      
      it 'should set the sort_columns options for the specified sort name' do
        Quote.sort_columns.should have_key(:price)
      end
      
      describe 'sort_columns for the specified sort name' do
        it 'should properly set the column_name option' do
          Quote.sort_columns[:price][:column_name].should == :price
        end
        
        it 'should properly set the default option' do
          Quote.sort_columns[:price][:default].should be_nil
        end
        
        it 'should properly set the joins option' do
          Quote.sort_columns[:price][:joins].should be_nil
        end
        
        it 'should properly set the clause option' do
          Quote.sort_columns[:price][:clause].should == "quotes.price"        
        end
      end
      
      it 'should set default_sort_columns to an empty hash' do
        Quote.default_sort_columns.should == {}
      end
    end
    
  end
  
  describe '.sort' do
  
  end
  
end
{'fraction_non_alphanumeric': 0.07407407407407407, 'fraction_numerical': 0.0, 'mean_word_length': 2.191542288557214, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3278288', 'n_tokens_mistral': 754, 'n_tokens_neox': 729, 'n_words': 239}