diff --git a/spec/controllers/lyrics_controller_spec.rb b/spec/controllers/lyrics_controller_spec.rb index e5d3661..abd52c7 100644 --- a/spec/controllers/lyrics_controller_spec.rb +++ b/spec/controllers/lyrics_controller_spec.rb @@ -5,7 +5,7 @@ describe '#by_artist' do before do - Artist.stub(:new) { mock_model(Artist, get_data: true, save: true, load_data: true, lyrem: true) } + allow(Artist).to receive(:new) { mock_model(Artist, get_data: true, save: true, load_data: true, lyrem: true) } end describe 'missing artist' do diff --git a/spec/features/lyrics_request_spec.rb b/spec/features/lyrics_request_spec.rb index a0c44e4..f8ad9ee 100644 --- a/spec/features/lyrics_request_spec.rb +++ b/spec/features/lyrics_request_spec.rb @@ -9,7 +9,7 @@ end it 'has a rel=canonical link' do - page.source.should match '' + expect(page.source).to match '' end describe 'analytics' do diff --git a/spec/features/static_request_spec.rb b/spec/features/static_request_spec.rb index 234add0..aec8d94 100644 --- a/spec/features/static_request_spec.rb +++ b/spec/features/static_request_spec.rb @@ -17,9 +17,9 @@ before do fake_artist = FactoryGirl.build_stubbed :artist - fake_artist.stub(:name).and_return 'The Phish' - fake_artist.stub(:random_lyric).and_return "that's 119 to you and me" - Artist.stub(:find_or_create).and_return fake_artist + allow(fake_artist).to receive(:name).and_return 'The Phish' + allow(fake_artist).to receive(:random_lyric).and_return "that's 119 to you and me" + allow(Artist).to receive(:find_or_create).and_return fake_artist end it 'sends you to a new page' do diff --git a/spec/models/artist_spec.rb b/spec/models/artist_spec.rb index b148da9..5e338cf 100644 --- a/spec/models/artist_spec.rb +++ b/spec/models/artist_spec.rb @@ -36,7 +36,7 @@ let(:phrases) { LYRICS } before do - subject.stub(:fetch_new_song_lyrics).and_return(phrases) + allow(subject).to receive(:fetch_new_song_lyrics).and_return(phrases) end describe ':phrases' do @@ -69,7 +69,7 @@ expect(sentence.class).to eq String expect(sentence.split(' ').length).to be >= 2 %w(,, ., !, ?, ,. !. ?.).each do |punct_combo| - sentence.should_not include punct_combo + expect(sentence).not_to include punct_combo end end end @@ -180,7 +180,7 @@ describe 'when not already set' do before do - subject.stub(:albums).and_return [ + allow(subject).to receive(:albums).and_return [ { 'songs' => ['foo', 'bar'] }, { 'songs' => ['baz', 'Qux:Quux'] } ] diff --git a/spec/models/concerns/custom_array_spec.rb b/spec/models/concerns/custom_array_spec.rb index 9745c33..02547b2 100644 --- a/spec/models/concerns/custom_array_spec.rb +++ b/spec/models/concerns/custom_array_spec.rb @@ -11,21 +11,21 @@ class TestCustomArray < Array let(:test_array) { TestCustomArray.new(%w(foo bar baz qux)) } it 'returns a string' do - test_array.join_after_regex(glue: ', ', regex: /a/).should be_a String + expect(test_array.join_after_regex(glue: ', ', regex: /a/)).to be_a String end describe 'matching regex' do subject { test_array.join_after_regex(glue: ', ', regex: /o/) } it 'inserts glue' do - subject.index('o,').should_not be nil + expect(subject.index('o,')).not_to be nil end end describe 'not matching regex' do subject { test_array.join_after_regex(glue: ', ', regex: /o/) } it 'does not insert glue' do - subject.index('r,').should be nil - subject.index('z,').should be nil + expect(subject.index('r,')).to be nil + expect(subject.index('z,')).to be nil end end diff --git a/spec/models/concerns/custom_string_spec.rb b/spec/models/concerns/custom_string_spec.rb index fa98833..62368fc 100644 --- a/spec/models/concerns/custom_string_spec.rb +++ b/spec/models/concerns/custom_string_spec.rb @@ -8,14 +8,14 @@ class TestCustomString < String describe '#capitalize_first_letter' do it 'capitalizes the first letter' do - TestCustomString.new('þrettán').capitalize_first_letter.should == 'Þrettán' - TestCustomString.new('!!!1 bar').capitalize_first_letter.should == '!!!1 Bar' - TestCustomString.new('qux QUUX').capitalize_first_letter.should == 'Qux QUUX' - TestCustomString.new('QUX Quux').capitalize_first_letter.should == 'QUX Quux' + expect(TestCustomString.new('þrettán').capitalize_first_letter).to eq 'Þrettán' + expect(TestCustomString.new('!!!1 bar').capitalize_first_letter).to eq '!!!1 Bar' + expect(TestCustomString.new('qux QUUX').capitalize_first_letter).to eq 'Qux QUUX' + expect(TestCustomString.new('QUX Quux').capitalize_first_letter).to eq 'QUX Quux' end it 'does not double-capitalize' do - TestCustomString.new('Baz').capitalize_first_letter.should == 'Baz' + expect(TestCustomString.new('Baz').capitalize_first_letter).to eq 'Baz' end end @@ -55,27 +55,27 @@ class TestCustomString < String subject { test_string.to_slug } it 'strips' do - subject[0].should_not == ' ' + expect(subject[0]).not_to eq ' ' end it 'downcases' do - subject['I'].should == nil + expect(subject['I']).to eq nil end it 'strips apostrophes' do - subject["'"].should == nil + expect(subject["'"]).to eq nil end it 'converts & -> and' do - subject['&'].should == nil - subject['and'].should_not == nil + expect(subject['&']).to eq nil + expect(subject['and']).not_to eq nil end it 'only comprises [a-z-]' do - subject.should match /^[a-z-]+$/ + expect(subject).to match /^[a-z-]+$/ end it 'does not have any double-hyphens' do - subject['--'].should == nil + expect(subject['--']).to eq nil end it 'starts and ends with a letter' do - subject.first.should match /[a-z]/ - subject.last.should match /[a-z]/ + expect(subject.first).to match /[a-z]/ + expect(subject.last).to match /[a-z]/ end end diff --git a/spec/models/musician_name_finder_spec.rb b/spec/models/musician_name_finder_spec.rb index 3070afb..f78daee 100644 --- a/spec/models/musician_name_finder_spec.rb +++ b/spec/models/musician_name_finder_spec.rb @@ -11,19 +11,19 @@ describe 'with a title' do it 'should ask google' do - Google::Search::Web.should_receive(:new).and_return(results) + expect(Google::Search::Web).to receive(:new).and_return(results) MusicianNameFinder.look_up('name') end it 'should trim title' do - Google::Search::Web.stub(:new).and_return(results) - MusicianNameFinder.look_up('name').should == "A Musician 'n stuff" + allow(Google::Search::Web).to receive(:new).and_return(results) + expect(MusicianNameFinder.look_up('name')).to eq "A Musician 'n stuff" end end describe 'without a title' do it 'should raise' do - Google::Search::Web.should_receive(:new).and_return([]) + expect(Google::Search::Web).to receive(:new).and_return([]) expect { MusicianNameFinder.look_up('name') }.to raise_error end end