Sha256: 2ff78ea86915d28b0253b4fc0749d2880f4fba690faf4cca9a986c4df46affc7

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

module CartoSet
  module Factories
    module Features

      def create_table(attributes = {})
        @features_table = CartoDB::Connection.create_table 'features'
      end

      def new_feature(values = {})
        create_table unless @features_table.present?

        default_values = {
          :name        => 'feature',
          :description => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
          :latitude    => -16.5060,
          :longitude   => -151.7531
        }
        values = default_values.merge(values)

        CartoDB::Connection.insert_row @features_table.id, values
      end

      def create_random_features(ammount = 25)
        ammount.times do |i|
          new_feature({:name => "Feature #{i}"})
        end
      end
    end

  end
end
RSpec.configuration.include CartoSet::Factories::Features

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cartoset-0.0.2 spec/support/factories/features.rb
cartoset-0.0.1 spec/support/factories/features.rb