This commit is contained in:
Mark Tareshawty 2018-02-27 22:02:14 -05:00
Родитель 766fc2e1fd
Коммит 83f084b65a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 28DD1C473BF9D1AE
6 изменённых файлов: 19 добавлений и 16 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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