fixture_builder 0.5.2.rc3 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +1 -1
- data/.travis.yml +1 -1
- data/lib/fixture_builder/configuration.rb +9 -2
- data/lib/fixture_builder/fixtures_path.rb +1 -1
- data/lib/fixture_builder/version.rb +1 -1
- data/test/fixture_builder_test.rb +15 -1
- data/test/test_helper.rb +8 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0e4cfc50092c04b49b80830b479a2a1b1092397ceea1c9d4d1a95e10c196c240
|
4
|
+
data.tar.gz: 29ae27d39da1fdead7bf37dadb1c40deea757f7d5e0f9923b293f50aa6d2cc8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a8100257b856a58751c5cf14d7bac16ed1a2f2b86cbf466b4ae6f5dd1e456b7d70c9ed988e8f17490736752dd1b355ed5251aaf7f887f2a004adf079bd9e1c3
|
7
|
+
data.tar.gz: 5599b6ee38401778aceb139539d2dc0effd95bf3f5bfb4f2ba8714d48e568269b2015e898a313c13b268d7acbaaf7eed2c826bdff51d9d7a95f4f2657fe68042
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.5.3
|
data/.travis.yml
CHANGED
@@ -5,6 +5,13 @@ require 'fileutils'
|
|
5
5
|
require 'hashdiff'
|
6
6
|
|
7
7
|
module FixtureBuilder
|
8
|
+
if Object.const_defined?(:Hashdiff)
|
9
|
+
# hashdiff version >= 1.0.0
|
10
|
+
Differ = Hashdiff
|
11
|
+
else
|
12
|
+
Differ = HashDiff
|
13
|
+
end
|
14
|
+
|
8
15
|
class Configuration
|
9
16
|
include Delegations::Namer
|
10
17
|
|
@@ -130,12 +137,12 @@ module FixtureBuilder
|
|
130
137
|
if Dir.glob("#{fixture_directory}/*.yml").blank?
|
131
138
|
puts "=> rebuilding fixtures because fixture directory #{fixture_directory} has no *.yml files"
|
132
139
|
return true
|
133
|
-
elsif !::File.
|
140
|
+
elsif !::File.exist?(fixture_builder_file)
|
134
141
|
puts "=> rebuilding fixtures because fixture_builder config file #{fixture_builder_file} does not exist"
|
135
142
|
return true
|
136
143
|
elsif file_hashes_from_disk != file_hashes_from_config
|
137
144
|
puts '=> rebuilding fixtures because one or more of the following files have changed (see http://www.rubydoc.info/gems/hashdiff for diff syntax):'
|
138
|
-
|
145
|
+
Differ.diff(file_hashes_from_disk, file_hashes_from_config).map {|diff| print ' '; p diff}
|
139
146
|
return true
|
140
147
|
end
|
141
148
|
false
|
@@ -5,7 +5,7 @@ module FixtureBuilder
|
|
5
5
|
rescue
|
6
6
|
if ENV["FIXTURES_PATH"]
|
7
7
|
ENV["FIXTURES_PATH"]
|
8
|
-
elsif File.
|
8
|
+
elsif File.exist?(File.expand_path("spec/fixtures",::Rails.root))
|
9
9
|
File.expand_path("spec/fixtures",::Rails.root)
|
10
10
|
else
|
11
11
|
File.expand_path("test/fixtures",::Rails.root)
|
@@ -1,6 +1,5 @@
|
|
1
1
|
require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
|
2
2
|
|
3
|
-
|
4
3
|
class Model
|
5
4
|
def self.table_name
|
6
5
|
'models'
|
@@ -83,4 +82,19 @@ class FixtureBuilderTest < Test::Unit::TestCase
|
|
83
82
|
def test_fixtures_dir
|
84
83
|
assert_match /test\/fixtures$/, FixtureBuilder.configuration.send(:fixtures_dir).to_s
|
85
84
|
end
|
85
|
+
|
86
|
+
def test_rebuilding_due_to_differing_file_hashes
|
87
|
+
create_and_blow_away_old_db
|
88
|
+
force_fixture_generation_due_to_differing_file_hashes
|
89
|
+
|
90
|
+
FixtureBuilder.configure do |fbuilder|
|
91
|
+
fbuilder.files_to_check += Dir[test_path("*.rb")]
|
92
|
+
fbuilder.factory do
|
93
|
+
@enty = MagicalCreature.create(:name => 'Enty', :species => 'ent',
|
94
|
+
:powers => %w{shading rooting seeding})
|
95
|
+
end
|
96
|
+
end
|
97
|
+
generated_fixture = YAML.load(File.open(test_path("fixtures/magical_creatures.yml")))
|
98
|
+
assert_equal "---\n- shading\n- rooting\n- seeding\n", generated_fixture['enty']['powers']
|
99
|
+
end
|
86
100
|
end
|
data/test/test_helper.rb
CHANGED
@@ -61,3 +61,11 @@ def force_fixture_generation
|
|
61
61
|
rescue
|
62
62
|
end
|
63
63
|
end
|
64
|
+
|
65
|
+
def force_fixture_generation_due_to_differing_file_hashes
|
66
|
+
begin
|
67
|
+
path = File.expand_path("../../tmp/fixture_builder.yml", __FILE__)
|
68
|
+
File.write(path, "blah blah blah")
|
69
|
+
rescue
|
70
|
+
end
|
71
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fixture_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.2
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Dy
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2019-08-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|
@@ -165,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
165
|
version: '0'
|
166
166
|
requirements: []
|
167
167
|
rubyforge_project: fixture_builder
|
168
|
-
rubygems_version: 2.
|
168
|
+
rubygems_version: 2.7.6
|
169
169
|
signing_key:
|
170
170
|
specification_version: 4
|
171
171
|
summary: Build Rails fixtures using object mother factories
|