From 83f084b65a328f37821cb1a498f8b501f26c258f Mon Sep 17 00:00:00 2001 From: Mark Tareshawty Date: Tue, 27 Feb 2018 22:02:14 -0500 Subject: [PATCH] Remove uses of should --- spec/models/book_spec.rb | 6 +++--- spec/models/chapter_spec.rb | 10 ++++++---- spec/models/doc_version_spec.rb | 5 +++-- spec/models/download_spec.rb | 4 ++-- spec/models/section_spec.rb | 6 +++--- spec/models/version_spec.rb | 4 ++-- 6 files changed, 19 insertions(+), 16 deletions(-) diff --git a/spec/models/book_spec.rb b/spec/models/book_spec.rb index e5c540c30..b184a12f0 100644 --- a/spec/models/book_spec.rb +++ b/spec/models/book_spec.rb @@ -8,13 +8,13 @@ RSpec.describe Book, type: :model do it { should have_many(:sections).through(:chapters) } it "has chapters" do - book.chapters.any?.should be_truthy - book.chapters.count.should == 3 + expect(book.chapters.any?).to be_truthy + expect(book.chapters.count).to eql(3) end it "should have 4 chapters" do chapter = Fabricate(:chapter, book: book) - book.chapters.count.should == 4 + expect(book.chapters.count).to eql(4) end end diff --git a/spec/models/chapter_spec.rb b/spec/models/chapter_spec.rb index 810e32ee2..023f22223 100644 --- a/spec/models/chapter_spec.rb +++ b/spec/models/chapter_spec.rb @@ -10,16 +10,18 @@ RSpec.describe Chapter, type: :model do it "should have title" do - chapter.title.should == "Git" + expect(chapter.title).to eql("Git") end it "should have book" do - chapter.book.should == book + expect(chapter.book).to eql(book) end it "should have sections" do - chapter.sections.any?.should be_truthy - chapter.sections.count.should == 3 + sections = chapter.sections + + expect(sections.any?).to be_truthy + expect(sections.count).to eql(3) end end diff --git a/spec/models/doc_version_spec.rb b/spec/models/doc_version_spec.rb index 5842ec0c1..25281ed84 100644 --- a/spec/models/doc_version_spec.rb +++ b/spec/models/doc_version_spec.rb @@ -12,8 +12,9 @@ RSpec.describe DocVersion, type: :model do docs = range.map{|i| Fabricate(:doc, :plain => "Doc #{i}")} vers = range.map{|i| Fabricate(:version, :name => "#{i}.0", :vorder => Version.version_to_num("#{i}.0"))} dver = range.map{|i| Fabricate(:doc_version, :doc_file => file, :version => vers[i], :doc => docs[i])} + dv = DocVersion.latest_version - docs[3].should == dv.doc + expect(docs[3]).to eql(dv.doc) end it 'finds a specific version' do @@ -24,6 +25,6 @@ RSpec.describe DocVersion, type: :model do dver = range.map{|i| Fabricate(:doc_version, :doc_file => file, :version => vers[i], :doc => docs[i])} dv = DocVersion.for_version('v2.0') - docs[2].should == dv.doc + expect(docs[2]).to eql(dv.doc) end end diff --git a/spec/models/download_spec.rb b/spec/models/download_spec.rb index 563b017c6..93dcec0e7 100644 --- a/spec/models/download_spec.rb +++ b/spec/models/download_spec.rb @@ -8,11 +8,11 @@ RSpec.describe Download, type: :model do it { should belong_to :version } it "should have url" do - download.url.should == "http://git-scm.com/git.zip" + expect(download.url).to eql('http://git-scm.com/git.zip') end it "should have version" do - download.version == version + expect(download.version).to eql(version) end end diff --git a/spec/models/section_spec.rb b/spec/models/section_spec.rb index fe799bea4..4eaf6f4f2 100644 --- a/spec/models/section_spec.rb +++ b/spec/models/section_spec.rb @@ -12,15 +12,15 @@ RSpec.describe Section, type: :model do it "should have title" do - section.title.should == "Git Section" + expect(section.title).to eql("Git Section") end it "should have chapter" do - section.chapter.should == chapter + expect(section.chapter).to eql(chapter) end it "should have book" do - section.book.should == book + expect(section.book).to eql(book) end end diff --git a/spec/models/version_spec.rb b/spec/models/version_spec.rb index 0085169cd..9f6425afd 100644 --- a/spec/models/version_spec.rb +++ b/spec/models/version_spec.rb @@ -11,8 +11,8 @@ RSpec.describe Version, type: :model do v1 = Version.version_to_num("1.0.0") v2 = Version.version_to_num("1.7.10") v3 = Version.version_to_num("1.8.0.1") - (v1 < v2).should be_truthy - (v2 < v3).should be_truthy + expect(v1).to be < v2 + expect(v2).to be < v3 end