application_seeds 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ v0.4.2, 2014-02-18
2
+ ------------------
3
+
4
+ * Fixed `seed_data_exists?` to work with new nested/inheritable
5
+ datasets
6
+
7
+
1
8
  v0.4.1, 2014-02-14
2
9
  ------------------
3
10
 
@@ -25,3 +25,7 @@ module ApplicationSeeds
25
25
 
26
26
  end
27
27
  end
28
+
29
+ if defined?(ActiveRecord)
30
+ ActiveRecord::SchemaDumper.ignore_tables = ["application_seeds"]
31
+ end
@@ -1,3 +1,3 @@
1
1
  module ApplicationSeeds
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
@@ -190,7 +190,7 @@ module ApplicationSeeds
190
190
  # ApplicationSeeds.seed_data_exists?(:campaigns)
191
191
  #
192
192
  def seed_data_exists?(type)
193
- File.exist?(File.join(seed_data_path, @dataset, "#{type}.yml"))
193
+ !@seed_data[type.to_s].nil?
194
194
  end
195
195
 
196
196
  #
@@ -404,7 +404,3 @@ module ApplicationSeeds
404
404
  end
405
405
  end
406
406
  end
407
-
408
- if defined?(ActiveRecord)
409
- ActiveRecord::SchemaDumper.ignore_tables = ["application_seeds"]
410
- end
@@ -98,21 +98,23 @@ describe "ApplicationSeeds" do
98
98
  end
99
99
  end
100
100
 
101
- describe "#seed_data_exists?" do
102
- it "returns true if the specified seed data exists" do
103
- expect(ApplicationSeeds.seed_data_exists?(:people)).to be_true
104
- end
105
- it "returns false if the specified seed data does not exist" do
106
- expect(ApplicationSeeds.seed_data_exists?(:missing)).to_not be_true
107
- end
108
- end
109
-
110
101
  context "with a valid dataset" do
111
102
  before do
112
103
  ApplicationSeeds.stub(:store_dataset)
113
104
  ApplicationSeeds.dataset = "test_data_set"
114
105
  end
115
106
 
107
+ describe "#seed_data_exists?" do
108
+ it "returns true if the specified seed data exists" do
109
+ expect(ApplicationSeeds.seed_data_exists?(:people)).to be_true
110
+ expect(ApplicationSeeds.seed_data_exists?(:companies)).to be_true
111
+ expect(ApplicationSeeds.seed_data_exists?(:departments)).to be_true
112
+ end
113
+ it "returns false if the specified seed data does not exist" do
114
+ expect(ApplicationSeeds.seed_data_exists?(:missing)).to_not be_true
115
+ end
116
+ end
117
+
116
118
  describe "#create_object" do
117
119
  before do
118
120
  @attributes = ApplicationSeeds.people(:joe_smith)
@@ -243,6 +245,17 @@ describe "ApplicationSeeds" do
243
245
  ApplicationSeeds.dataset = "level_3"
244
246
  end
245
247
 
248
+ describe "#seed_data_exists?" do
249
+ it "returns true if the specified seed data exists" do
250
+ expect(ApplicationSeeds.seed_data_exists?(:people)).to be_true
251
+ expect(ApplicationSeeds.seed_data_exists?(:companies)).to be_true
252
+ expect(ApplicationSeeds.seed_data_exists?(:departments)).to be_true
253
+ end
254
+ it "returns false if the specified seed data does not exist" do
255
+ expect(ApplicationSeeds.seed_data_exists?(:missing)).to_not be_true
256
+ end
257
+ end
258
+
246
259
  describe "finding seed data" do
247
260
  it "can find data at the root level" do
248
261
  company = ApplicationSeeds.companies(:mega_corp)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: application_seeds
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-14 00:00:00.000000000 Z
12
+ date: 2014-02-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -120,7 +120,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
120
120
  version: '0'
121
121
  segments:
122
122
  - 0
123
- hash: -1202757200968469914
123
+ hash: -4329626618656842482
124
124
  required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  none: false
126
126
  requirements:
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  version: '0'
130
130
  segments:
131
131
  - 0
132
- hash: -1202757200968469914
132
+ hash: -4329626618656842482
133
133
  requirements: []
134
134
  rubyforge_project:
135
135
  rubygems_version: 1.8.23