<commit_before>require File.expand_path('../spec_helper', __FILE__)
module Alf
  describe Restrict do
      
    let(:input) {[
      {:first => "a", :second => 20,  :third => true},
      {:first => "b", :second => 10, :third => false},
      {:first => "a", :second => 1,  :third => true},
    ]}

    let(:expected){[
      {:first => "a", :second => 1,  :third => true},
      {:first => "a", :second => 20, :third => true},
      {:first => "b", :second => 10, :third => false},
    ]}

    subject{ operator.to_a }

    describe "When factored with Lispy" do 
      let(:operator){ Lispy.sort(input, [[:first, :asc], [:second, :asc]]) }
      it{ should == expected }
    end

    describe "When factored from commandline args" do
      let(:operator){ Sort.new.set_args(["first", "asc", "second", "asc"]) }
      before{ operator.pipe(input) }
      it{ should == expected }
    end<commit_msg>Moved spec coverage a bit upper on Sort<commit_after>require File.expand_path('../spec_helper', __FILE__)
module Alf
  describe Restrict do
      
    let(:input) {[
      {:first => "a", :second => 20,  :third => true},
      {:first => "b", :second => 10, :third => false},
      {:first => "a", :second => 1,  :third => true},
    ]}

    let(:expected){[
      {:first => "a", :second => 1,  :third => true},
      {:first => "a", :second => 20, :third => true},
      {:first => "b", :second => 10, :third => false},
    ]}

    subject{ operator.to_a }

    describe "When factored with Lispy" do 
      let(:operator){ Lispy.sort(input, [[:first, :asc], [:second, :asc]]) }
      it{ should == expected }
    end

    describe "When factored from commandline args" do
      let(:operator){ Sort.run(["--", "first", "asc", "second", "asc"]) }
      before{ operator.pipe(input) }
      it{ should == expected }
    end
{'fraction_non_alphanumeric': 0.20602739726027397, 'fraction_numerical': 0.010958904109589041, 'mean_word_length': 2.757201646090535, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 39, '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': '6111038', 'n_tokens_mistral': 632, 'n_tokens_neox': 600, 'n_words': 171}