1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
From: Hleb Valoshka <375gnu@gmail.com>
Date: Fri, 31 Jul 2015 12:25:01 +0300
Subject: Convert specs to RSpec 3.3.2 syntax with Transpec
This conversion is done by Transpec 3.1.1 with the following command:
transpec
* 3 conversions
from: obj.stub(:message)
to: allow(obj).to receive(:message)
* 1 conversion
from: expect(collection).to have(n).items
to: expect(collection.size).to eq(n)
For more details: https://github.com/yujinakayama/transpec#supported-conversions
---
spec/buff/config/ruby_spec.rb | 6 +++---
spec/buff/config_spec.rb | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/spec/buff/config/ruby_spec.rb b/spec/buff/config/ruby_spec.rb
index de9a535..fc9d44e 100644
--- a/spec/buff/config/ruby_spec.rb
+++ b/spec/buff/config/ruby_spec.rb
@@ -51,7 +51,7 @@ describe Buff::Config::Ruby do
describe '::from_file' do
let(:filepath) { tmp_path.join('test_config.rb').to_s }
- before { File.stub(:read).with(filepath).and_return(ruby) }
+ before { allow(File).to receive(:read).with(filepath).and_return(ruby) }
it 'returns an instance of the inheriting class' do
expect(subject.from_file(filepath)).to be_a(subject)
@@ -62,7 +62,7 @@ describe Buff::Config::Ruby do
end
context 'given a filepath that does not exist' do
- before { File.stub(:read).and_raise(Errno::ENOENT) }
+ before { allow(File).to receive(:read).and_raise(Errno::ENOENT) }
it 'raises a Buff::Errors::ConfigNotFound error' do
expect {
@@ -118,7 +118,7 @@ describe Buff::Config::Ruby do
describe '#reload' do
before do
subject.path = 'foo/bar.rb'
- File.stub(:read).and_return(ruby)
+ allow(File).to receive(:read).and_return(ruby)
end
it 'returns self' do
diff --git a/spec/buff/config_spec.rb b/spec/buff/config_spec.rb
index 5536dee..45778b8 100644
--- a/spec/buff/config_spec.rb
+++ b/spec/buff/config_spec.rb
@@ -28,7 +28,7 @@ describe Buff::Config::Base do
end
it "contains just the sliced elements" do
- expect(@sliced).to have(1).item
+ expect(@sliced.size).to eq(1)
end
end
end
|