fixture_builder 0.5.2.rc2 → 0.5.2.rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fixture_builder/builder.rb +1 -1
- data/lib/fixture_builder/version.rb +1 -1
- data/test/fixture_builder_test.rb +14 -0
- data/test/test_helper.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd02fc964b50f0d14d7a72c0d6fae28c8790a688
|
4
|
+
data.tar.gz: f20e745fd8c4806837457c6b9e730d1344ea33c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08603a86b21d4350696ece5d32e799a8a561fff9f9b7c62c5dec0f232fa5f7c598cafbf156bf590746cc5e6a1db788b9dfd94b0ecfe3a93aaf92a411785e1684
|
7
|
+
data.tar.gz: 469e79f6c8094280f1e6d41ca890c53a6af67881528795c1e6fd8325f1dcbd93adba9937e6c964272b99c2b23be8b3070e04ee20fac4c5dc05048c2c50238ea0
|
@@ -100,7 +100,7 @@ module FixtureBuilder
|
|
100
100
|
if table_klass && table_klass < ActiveRecord::Base
|
101
101
|
rows = table_klass.unscoped do
|
102
102
|
table_klass.all.collect do |obj|
|
103
|
-
attrs = obj.attributes
|
103
|
+
attrs = obj.attributes.select { |attr_name| table_klass.column_names.include?(attr_name) }
|
104
104
|
attrs.inject({}) do |hash, (attr_name, value)|
|
105
105
|
hash[attr_name] = serialized_value_if_needed(table_klass, attr_name, value)
|
106
106
|
hash
|
@@ -54,6 +54,20 @@ class FixtureBuilderTest < Test::Unit::TestCase
|
|
54
54
|
assert_equal "---\n- shading\n- rooting\n- seeding\n", generated_fixture['enty']['powers']
|
55
55
|
end
|
56
56
|
|
57
|
+
def test_do_not_include_virtual_attributes
|
58
|
+
create_and_blow_away_old_db
|
59
|
+
force_fixture_generation
|
60
|
+
|
61
|
+
FixtureBuilder.configure do |fbuilder|
|
62
|
+
fbuilder.files_to_check += Dir[test_path("*.rb")]
|
63
|
+
fbuilder.factory do
|
64
|
+
MagicalCreature.create(:name => 'Uni', :species => 'unicorn', :powers => %w{rainbows flying})
|
65
|
+
end
|
66
|
+
end
|
67
|
+
generated_fixture = YAML.load(File.open(test_path('fixtures/magical_creatures.yml')))
|
68
|
+
assert !generated_fixture['uni'].key?('virtual')
|
69
|
+
end
|
70
|
+
|
57
71
|
def test_configure
|
58
72
|
FixtureBuilder.configure do |config|
|
59
73
|
assert config.is_a?(FixtureBuilder::Configuration)
|
data/test/test_helper.rb
CHANGED
@@ -33,6 +33,8 @@ class MagicalCreature < ActiveRecord::Base
|
|
33
33
|
|
34
34
|
if ActiveRecord::VERSION::MAJOR >= 4
|
35
35
|
default_scope -> { where(:deleted => false) }
|
36
|
+
|
37
|
+
attribute :virtual, ActiveRecord::Type::Integer.new
|
36
38
|
else
|
37
39
|
default_scope :conditions => { :deleted => false }
|
38
40
|
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.rc3
|
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-
|
13
|
+
date: 2018-06-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|