Sha256: 766a17dd42afbbdd908faf97416a5d729e0d6888ea4eae6063bbd7746c829125

Contents?: true

Size: 459 Bytes

Versions: 106

Compression:

Stored size: 459 Bytes

Contents

require 'generator/exercise_case'

class IsbnVerifierCase < Generator::ExerciseCase

  def workload
    indent_lines(
      [
        "string = #{input.inspect}",
        "#{assert} IsbnVerifier.valid?(string), #{failure_message}"
      ], 4
    )
  end

  private

  def failure_message
    %Q("Expected #{expected}, #{reason}")
  end

  def reason
    "'\#{string}' #{is_or_not} a valid isbn"
  end

  def is_or_not
    expected ? 'is' : 'is not'
  end

end

Version data entries

106 entries across 106 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/ruby/exercises/isbn-verifier/.meta/generator/isbn_verifier_case.rb
trackler-2.2.1.179 tracks/ruby/exercises/isbn-verifier/.meta/generator/isbn_verifier_case.rb
trackler-2.2.1.178 tracks/ruby/exercises/isbn-verifier/.meta/generator/isbn_verifier_case.rb
trackler-2.2.1.177 tracks/ruby/exercises/isbn-verifier/.meta/generator/isbn_verifier_case.rb
trackler-2.2.1.176 tracks/ruby/exercises/isbn-verifier/.meta/generator/isbn_verifier_case.rb
trackler-2.2.1.175 tracks/ruby/exercises/isbn-verifier/.meta/generator/isbn_verifier_case.rb
trackler-2.2.1.174 tracks/ruby/exercises/isbn-verifier/.meta/generator/isbn_verifier_case.rb
trackler-2.2.1.173 tracks/ruby/exercises/isbn-verifier/.meta/generator/isbn_verifier_case.rb
trackler-2.2.1.172 tracks/ruby/exercises/isbn-verifier/.meta/generator/isbn_verifier_case.rb
trackler-2.2.1.171 tracks/ruby/exercises/isbn-verifier/.meta/generator/isbn_verifier_case.rb
trackler-2.2.1.170 tracks/ruby/exercises/isbn-verifier/.meta/generator/isbn_verifier_case.rb
trackler-2.2.1.169 tracks/ruby/exercises/isbn-verifier/.meta/generator/isbn_verifier_case.rb
trackler-2.2.1.167 tracks/ruby/exercises/isbn-verifier/.meta/generator/isbn_verifier_case.rb
trackler-2.2.1.166 tracks/ruby/exercises/isbn-verifier/.meta/generator/isbn_verifier_case.rb
trackler-2.2.1.165 tracks/ruby/exercises/isbn-verifier/.meta/generator/isbn_verifier_case.rb
trackler-2.2.1.164 tracks/ruby/exercises/isbn-verifier/.meta/generator/isbn_verifier_case.rb
trackler-2.2.1.163 tracks/ruby/exercises/isbn-verifier/.meta/generator/isbn_verifier_case.rb
trackler-2.2.1.162 tracks/ruby/exercises/isbn-verifier/.meta/generator/isbn_verifier_case.rb
trackler-2.2.1.161 tracks/ruby/exercises/isbn-verifier/.meta/generator/isbn_verifier_case.rb
trackler-2.2.1.160 tracks/ruby/exercises/isbn-verifier/.meta/generator/isbn_verifier_case.rb