inheritable_fixtures 0.2.0 → 0.2.1

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
2
  SHA1:
3
- metadata.gz: b1a12d088640eec5e03ee6a56f46e496744a39b2
4
- data.tar.gz: f6af4b8466bc81b8c4924b40bc1d2e73ab0c22b6
3
+ metadata.gz: d9ceb903bfe04b095d6288d763be8ef38b05fe6a
4
+ data.tar.gz: 720dfb701b2d113336b49a72690efe470ac27865
5
5
  SHA512:
6
- metadata.gz: 373b57ddf376468dbb6c78386ec17f093d7a73d81ecce3f86c82fc9e8ed0456e40a51b75f59859fe62ebe8418cfcbaef5149cd9a3ffe2ba4f83e469937b4746b
7
- data.tar.gz: b82f7e1a1ab4f614975fdc16fd2bf59475133629865d4a1442ed44ac17fb38080056a266cd4b9aa108df0ea8f58e8f4ef50d8e72fe8c384763b9a4b340269bd5
6
+ metadata.gz: d01564b87b709d300a2e38da8c2881d2b3e0e376fc80344483bf640ba4ff2d40dcd44dd751f201b1bed1ef13dcce3ac6ccf638a820584a99e39d7fd297ad7336
7
+ data.tar.gz: 33bf8a731a331cb8bbed5b248f7dcdc27e74ee325a1bad463dcf9e9d2721ef9cfaa222d6d5856d9f4d3987920a9c2de696be7e89c5a68ec7cc4f044dbb3dd9b7
data/Gemfile CHANGED
@@ -6,3 +6,4 @@ gem 'appraisal', '~> 2.0'
6
6
  gem 'bundler'
7
7
  gem 'minitest'
8
8
  gem 'sqlite3'
9
+ gem 'byebug'
@@ -1,7 +1,5 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'inheritable_fixtures/version'
2
+ require_relative 'lib/inheritable_fixtures/version'
5
3
 
6
4
  Gem::Specification.new do |spec|
7
5
  spec.name = "inheritable_fixtures"
@@ -1,3 +1,3 @@
1
1
  module InheritableFixtures
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -0,0 +1,47 @@
1
+ require 'rails/generators/test_unit'
2
+
3
+ module TestUnit # :nodoc:
4
+ module Generators # :nodoc:
5
+ class ModelGenerator < Base # :nodoc:
6
+
7
+ def self.source_root
8
+ File.expand_path(File.join('test_unit/model/templates'), base_root)
9
+ end
10
+
11
+ RESERVED_YAML_KEYWORDS = %w(y yes n no true false on off null)
12
+
13
+ argument :attributes, type: :array, default: [], banner: "field:type field:type"
14
+ class_option :fixture, type: :boolean
15
+
16
+ check_class_collision suffix: "Test"
17
+
18
+ def create_test_file
19
+ template 'unit_test.rb', File.join('test/models', class_path, "#{file_name}_test.rb")
20
+ end
21
+
22
+ hook_for :fixture_replacement
23
+
24
+ def create_fixture_file
25
+ target_dir = in_an_engine_context? ? 'lib/fixtures' : 'test/fixtures'
26
+
27
+ if options[:fixture] && options[:fixture_replacement].nil?
28
+ template 'fixtures.yml', File.join(target_dir, class_path, "#{plural_file_name}.yml")
29
+ end
30
+ end
31
+
32
+ private
33
+
34
+ def yaml_key_value(key, value)
35
+ if RESERVED_YAML_KEYWORDS.include?(key.downcase)
36
+ "'#{key}': #{value}"
37
+ else
38
+ "#{key}: #{value}"
39
+ end
40
+ end
41
+
42
+ def in_an_engine_context?
43
+ Rails.application.nil?
44
+ end
45
+ end
46
+ end
47
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inheritable_fixtures
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Kmiec
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-07-16 00:00:00.000000000 Z
11
+ date: 2015-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -52,6 +52,7 @@ files:
52
52
  - lib/inheritable_fixtures/rails_extensions/test_fixtures.rb
53
53
  - lib/inheritable_fixtures/rails_extensions/test_process.rb
54
54
  - lib/inheritable_fixtures/version.rb
55
+ - lib/rails/generators/test_unit/model/model_generator.rb
55
56
  homepage:
56
57
  licenses:
57
58
  - MIT
@@ -72,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
73
  version: '0'
73
74
  requirements: []
74
75
  rubyforge_project:
75
- rubygems_version: 2.4.7
76
+ rubygems_version: 2.1.11
76
77
  signing_key:
77
78
  specification_version: 4
78
79
  summary: Allows fixtures from engines to be inherited by applications