Sha256: d955c36f09f18747a3f407e8a88f96abb7337883b13a090f65730a21c5917026

Contents?: true

Size: 574 Bytes

Versions: 2

Compression:

Stored size: 574 Bytes

Contents

module AuditedSpecHelpers

  def create_user(attrs = {})
    Models::ActiveRecord::User.create({name: 'Brandon', username: 'brandon', password: 'password', favourite_device: 'Android Phone'}.merge(attrs))
  end

  def build_user(attrs = {})
    Models::ActiveRecord::User.new({name: 'darth', username: 'darth', password: 'noooooooo'}.merge(attrs))
  end

  def create_versions(n = 2)
    Models::ActiveRecord::User.create(name: 'Foobar 1').tap do |u|
      (n - 1).times do |i|
        u.update_attribute :name, "Foobar #{i + 2}"
      end
      u.reload
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
audited-4.6.0 spec/audited_spec_helpers.rb
audited-4.5.0 spec/audited_spec_helpers.rb