<commit_before>require 'helper'

class TestQuarterDriven < Test::Unit::TestCase
  context "When Included in a class" do
    setup do
      @model = QuarterDrivenModel.new
    end
    
    should "produce quarter object from year and quarter attributes" do
      assert_equal Quarter.new(2010,2),@model.quarter_obj
    end
    
    should "delegate start date to quarter object" do
      assert_equal Date.civil(2010,4,1),@model.start_date
    end
    
    should "delegate end date to quarter object" do
      assert_equal Date.civil(2010,6,3),@model.end_date
    end
    
    should "delegate quarter stamp to quarter object" do
      assert_equal "Q2, 2010",@model.quarter_stamp
    end
    
    context "creates a named scope which" do
      setup do
        @expected_map = {:conditions=>{:year=>2010,:quarter=>4}}
      end
      
      should "find by a quarter object" do
        assert_equal @expected_map,QuarterDrivenModel.scopes[:for_quarter].call(Quarter.new(2010,4))
      end
    
      should "find by year and quarter" do
        assert_equal @expected_map,QuarterDrivenModel.scopes[:for_quarter].call(2010,4)
      end
    end
  end

end

class QuarterDrivenModel<commit_msg>correct oops in test<commit_after>require 'helper'

class TestQuarterDriven < Test::Unit::TestCase
  context "When Included in a class" do
    setup do
      @model = QuarterDrivenModel.new
    end
    
    should "produce quarter object from year and quarter attributes" do
      assert_equal Quarter.new(2010,2),@model.quarter_obj
    end
    
    should "delegate start date to quarter object" do
      assert_equal Date.civil(2010,4,1),@model.start_date
    end
    
    should "delegate end date to quarter object" do
      assert_equal Date.civil(2010,6,-1),@model.end_date
    end
    
    should "delegate quarter stamp to quarter object" do
      assert_equal "Q2, 2010",@model.quarter_stamp
    end
    
    context "creates a named scope which" do
      setup do
        @expected_map = {:conditions=>{:year=>2010,:quarter=>4}}
      end
      
      should "find by a quarter object" do
        assert_equal @expected_map,QuarterDrivenModel.scopes[:for_quarter].call(Quarter.new(2010,4))
      end
    
      should "find by year and quarter" do
        assert_equal @expected_map,QuarterDrivenModel.scopes[:for_quarter].call(2010,4)
      end
    end
  end

end

class QuarterDrivenModel
{'fraction_non_alphanumeric': 0.08152173913043478, 'fraction_numerical': 0.030936454849498328, 'mean_word_length': 2.9816971713810316, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '2332858', 'n_tokens_mistral': 783, 'n_tokens_neox': 732, 'n_words': 204}