looky-lu 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODcwZmI4M2U3MjUxMGRjZTkxZmQ2M2NiMzIyODEyM2I1ZjA5ZDZiNA==
4
+ MzUxOTViODMwY2VjMzQ5OTg1NjU4MGQxMzU4NmE5ZTI1NTNlYjQzYw==
5
5
  data.tar.gz: !binary |-
6
- YzE3NmQ0MGE4YjM5NjU4OTQ5N2JhMzNmNDdkNzBkYjZiYjBlYjk3OA==
6
+ OTIzNjdlOTJmYTE4NGNlZTE1MDE4NmNjMWVmZDY5YmZlYjE4MWNmMg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- Njc5NjZlZTVlZmM1ZDA5Mjk2YmEyMjJmODdkMzQ1ZGI5Mjk0YjIzMDIyZjUx
10
- YWRhZjFlYWE3YTg3OTJhODNkNzZlN2U5YzA2YjViZmQ0ZDg3NTQ3ZTk3NWI0
11
- MmZjNzgxYTE1NTZhM2YwM2NhYjQ3YjJmMWU3ZTE2Nzc0NjJhZWQ=
9
+ ZTNlMTBkODBlZjZlMGY4OGZlOTdmODI3YmI3ZDAxYWFlZjUzZjhiNmNjZDAx
10
+ MTgwOTk0MjAyZTNiYzJhMzMyYjc0MDBhZTNmZmIyM2YyN2IyZjRlYjEzYmUz
11
+ Y2ZlODFjYTZjNmM1YzQyNWExODdiNWVkMGUyZTc5YTM0NWY3ZTM=
12
12
  data.tar.gz: !binary |-
13
- MDIwZTViYjRkMGQ0ZWY4ODA0ODcxMWU5MDJiMGNiOTNjN2JjMzhiMzBiZDdh
14
- YjQ0MmY1MWU3MTMxMDVkOWQwYTI0OWQ2ZTBlOTIxNGYxY2Q4MmU3YTE5OGFi
15
- NzBhOGE3ZGY0NWExYjc3YmYzYWMzYzE0NzdkZDkyZjM0YTNkMjc=
13
+ ZjE2NDk3NjBlM2Y5NDllMzFhNjljNGY0ODFiNjEwYmE1MGRiNjk4MTA0ODJl
14
+ ZjkzODM3MTk1NmQ1NjJjZGQxZTMyYzdjNDdmMjQ5NzAyNGZjODhkOWQ3MzUy
15
+ OTg1Zjc5OTY5NGJmNjE3M2U2MDYyNTI5ZmExNjZlN2M0MjE2ODE=
@@ -8,7 +8,7 @@ module LookyLu
8
8
  class_object = eval(object_name.camelize)
9
9
 
10
10
  states.each do |s|
11
- class_object.create(s)
11
+ class_object.where(s).first_or_create
12
12
  end
13
13
  rescue => e
14
14
  raise "Could not find object for #{object_name.camelize}"
@@ -11,10 +11,6 @@ module Lookylu
11
11
  the_file = 'db/seeds.rb'
12
12
  to_append = "\nLookyLu::States.insert_data('#{options.country_name}', '#{object_name}')\n"
13
13
 
14
- #File.open(the_file, 'a') do |file|
15
- # file.write "\nLookyLu::States.insert_data('#{options.country_name}', '#{object_name}')\n"
16
- #end
17
-
18
14
  FileUtils.touch the_file
19
15
  append_file(the_file, to_append)
20
16
 
@@ -1,3 +1,3 @@
1
1
  module LookyLu
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -16,6 +16,12 @@ describe LookyLu::States do
16
16
  to raise_error 'Could not find object for NotThere'
17
17
  end
18
18
 
19
+ it 'should not duplicate the data' do
20
+ State.create({name: 'Nebraska', abbreviation: 'NE'})
21
+ LookyLu::States.insert_data('united_states', 'state')
22
+ State.count.should == 51
23
+ end
24
+
19
25
  end
20
26
 
21
27
  describe 'from country' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: looky-lu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Hopp