simple_to_fixture 0.0.1
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.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +44 -0
- data/Rakefile +1 -0
- data/lib/simple_to_fixture.rb +24 -0
- data/lib/simple_to_fixture/version.rb +3 -0
- data/simple_to_fixture.gemspec +32 -0
- metadata +111 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 15e85815626307cc769781a142e779b8354b7dda
|
|
4
|
+
data.tar.gz: 5871d99cb13f97168d6a5cdf0b4dd5a1e5ac28c0
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 50579757402e435758b8014d73ef299b39a6ac3e13cb2e0e88a7d00dc52db4d351822d8b2c5cd3e53e6f3e900645ce34e9a9f6335eb6ac1b655da82c15809f56
|
|
7
|
+
data.tar.gz: ab2e613f40d743730a1ae70973c075fc315962e7e19ae04ed6417de92dab6c8f43a67ce0659f108e8348326caca55b4e9e1a1b6fda89a5155dc70792611f1854
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2014 Your Name
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
|
|
2
|
+
# SimpleToFixture
|
|
3
|
+
|
|
4
|
+
Adds a Model.to_fixture('one') to any ActiveRecord model, which
|
|
5
|
+
automatically creates and appends to fixture files for quick
|
|
6
|
+
testing of a real model.
|
|
7
|
+
|
|
8
|
+
Very handy for testing a new business problem or scenario, with
|
|
9
|
+
a sample record that is having the problem.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
Add this line to your application's Gemfile:
|
|
14
|
+
|
|
15
|
+
gem 'simple_to_fixture'
|
|
16
|
+
|
|
17
|
+
And then execute:
|
|
18
|
+
|
|
19
|
+
$ bundle
|
|
20
|
+
|
|
21
|
+
Or install it yourself as:
|
|
22
|
+
|
|
23
|
+
$ gem install simple_to_fixture
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
order = order.find(123)
|
|
28
|
+
|
|
29
|
+
order.to_fixture('test_order_one')
|
|
30
|
+
|
|
31
|
+
- This creates or adds to a fixtures file, in your /test/fixtures folder
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## Contributing
|
|
35
|
+
|
|
36
|
+
1. Fork it
|
|
37
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
38
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
39
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
40
|
+
5. Create new Pull Request
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
Simple ActiveRecord fixture creator
|
|
44
|
+
|
data/Rakefile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require "simple_to_fixture/version"
|
|
2
|
+
|
|
3
|
+
module SimpleToFixture
|
|
4
|
+
|
|
5
|
+
module YAMLFixtures
|
|
6
|
+
def to_fixture(name)
|
|
7
|
+
file_name = Rails.root.join("test/fixtures/#{self.class.table_name.downcase}.yml")
|
|
8
|
+
File.open(file_name, 'a+') do |file|
|
|
9
|
+
yaml = self.to_yaml
|
|
10
|
+
yaml = yaml.split(/\n/)[2..-1]
|
|
11
|
+
yaml.insert(0, "\r\n#{name.strip.downcase.gsub(/:|\*/, '').gsub(/\W/, '_')}:")
|
|
12
|
+
file.write(yaml.join("\r\n")+"\r\n\r\n")
|
|
13
|
+
end
|
|
14
|
+
file_name
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class ActiveRecord::Base
|
|
22
|
+
include SimpleToFixture::YAMLFixtures
|
|
23
|
+
end
|
|
24
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'simple_to_fixture/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "simple_to_fixture"
|
|
8
|
+
spec.version = SimpleToFixture::VERSION
|
|
9
|
+
spec.authors = ["Bruce Martin"]
|
|
10
|
+
spec.email = ["cyber.bruce@yahoo.com"]
|
|
11
|
+
spec.description = %q{Simple and easily add a .to_fixure method to any ActiveRecord Model instance.}
|
|
12
|
+
spec.summary = %q{Adds a Model.to_fixture('one') to any ActiveRecord model, which
|
|
13
|
+
automatically creates and appends to fixture files for quick
|
|
14
|
+
testing of a real model.
|
|
15
|
+
|
|
16
|
+
Very handy for testing a new business problem or scenario, with
|
|
17
|
+
a sample record that is having the problem.}
|
|
18
|
+
spec.homepage = "https://github.com/brucemar10/simple_to_fixture-1.0.0"
|
|
19
|
+
spec.license = "MIT"
|
|
20
|
+
spec.rubyforge_project = "simple_to_fixture"
|
|
21
|
+
spec.files = `git ls-files`.split($/)
|
|
22
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
23
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
24
|
+
spec.require_paths = ["lib"]
|
|
25
|
+
|
|
26
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
|
27
|
+
spec.add_development_dependency "rake"
|
|
28
|
+
spec.add_dependency "activerecord"
|
|
29
|
+
spec.add_dependency "rails"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: simple_to_fixture
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Bruce Martin
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2014-03-14 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ~>
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.3'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ~>
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.3'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - '>='
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - '>='
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: activerecord
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - '>='
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - '>='
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rails
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - '>='
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - '>='
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
description: Simple and easily add a .to_fixure method to any ActiveRecord Model instance.
|
|
70
|
+
email:
|
|
71
|
+
- cyber.bruce@yahoo.com
|
|
72
|
+
executables: []
|
|
73
|
+
extensions: []
|
|
74
|
+
extra_rdoc_files: []
|
|
75
|
+
files:
|
|
76
|
+
- .gitignore
|
|
77
|
+
- Gemfile
|
|
78
|
+
- LICENSE.txt
|
|
79
|
+
- README.md
|
|
80
|
+
- Rakefile
|
|
81
|
+
- lib/simple_to_fixture.rb
|
|
82
|
+
- lib/simple_to_fixture/version.rb
|
|
83
|
+
- simple_to_fixture.gemspec
|
|
84
|
+
homepage: https://github.com/brucemar10/simple_to_fixture-1.0.0
|
|
85
|
+
licenses:
|
|
86
|
+
- MIT
|
|
87
|
+
metadata: {}
|
|
88
|
+
post_install_message:
|
|
89
|
+
rdoc_options: []
|
|
90
|
+
require_paths:
|
|
91
|
+
- lib
|
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - '>='
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0'
|
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
|
+
requirements:
|
|
99
|
+
- - '>='
|
|
100
|
+
- !ruby/object:Gem::Version
|
|
101
|
+
version: '0'
|
|
102
|
+
requirements: []
|
|
103
|
+
rubyforge_project: simple_to_fixture
|
|
104
|
+
rubygems_version: 2.2.2
|
|
105
|
+
signing_key:
|
|
106
|
+
specification_version: 4
|
|
107
|
+
summary: Adds a Model.to_fixture('one') to any ActiveRecord model, which automatically
|
|
108
|
+
creates and appends to fixture files for quick testing of a real model. Very
|
|
109
|
+
handy for testing a new business problem or scenario, with a sample record that
|
|
110
|
+
is having the problem.
|
|
111
|
+
test_files: []
|