Module: Synthra::TestHelpers

Extended by:
ActiveSupport::Concern
Defined in:
lib/synthra/engine.rb

Overview

Test helpers for RSpec and Minitest

Instance Method Summary collapse

Instance Method Details

#fake_data(schema_name, **options) ⇒ Hash

Generate fake data for a schema

Parameters:

  • schema_name (String, Symbol)

    schema name

  • options (Hash)

    generation options

Returns:

  • (Hash)

    generated data



222
223
224
# File 'lib/synthra/engine.rb', line 222

def fake_data(schema_name, **options)
  Synthra.generate(schema_name.to_s, **options)
end

#fake_data_list(schema_name, count = 10, **options) ⇒ Array<Hash>

Generate multiple fake data records

Parameters:

  • schema_name (String, Symbol)

    schema name

  • count (Integer) (defaults to: 10)

    number of records

  • options (Hash)

    generation options

Returns:

  • (Array<Hash>)

    generated data



233
234
235
# File 'lib/synthra/engine.rb', line 233

def fake_data_list(schema_name, count = 10, **options)
  Synthra.generate_many(schema_name.to_s, count, **options)
end