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

describe 'have_scope' do
  include ModelBuilder

  before(:each) do
    @model = define_model :product, :title => :string, :category => :string do
      scope :recent, :order => 'created_at DESC'
      scope :latest, lambda {|c| {:limit => c}}
      scope :since, lambda {|t| where(['created_at > ?', t])}
      scope :between, lambda { |a, b| where([ 'created_at > ? and created_at < ?', a, b ]) }

      def self.beginning(c)
        scoped(:offset => c)
      end

      def self.null
        nil
      end
    end
  end

  describe 'messages' do

    it 'should contain a description' do
      matcher = have_scope(:title)
      matcher.description.should == 'have to scope itself to {} when :title is called'

      matcher.with(1)<commit_msg>[AR/SPEC] Fixed bug that came from code in Rails/Arel checking validity of columns<commit_after>require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe 'have_scope' do
  include ModelBuilder

  before(:each) do
    @model = define_model :product, :title => :string, :category => :string, :special => :boolean do
      scope :recent, :order => 'created_at DESC'
      scope :latest, lambda {|c| {:limit => c}}
      scope :since, lambda {|t| where(['created_at > ?', t])}
      scope :between, lambda { |a, b| where([ 'created_at > ? and created_at < ?', a, b ]) }

      def self.beginning(c)
        scoped(:offset => c)
      end

      def self.null
        nil
      end
    end
  end

  describe 'messages' do

    it 'should contain a description' do
      matcher = have_scope(:title)
      matcher.description.should == 'have to scope itself to {} when :title is called'

      matcher.with(1)
{'fraction_non_alphanumeric': 0.13602731929425158, 'fraction_numerical': 0.0011383039271485487, 'mean_word_length': 2.8893805309734515, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 18, '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': '7135322', 'n_tokens_mistral': 566, 'n_tokens_neox': 541, 'n_words': 171}