fixit 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/README.rdoc +13 -0
- data/Rakefile +15 -0
- data/fixit.gemspec +20 -0
- data/lib/fixit/fixit.rb +60 -0
- data/lib/fixit.rb +1 -0
- metadata +50 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: eae443068990ba13c9243c238f832bf6d949f5d0
|
|
4
|
+
data.tar.gz: 97a68165f06dcd832bc6a97de6f00390fab73dfb
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 8f83dc3881a9828b6bef67832479fd36188cffa41ba9d78128de825b10c207033581ab6f6c2f8a9c15c3d98f1c89878b06f52b8c145a094c5e865fd0031b9fef
|
|
7
|
+
data.tar.gz: 2092284bad3a698e161ef863e2e59369f089be155c0e780b6004245ac3f455b204f3d3429f49575d7c7c1f50d72855d8b237b0ee64d83df4481305c069e4349a
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
data/fixit.gemspec
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Gem::Specification.new do |s|
|
|
2
|
+
s.name = "fixit"
|
|
3
|
+
s.version = "0.0.1"
|
|
4
|
+
s.platform = Gem::Platform::RUBY
|
|
5
|
+
s.summary = "simple fixture for rspec"
|
|
6
|
+
s.license = "MIT"
|
|
7
|
+
|
|
8
|
+
s.description = <<-EOF
|
|
9
|
+
Fixit providees a minimal interface for using fixuture.
|
|
10
|
+
Also see http://borot.github.com/.
|
|
11
|
+
EOF
|
|
12
|
+
|
|
13
|
+
s.files = Dir['{lib/**/*}'] +
|
|
14
|
+
%w(fixit.gemspec Rakefile README.rdoc)
|
|
15
|
+
s.require_path = 'lib'
|
|
16
|
+
|
|
17
|
+
s.author = 'Masato Ishimoto'
|
|
18
|
+
s.email = 'masato.ishimoto@gmail.com'
|
|
19
|
+
s.homepage = 'http://borot.github.com/'
|
|
20
|
+
end
|
data/lib/fixit/fixit.rb
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
class Fixit
|
|
2
|
+
def initialize(klass)
|
|
3
|
+
@klass = klass
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
def assign( name, &block )
|
|
7
|
+
self.class.candidates[name] = @candidate = { obj: @klass.new, attributes: {} }
|
|
8
|
+
yield
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def attribute( name, *args, &block)
|
|
12
|
+
val = args.first
|
|
13
|
+
val = block if block_given?
|
|
14
|
+
@candidate[:attributes][name] = val
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
alias method_missing attribute
|
|
18
|
+
|
|
19
|
+
class << self
|
|
20
|
+
@@prepared = false
|
|
21
|
+
|
|
22
|
+
def manage( klass, &block )
|
|
23
|
+
self.new(klass).instance_eval &block
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def get( name )
|
|
27
|
+
assigneds[name]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def assigneds
|
|
31
|
+
@@assigneds ||= {}
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def candidates
|
|
35
|
+
@@candidates ||= {}
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def load
|
|
39
|
+
prepare unless prepared?
|
|
40
|
+
|
|
41
|
+
candidates.each do |name, candidate|
|
|
42
|
+
candidate[:attributes].each do |attr, val|
|
|
43
|
+
candidate[:obj].send("#{attr}=", val.is_a?(Proc) ? val.call : val)
|
|
44
|
+
end
|
|
45
|
+
assigneds[name] = candidate[:obj]
|
|
46
|
+
assigneds[name].save!
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def prepare
|
|
51
|
+
require 'spec/fixit.rb' if File.exists? 'spec/fixit.rb'
|
|
52
|
+
Dir["spec/fixit/*.rb"].each {|f| require f }
|
|
53
|
+
@@prepared = true
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def prepared?
|
|
57
|
+
!!@@prepared
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
data/lib/fixit.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'fixit/fixit'
|
metadata
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: fixit
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Masato Ishimoto
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2013-06-10 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: |
|
|
14
|
+
Fixit providees a minimal interface for using fixuture.
|
|
15
|
+
Also see http://borot.github.com/.
|
|
16
|
+
email: masato.ishimoto@gmail.com
|
|
17
|
+
executables: []
|
|
18
|
+
extensions: []
|
|
19
|
+
extra_rdoc_files: []
|
|
20
|
+
files:
|
|
21
|
+
- lib/fixit/fixit.rb
|
|
22
|
+
- lib/fixit.rb
|
|
23
|
+
- fixit.gemspec
|
|
24
|
+
- Rakefile
|
|
25
|
+
- README.rdoc
|
|
26
|
+
homepage: http://borot.github.com/
|
|
27
|
+
licenses:
|
|
28
|
+
- MIT
|
|
29
|
+
metadata: {}
|
|
30
|
+
post_install_message:
|
|
31
|
+
rdoc_options: []
|
|
32
|
+
require_paths:
|
|
33
|
+
- lib
|
|
34
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
35
|
+
requirements:
|
|
36
|
+
- - '>='
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: '0'
|
|
39
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
40
|
+
requirements:
|
|
41
|
+
- - '>='
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: '0'
|
|
44
|
+
requirements: []
|
|
45
|
+
rubyforge_project:
|
|
46
|
+
rubygems_version: 2.0.3
|
|
47
|
+
signing_key:
|
|
48
|
+
specification_version: 4
|
|
49
|
+
summary: simple fixture for rspec
|
|
50
|
+
test_files: []
|