Sha256: 6bf119da91285cac69663b634fe540930d7bcb259e2581b7d1729cf578795a1f

Contents?: true

Size: 905 Bytes

Versions: 5

Compression:

Stored size: 905 Bytes

Contents

# frozen_string_literal: true

require 'helper'

class TestBook < Test::Unit::TestCase
  include DeterministicHelper

  assert_methods_are_deterministic(
    FFaker::Book,
    :title, :genre, :author, :isbn, :description, :cover
  )

  def setup
    @tester = FFaker::Book
  end

  def test_title
    assert_match(/[\sa-z]+/, @tester.title)
  end

  def test_genre
    assert_match(%r{[\w\s'\/]+}, @tester.genre)
  end

  def test_author
    assert_match(/[\sa-z]+/, @tester.author)
  end

  def test_isbn
    assert_match(/[\d]+/, @tester.isbn)
  end

  def test_description
    assert_match(/[\sa-z]+/, @tester.description)
  end

  def test_cover
    assert_match(%r{\Ahttps:\/\/robohash\.org\/.+\.png\?size=300x300\z},
                 @tester.cover)
  end

  def test_orly_cover
    assert_match(%r{\Ahttps:\/\/orly-appstore\.herokuapp\.com\/generate},
                 @tester.orly_cover)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ffaker-2.16.0 test/test_book.rb
ffaker-2.15.0 test/test_book.rb
ffaker-2.14.0 test/test_book.rb
ffaker-2.13.0 test/test_book.rb
ffaker-2.12.0 test/test_book.rb