Sha256: f43630ee649bfcad6a034d317c0447fa0549eabde40fe258f982ab7824a37ef4

Contents?: true

Size: 508 Bytes

Versions: 39

Compression:

Stored size: 508 Bytes

Contents

def r_str
  SecureRandom.hex(3)
end

def resource_has_many(resource, association_name)
  association = if resource.send(association_name).length > 0
    nil
  elsif association_name.to_s.classify.constantize.count > 0
    association_name.to_s.classify.constantize.last
  else
    Factory.create association_name.to_s.singularize.to_sym
  end
  
  resource.send(association_name).send('<<', association) if association
end

FactoryGirl.define do
  Voluntary::Test::RspecHelpers::Factories.code.call(self)
end

Version data entries

39 entries across 13 versions & 1 rubygems

Version Path
voluntary-0.7.1 lib/generators/voluntary/product_dummy/templates/spec/factories.rb
voluntary-0.7.1 lib/generators/voluntary/product_dummy/templates/dummy/spec/factories.rb
voluntary-0.7.1 lib/generators/voluntary/install/templates/spec/factories.rb
voluntary-0.7.0 lib/generators/voluntary/install/templates/spec/factories.rb
voluntary-0.7.0 lib/generators/voluntary/product_dummy/templates/spec/factories.rb
voluntary-0.7.0 lib/generators/voluntary/product_dummy/templates/dummy/spec/factories.rb
voluntary-0.6.0 lib/generators/voluntary/install/templates/spec/factories.rb
voluntary-0.6.0 lib/generators/voluntary/product_dummy/templates/spec/factories.rb
voluntary-0.6.0 lib/generators/voluntary/product_dummy/templates/dummy/spec/factories.rb
voluntary-0.5.2 lib/generators/voluntary/product_dummy/templates/spec/factories.rb
voluntary-0.5.2 lib/generators/voluntary/product_dummy/templates/dummy/spec/factories.rb
voluntary-0.5.2 lib/generators/voluntary/install/templates/spec/factories.rb
voluntary-0.5.1 lib/generators/voluntary/install/templates/spec/factories.rb
voluntary-0.5.1 lib/generators/voluntary/product_dummy/templates/spec/factories.rb
voluntary-0.5.1 lib/generators/voluntary/product_dummy/templates/dummy/spec/factories.rb
voluntary-0.5.0 lib/generators/voluntary/product_dummy/templates/dummy/spec/factories.rb
voluntary-0.5.0 lib/generators/voluntary/product_dummy/templates/spec/factories.rb
voluntary-0.5.0 lib/generators/voluntary/install/templates/spec/factories.rb
voluntary-0.4.0 lib/generators/voluntary/product_dummy/templates/dummy/spec/factories.rb
voluntary-0.4.0 lib/generators/voluntary/install/templates/spec/factories.rb