spec/console_spec.rb in rubygems-tasks-0.2.4 vs spec/console_spec.rb in rubygems-tasks-0.2.5

- old
+ new

@@ -5,30 +5,26 @@ describe Gem::Tasks::Console do describe "#console" do include_context "rake" - if RUBY_VERSION < '1.9' - let(:default_options) { %w[-Ilib -rrubygems -rrubygems/tasks] } - else - let(:default_options) { %w[-Ilib -rrubygems/tasks] } - end + let(:default_options) { %w[-Ilib -rrubygems/tasks] } let(:custom_command) { 'ripl' } let(:custom_options) { %w[-Ivendor -rfoo] } context "defaults" do it "should run `irb`" do - subject.should_receive(:run).with('irb',*default_options) + expect(subject).to receive(:run).with('irb',*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( + allow(subject.project).to receive(:bundler?).and_return(true) + expect(subject).to receive(:run).with( 'bundle', 'exec', 'irb', *default_options ) subject.console end @@ -37,19 +33,19 @@ context "with custom command" do subject { described_class.new(:command => custom_command) } it "should run the custom console" do - subject.should_receive(:run).with(custom_command,*default_options) + expect(subject).to receive(:run).with(custom_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( + allow(subject.project).to receive(:bundler?).and_return(true) + expect(subject).to receive(:run).with( 'bundle', 'exec', custom_command, *default_options ) subject.console end @@ -58,18 +54,18 @@ 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)) + expect(subject).to 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)) + allow(subject.project).to receive(:bundler?).and_return(true) + expect(subject).to receive(:run).with('bundle', 'exec', 'irb', *(default_options + custom_options)) subject.console end end end