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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: bd02fc964b50f0d14d7a72c0d6fae28c8790a688
4
- data.tar.gz: f20e745fd8c4806837457c6b9e730d1344ea33c5
2
+ SHA256:
3
+ metadata.gz: 0e4cfc50092c04b49b80830b479a2a1b1092397ceea1c9d4d1a95e10c196c240
4
+ data.tar.gz: 29ae27d39da1fdead7bf37dadb1c40deea757f7d5e0f9923b293f50aa6d2cc8f
5
5
  SHA512:
6
- metadata.gz: 08603a86b21d4350696ece5d32e799a8a561fff9f9b7c62c5dec0f232fa5f7c598cafbf156bf590746cc5e6a1db788b9dfd94b0ecfe3a93aaf92a411785e1684
7
- data.tar.gz: 469e79f6c8094280f1e6d41ca890c53a6af67881528795c1e6fd8325f1dcbd93adba9937e6c964272b99c2b23be8b3070e04ee20fac4c5dc05048c2c50238ea0
6
+ metadata.gz: 2a8100257b856a58751c5cf14d7bac16ed1a2f2b86cbf466b4ae6f5dd1e456b7d70c9ed988e8f17490736752dd1b355ed5251aaf7f887f2a004adf079bd9e1c3
7
+ data.tar.gz: 5599b6ee38401778aceb139539d2dc0effd95bf3f5bfb4f2ba8714d48e568269b2015e898a313c13b268d7acbaaf7eed2c826bdff51d9d7a95f4f2657fe68042
@@ -1 +1 @@
1
- ruby-2.2.5
1
+ ruby-2.5.3
@@ -1,6 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.5
3
+ - 2.5.3
4
4
  before_install:
5
5
  - gem update --system
6
6
  - gem update bundler
@@ -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.exists?(fixture_builder_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
- HashDiff.diff(file_hashes_from_disk, file_hashes_from_config).map {|diff| print ' '; p diff}
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.exists?(File.expand_path("spec/fixtures",::Rails.root))
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,3 +1,3 @@
1
1
  module FixtureBuilder
2
- VERSION = '0.5.2.rc3'
2
+ VERSION = '0.5.2'
3
3
  end
@@ -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
@@ -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.rc3
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: 2018-06-24 00:00:00.000000000 Z
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.4.5.1
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