<commit_before>require 'spec_helper'

module Arrayish
  describe String do

    it 'is a kind of string' do
      expect( subject ).to be_kind_of( ::String )
    end

    context 'initialised with a string' do
      let(:a_string) { 'abcde' }
      subject{ described_class.new(a_string) }

      specify 'it equals the string' do
        expect( subject ).to eql(a_string) 
      end

      specify '#to_a returns the string in an array' do
        expect( subject.to_a ).to eql( [a_string] )
      end

      it_behaves_like 'an arrayish string'
    end

    context 'initialised with an array of two strings' do
      let(:a_string) { 'abcde' }
      let(:x_string) { 'xyz' }
      subject{ described_class.new([a_string, x_string]) }

      specify 'it equals the strings joined with separator' do
        expect( subject ).to eql("#{a_string},#{x_string}") 
      end

      specify '#to_a returns the strings in an array' do
        expect( subject.to_a ).to eql( [a_string,x_string] )
      end
    end

  end
end
<commit_msg>apply shared spec to 2 strings context<commit_after>require 'spec_helper'

module Arrayish
  describe String do

    it 'is a kind of string' do
      expect( subject ).to be_kind_of( ::String )
    end

    context 'initialised with a string' do
      let(:a_string) { 'abcde' }
      subject{ described_class.new(a_string) }

      specify 'it equals the string' do
        expect( subject ).to eql(a_string) 
      end

      specify '#to_a returns the string in an array' do
        expect( subject.to_a ).to eql( [a_string] )
      end

      it_behaves_like 'an arrayish string'
    end

    context 'initialised with an array of two strings' do
      let(:a_string) { 'abcde' }
      let(:x_string) { 'xyz' }
      subject{ described_class.new([a_string, x_string]) }

      specify 'it equals the strings joined with separator' do
        expect( subject ).to eql("#{a_string},#{x_string}") 
      end

      specify '#to_a returns the strings in an array' do
        expect( subject.to_a ).to eql( [a_string,x_string] )
      end

      it_behaves_like 'an arrayish string'
    end

  end
end

{'fraction_non_alphanumeric': 0.09461358313817331, 'fraction_numerical': 0.000468384074941452, 'mean_word_length': 2.56, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2992858', 'n_tokens_mistral': 698, 'n_tokens_neox': 678, 'n_words': 228}