<commit_before>require 'spec_helper'
require 'rake_context'

require 'rubygems/tasks/console'

describe Gem::Tasks::Console do
  describe "#console" do
    include_context "rake"

    let(:command) { 'ripl'             }
    let(:options) { %w[-Ivendor -rfoo] }

    context "defaults" do
      it "should run `irb`" do
        subject.should_receive(:run).with('irb','-Ilib')

        subject.console
      end

      context "when project.bundler? == true" do
        it "should use `bundle console`" do
          subject.project.stub!(:bundler?).and_return(true)
          subject.should_receive(:run).with('bundle', 'console')

          subject.console
        end
      end
    end

    context "with custom command" do
      subject { described_class.new(:command => command) }

      it "should run the custom console" do
        subject.should_receive(:run).with(command, '-Ilib')

        subject.console
      end

      context "when project.bundler? == true" do
        it "should use `bundle exec`" do
          subject.project.stub!(:bundler?).and_return(true)
          subject.should_receive(:run).with('bundle', 'exec', command, '-Ilib')

          subject.console
        end
      end
    end

    context "with custom options" do
      subject { described_class.new(:options => options) }

      it "should pass custom options to `irb`" do
        subject.should_receive(:run).with('irb', '-Ilib', *options)

        subject.console
      end

      context "when project.bundler? == true" do
        it "should use `bundle exec ...`" do
          subject.project.stub!(:bundler?).and_return(true)
          subject.should_receive(:run).with('bundle', 'exec', 'irb', '-Ilib', *options)

          subject.console
        end
      end
    end
  end
end<commit_msg>Fixed console specs.<commit_after>require 'spec_helper'
require 'rake_context'

require 'rubygems/tasks/console'

describe Gem::Tasks::Console do
  describe "#console" do
    include_context "rake"

    let(:command)         { 'ripl'                        }
    let(:default_options) { %w[-Ilib -rrubygems/tasks.rb] }
    let(:custom_options)  { %w[-Ivendor -rfoo]            }

    context "defaults" do
      it "should run `irb`" do
        subject.should_receive(:run).with('irb',*default_options)

        subject.console
      end

      context "when project.bundler? == true" do
        it "should use `bundle console`" do
          subject.project.stub!(:bundler?).and_return(true)
          subject.should_receive(:run).with('bundle', 'console')

          subject.console
        end
      end
    end

    context "with custom command" do
      subject { described_class.new(:command => command) }

      it "should run the custom console" do
        subject.should_receive(:run).with(command,*default_options)

        subject.console
      end

      context "when project.bundler? == true" do
        it "should use `bundle exec`" do
          subject.project.stub!(:bundler?).and_return(true)
          subject.should_receive(:run).with('bundle', 'exec', command, *default_options)

          subject.console
        end
      end
    end

    context "with custom options" do
      subject { described_class.new(:options => custom_options) }

      it "should pass custom options to `irb`" do
        subject.should_receive(:run).with('irb', *(default_options + custom_options))

        subject.console
      end

      context "when project.bundler? == true" do
        it "should use `bundle exec ...`" do
          subject.project.stub!(:bundler?).and_return(true)
          subject.should_receive(:run).with('bundle', 'exec', 'irb', *(default_options + custom_options))

          subject.console
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.12259615384615384, 'fraction_numerical': 0.0, 'mean_word_length': 2.4107468123861566, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '2317561', 'n_tokens_mistral': 1115, 'n_tokens_neox': 1068, 'n_words': 265}