spec/console_spec.rb in rubygems-tasks-0.2.5 vs spec/console_spec.rb in rubygems-tasks-0.2.6
- old
+ new
@@ -11,19 +11,28 @@
let(:custom_command) { 'ripl' }
let(:custom_options) { %w[-Ivendor -rfoo] }
context "defaults" do
- it "should run `irb`" do
- expect(subject).to receive(:run).with('irb',*default_options)
+ context "when project.bundler? == false" do
+ before do
+ allow(subject.project).to receive(:bundler?).and_return(false)
+ end
- subject.console
+ it "should run `irb`" do
+ expect(subject).to receive(:run).with('irb',*default_options)
+
+ subject.console
+ end
end
context "when project.bundler? == true" do
- it "should use `bundle exec`" do
+ before do
allow(subject.project).to receive(:bundler?).and_return(true)
+ end
+
+ it "should use `bundle exec`" do
expect(subject).to receive(:run).with(
'bundle', 'exec', 'irb', *default_options
)
subject.console
@@ -32,19 +41,28 @@
end
context "with custom command" do
subject { described_class.new(:command => custom_command) }
- it "should run the custom console" do
- expect(subject).to receive(:run).with(custom_command,*default_options)
+ context "when project.bundler? == false" do
+ before do
+ allow(subject.project).to receive(:bundler?).and_return(false)
+ end
- subject.console
+ it "should run the custom console" do
+ expect(subject).to receive(:run).with(custom_command,*default_options)
+
+ subject.console
+ end
end
context "when project.bundler? == true" do
- it "should use `bundle exec`" do
+ before do
allow(subject.project).to receive(:bundler?).and_return(true)
+ end
+
+ it "should use `bundle exec`" do
expect(subject).to receive(:run).with(
'bundle', 'exec', custom_command, *default_options
)
subject.console
@@ -53,18 +71,27 @@
end
context "with custom options" do
subject { described_class.new(:options => custom_options) }
- it "should pass custom options to `irb`" do
- expect(subject).to receive(:run).with('irb', *(default_options + custom_options))
+ context "when project.bundler? == false" do
+ before do
+ allow(subject.project).to receive(:bundler?).and_return(false)
+ end
- subject.console
+ it "should pass custom options to `irb`" do
+ expect(subject).to receive(:run).with('irb', *(default_options + custom_options))
+
+ subject.console
+ end
end
context "when project.bundler? == true" do
- it "should use `bundle exec ...`" do
+ before do
allow(subject.project).to receive(:bundler?).and_return(true)
+ end
+
+ it "should use `bundle exec ...`" do
expect(subject).to receive(:run).with('bundle', 'exec', 'irb', *(default_options + custom_options))
subject.console
end
end