static_model 1.0.4 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Appraisals +12 -0
- data/Gemfile +9 -0
- data/Rakefile +3 -3
- data/lib/static_model.rb +1 -1
- data/static_model.gemspec +32 -14
- data/test/{test_static_model_associations.rb → associations_test.rb} +2 -2
- data/test/data/projects.yml +2 -2
- data/test/{test_generator_helper.rb → generator_helper.rb} +2 -2
- data/test/{test_static_model_generator.rb → generator_test.rb} +2 -2
- data/test/{test_helper.rb → helper.rb} +8 -7
- data/test/{test_static_model_scope.rb → scope_test.rb} +2 -2
- data/test/{test_static_model.rb → static_model_test.rb} +7 -7
- metadata +102 -22
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 53ce10f3e67dc85dcb08c8d8573644f8317758b9
|
4
|
+
data.tar.gz: 81c3aefe808cf1964928f0d14158e3a025f829b0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a266c3136370f66298add0e2830dc02a6598bec2f193ca9f0938b678db1b60eee6e7963d4a3f554107c078444317923f0e8b4dc6639dbec83d0df603ebdc844f
|
7
|
+
data.tar.gz: 9792b1696b607b954dabd3681b8c38380d818cc4796ce9eb02cda55320478a592caff7c7202af1ef1c64129e85d1bb571cba7cc9651f32b7940323907fd8d04b
|
data/Appraisals
ADDED
data/Gemfile
ADDED
data/Rakefile
CHANGED
@@ -9,11 +9,9 @@ begin
|
|
9
9
|
s.email = %{aaron@quirkey.com}
|
10
10
|
s.homepage = "http://github.com/quirkey/static_model"
|
11
11
|
s.authors = ["Aaron Quint"]
|
12
|
-
s.date = %q{2009-12-03}
|
13
12
|
s.summary = 'ActiveRecord like functionalities for reading from YAML with a simple class implementation'
|
14
13
|
s.description = %q{StaticModel provides a Base class much like ActiveRecord which supports reading from a YAML file and basic associations to ActiveRecord}
|
15
14
|
s.rubyforge_project = %q{quirkey}
|
16
|
-
s.add_development_dependency(%q<Shoulda>, [">= 1.2.0"])
|
17
15
|
end
|
18
16
|
Jeweler::GemcutterTasks.new
|
19
17
|
rescue LoadError
|
@@ -21,8 +19,10 @@ rescue LoadError
|
|
21
19
|
end
|
22
20
|
|
23
21
|
Rake::TestTask.new do |t|
|
22
|
+
should_test_generator = ENV["TEST_GENERATOR"] == "true"
|
24
23
|
t.libs << "test"
|
25
|
-
|
24
|
+
files = FileList["test/**/*_test.rb"].delete_if { |f| !should_test_generator && f == "test/generator_test.rb" }
|
25
|
+
t.test_files = files
|
26
26
|
t.verbose = true
|
27
27
|
end
|
28
28
|
|
data/lib/static_model.rb
CHANGED
data/static_model.gemspec
CHANGED
@@ -2,20 +2,24 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: static_model 1.1.0 ruby lib
|
5
6
|
|
6
7
|
Gem::Specification.new do |s|
|
7
8
|
s.name = "static_model"
|
8
|
-
s.version = "1.0
|
9
|
+
s.version = "1.1.0"
|
9
10
|
|
10
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
11
13
|
s.authors = ["Aaron Quint"]
|
12
|
-
s.date = "
|
14
|
+
s.date = "2015-03-06"
|
13
15
|
s.description = "StaticModel provides a Base class much like ActiveRecord which supports reading from a YAML file and basic associations to ActiveRecord"
|
14
16
|
s.email = "aaron@quirkey.com"
|
15
17
|
s.extra_rdoc_files = [
|
16
18
|
"README.rdoc"
|
17
19
|
]
|
18
20
|
s.files = [
|
21
|
+
"Appraisals",
|
22
|
+
"Gemfile",
|
19
23
|
"History.txt",
|
20
24
|
"License.txt",
|
21
25
|
"README.rdoc",
|
@@ -35,6 +39,7 @@ Gem::Specification.new do |s|
|
|
35
39
|
"lib/static_model/rails.rb",
|
36
40
|
"lib/static_model/scope.rb",
|
37
41
|
"static_model.gemspec",
|
42
|
+
"test/associations_test.rb",
|
38
43
|
"test/data/authors.yml",
|
39
44
|
"test/data/books.yml",
|
40
45
|
"test/data/empty.yml",
|
@@ -42,29 +47,42 @@ Gem::Specification.new do |s|
|
|
42
47
|
"test/data/projects.yml",
|
43
48
|
"test/data/publishers.yml",
|
44
49
|
"test/data/stores.yml",
|
45
|
-
"test/
|
46
|
-
"test/
|
47
|
-
"test/
|
48
|
-
"test/
|
49
|
-
"test/
|
50
|
-
"test/test_static_model_scope.rb"
|
50
|
+
"test/generator_helper.rb",
|
51
|
+
"test/generator_test.rb",
|
52
|
+
"test/helper.rb",
|
53
|
+
"test/scope_test.rb",
|
54
|
+
"test/static_model_test.rb"
|
51
55
|
]
|
52
56
|
s.homepage = "http://github.com/quirkey/static_model"
|
53
|
-
s.require_paths = ["lib"]
|
54
57
|
s.rubyforge_project = "quirkey"
|
55
|
-
s.rubygems_version = "
|
58
|
+
s.rubygems_version = "2.2.2"
|
56
59
|
s.summary = "ActiveRecord like functionalities for reading from YAML with a simple class implementation"
|
57
60
|
|
58
61
|
if s.respond_to? :specification_version then
|
59
|
-
s.specification_version =
|
62
|
+
s.specification_version = 4
|
60
63
|
|
61
64
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
62
|
-
s.add_development_dependency(%q<
|
65
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
66
|
+
s.add_development_dependency(%q<appraisal>, [">= 1.0.2", "~> 1.0"])
|
67
|
+
s.add_development_dependency(%q<minitest>, ["~> 5.5"])
|
68
|
+
s.add_development_dependency(%q<mocha>, [">= 1.1.0", "~> 1.1"])
|
69
|
+
s.add_development_dependency(%q<rubigen>, [">= 1.5.7"])
|
70
|
+
s.add_development_dependency(%q<shoulda-context>, ["~> 1.2"])
|
63
71
|
else
|
64
|
-
s.add_dependency(%q<
|
72
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
73
|
+
s.add_dependency(%q<appraisal>, [">= 1.0.2", "~> 1.0"])
|
74
|
+
s.add_dependency(%q<minitest>, ["~> 5.5"])
|
75
|
+
s.add_dependency(%q<mocha>, [">= 1.1.0", "~> 1.1"])
|
76
|
+
s.add_dependency(%q<rubigen>, [">= 1.5.7"])
|
77
|
+
s.add_dependency(%q<shoulda-context>, ["~> 1.2"])
|
65
78
|
end
|
66
79
|
else
|
67
|
-
s.add_dependency(%q<
|
80
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
81
|
+
s.add_dependency(%q<appraisal>, [">= 1.0.2", "~> 1.0"])
|
82
|
+
s.add_dependency(%q<minitest>, ["~> 5.5"])
|
83
|
+
s.add_dependency(%q<mocha>, [">= 1.1.0", "~> 1.1"])
|
84
|
+
s.add_dependency(%q<rubigen>, [">= 1.5.7"])
|
85
|
+
s.add_dependency(%q<shoulda-context>, ["~> 1.2"])
|
68
86
|
end
|
69
87
|
end
|
70
88
|
|
data/test/data/projects.yml
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
-
|
2
|
-
require 'rubygems'
|
3
|
-
require 'shoulda'
|
4
|
-
require 'mocha'
|
1
|
+
$LOAD_PATH.unshift(File.join(File.expand_path(File.dirname(__FILE__)), "../lib"))
|
5
2
|
|
6
|
-
require
|
3
|
+
require "rubygems"
|
4
|
+
require "minitest/autorun"
|
5
|
+
require "mocha/test_unit"
|
6
|
+
require "shoulda-context"
|
7
|
+
|
8
|
+
require "static_model"
|
7
9
|
|
8
10
|
class Book < StaticModel::Base
|
9
11
|
set_data_file File.join(File.dirname(__FILE__), 'data', 'books.yml')
|
@@ -56,7 +58,7 @@ class Project < StaticModel::Base
|
|
56
58
|
belongs_to :author
|
57
59
|
end
|
58
60
|
|
59
|
-
class Test
|
61
|
+
class Minitest::Test
|
60
62
|
|
61
63
|
def assert_all(collection)
|
62
64
|
collection.each do |one|
|
@@ -64,7 +66,6 @@ class Test::Unit::TestCase
|
|
64
66
|
end
|
65
67
|
end
|
66
68
|
|
67
|
-
|
68
69
|
def assert_any(collection, &block)
|
69
70
|
has = collection.any? do |one|
|
70
71
|
yield(one)
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
1
|
+
require "helper"
|
2
2
|
|
3
|
-
class
|
3
|
+
class StaticModelTest < Minitest::Test
|
4
4
|
|
5
5
|
context "StaticModel" do
|
6
6
|
context "A class that inherits from Base" do
|
@@ -17,7 +17,7 @@ class TestStaticModel < Test::Unit::TestCase
|
|
17
17
|
end
|
18
18
|
|
19
19
|
should "raise error if passed anything but hash" do
|
20
|
-
|
20
|
+
assert_raises(StaticModel::BadOptions) do
|
21
21
|
Book.new("im bad")
|
22
22
|
end
|
23
23
|
end
|
@@ -79,11 +79,11 @@ class TestStaticModel < Test::Unit::TestCase
|
|
79
79
|
end
|
80
80
|
|
81
81
|
should "not be equal to an instance with the same class with different ids" do
|
82
|
-
|
82
|
+
refute_equal Book[1], @book
|
83
83
|
end
|
84
84
|
|
85
85
|
should "not be equal to an instance with different classes and the same ids" do
|
86
|
-
|
86
|
+
refute_equal Book[1], Author[1]
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
@@ -209,7 +209,7 @@ class TestStaticModel < Test::Unit::TestCase
|
|
209
209
|
end
|
210
210
|
|
211
211
|
should "evaluate erb expressions at load time" do
|
212
|
-
assert_equal
|
212
|
+
assert_equal "Thu, 05 Feb 2015 00:32:43 UTC +00:00", @projects.first.created_at.to_s
|
213
213
|
end
|
214
214
|
|
215
215
|
should "evaluate erb in current context" do
|
@@ -237,7 +237,7 @@ class TestStaticModel < Test::Unit::TestCase
|
|
237
237
|
end
|
238
238
|
|
239
239
|
should "raise error if cant find record with id" do
|
240
|
-
|
240
|
+
assert_raises(StaticModel::RecordNotFound) do
|
241
241
|
@book = Book.find(1000)
|
242
242
|
end
|
243
243
|
end
|
metadata
CHANGED
@@ -1,32 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: static_model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Aaron Quint
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-03-06 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
14
|
+
name: jeweler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
19
|
+
version: '0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: appraisal
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.0.2
|
34
|
+
- - "~>"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '1.0'
|
37
|
+
type: :development
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.0.2
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '1.0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: minitest
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '5.5'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '5.5'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: mocha
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 1.1.0
|
68
|
+
- - "~>"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '1.1'
|
71
|
+
type: :development
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.1.0
|
78
|
+
- - "~>"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '1.1'
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: rubigen
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 1.5.7
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 1.5.7
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: shoulda-context
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - "~>"
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '1.2'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - "~>"
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '1.2'
|
30
109
|
description: StaticModel provides a Base class much like ActiveRecord which supports
|
31
110
|
reading from a YAML file and basic associations to ActiveRecord
|
32
111
|
email: aaron@quirkey.com
|
@@ -35,6 +114,8 @@ extensions: []
|
|
35
114
|
extra_rdoc_files:
|
36
115
|
- README.rdoc
|
37
116
|
files:
|
117
|
+
- Appraisals
|
118
|
+
- Gemfile
|
38
119
|
- History.txt
|
39
120
|
- License.txt
|
40
121
|
- README.rdoc
|
@@ -54,6 +135,7 @@ files:
|
|
54
135
|
- lib/static_model/rails.rb
|
55
136
|
- lib/static_model/scope.rb
|
56
137
|
- static_model.gemspec
|
138
|
+
- test/associations_test.rb
|
57
139
|
- test/data/authors.yml
|
58
140
|
- test/data/books.yml
|
59
141
|
- test/data/empty.yml
|
@@ -61,35 +143,33 @@ files:
|
|
61
143
|
- test/data/projects.yml
|
62
144
|
- test/data/publishers.yml
|
63
145
|
- test/data/stores.yml
|
64
|
-
- test/
|
65
|
-
- test/
|
66
|
-
- test/
|
67
|
-
- test/
|
68
|
-
- test/
|
69
|
-
- test/test_static_model_scope.rb
|
146
|
+
- test/generator_helper.rb
|
147
|
+
- test/generator_test.rb
|
148
|
+
- test/helper.rb
|
149
|
+
- test/scope_test.rb
|
150
|
+
- test/static_model_test.rb
|
70
151
|
homepage: http://github.com/quirkey/static_model
|
71
152
|
licenses: []
|
153
|
+
metadata: {}
|
72
154
|
post_install_message:
|
73
155
|
rdoc_options: []
|
74
156
|
require_paths:
|
75
157
|
- lib
|
76
158
|
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
-
none: false
|
78
159
|
requirements:
|
79
|
-
- -
|
160
|
+
- - ">="
|
80
161
|
- !ruby/object:Gem::Version
|
81
162
|
version: '0'
|
82
163
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
|
-
none: false
|
84
164
|
requirements:
|
85
|
-
- -
|
165
|
+
- - ">="
|
86
166
|
- !ruby/object:Gem::Version
|
87
167
|
version: '0'
|
88
168
|
requirements: []
|
89
169
|
rubyforge_project: quirkey
|
90
|
-
rubygems_version:
|
170
|
+
rubygems_version: 2.2.2
|
91
171
|
signing_key:
|
92
|
-
specification_version:
|
172
|
+
specification_version: 4
|
93
173
|
summary: ActiveRecord like functionalities for reading from YAML with a simple class
|
94
174
|
implementation
|
95
175
|
test_files: []
|