Sha256: 162ac0d670982fe598c736de240c3326135e2a06d78f6c21e571b39fb2a03103

Contents?: true

Size: 909 Bytes

Versions: 9

Compression:

Stored size: 909 Bytes

Contents

# frozen_string_literal: true

require_relative 'helper'

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

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

  def setup
    @tester = FFakerTW::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

9 entries across 9 versions & 1 rubygems

Version Path
ffakerTW-1.8.0 test/test_book.rb
ffakerTW-1.7.0 test/test_book.rb
ffakerTW-1.6.0 test/test_book.rb
ffakerTW-1.5.0 test/test_book.rb
ffakerTW-1.4.0 test/test_book.rb
ffakerTW-1.3.0 test/test_book.rb
ffakerTW-1.2.0 test/test_book.rb
ffakerTW-1.1.0 test/test_book.rb
ffakerTW-0.1.0 test/test_book.rb