fixed_model 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +113 -0
- data/Rakefile +34 -0
- data/lib/fixed_model.rb +12 -0
- data/lib/fixed_model/base.rb +125 -0
- data/lib/fixed_model/loader.rb +41 -0
- data/lib/fixed_model/version.rb +3 -0
- data/lib/tasks/fixed_model_tasks.rake +4 -0
- data/test/compliance_test.rb +9 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/controllers/countries_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/models/country.rb +2 -0
- data/test/dummy/app/views/countries/index.html.erb +6 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +13 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/custom_directory/countries.yml +4 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +35 -0
- data/test/dummy/config/environments/production.rb +72 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/fixed_models/countries.yml +14 -0
- data/test/dummy/config/fixed_models/test/countries.yml +12 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +43 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +16 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +4 -0
- data/test/dummy/log/test.log +38475 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/-6Aexu4-9zXP7fttMrwdcp6ut5W4svYiwYaN1S11p9U.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/APhcRkuSUag3sAMrv147SiqtfM-n4sIyfNkqkP5p69M.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/AQff0XbTiXjznwSo3fs-LpH7XQV9hwLzDr7Hn6w4RQQ.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/EXAQ6pLNH4aYOxoJcmNdZAmsPZQsxPhQe8rlbRUOeos.cache +2 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/TncLlV4b8r5OvOLRIye-1hdOy8VRPZug5cZ_MA3IsHQ.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/V-KescSabX7T78JV-ihOuiwXQAAaK6TutFbWePxQF1E.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/XZgUSUY6JX5YiIG-pYsSkUr7ydqJlk8XruCemoMycV0.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/ZGNTCr85QzLaZulY-capAFXvkDEEr6N81d3bn6Iz4cA.cache +3 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/cOXTJSqqUSSZiPnW-HtRwyBPMvwE4ha2qZLSbmaxbIw.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/gBGP0GxcODm_c-aOQnAahOusWVfj-YYTkmGUAj-E6JM.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/hHaCdnnepQTM2egBk_nNjx2qtE0nJ9AoCURFgFCimW0.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/o6ueeBxouoMB3i0BojV9csF7Nv7vj-VOG_uQuI50Bsw.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/qU-CZGfXFumxCXsfIRmNyVkxQbynRnZU9MB3VCPUBOI.cache +2 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/sRGS14pPtrh56KyQ_kl9N-zL1uB9ioBkupw2fsFv5Qg.cache +3 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/uQRTceYLrl73R0pgWCxVOnYpJ45bJLISR0_4UDPlJz4.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/ySK7zTiTeC0Yma0kl-Eg7cApzKz-5tN6Y5p6ljvFAV8.cache +1 -0
- data/test/fixed_model/base_test.rb +7 -0
- data/test/fixed_model_test.rb +127 -0
- data/test/integration/navigation_test.rb +14 -0
- data/test/test_helper.rb +18 -0
- metadata +198 -0
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/404.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
62
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
63
|
+
</div>
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
65
|
+
</div>
|
66
|
+
</body>
|
67
|
+
</html>
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/422.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>The change you wanted was rejected.</h1>
|
62
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
63
|
+
</div>
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
65
|
+
</div>
|
66
|
+
</body>
|
67
|
+
</html>
|
@@ -0,0 +1,66 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/500.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>We're sorry, but something went wrong.</h1>
|
62
|
+
</div>
|
63
|
+
<p>If you are the application owner check the logs for more information.</p>
|
64
|
+
</div>
|
65
|
+
</body>
|
66
|
+
</html>
|
File without changes
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�file:///Users/mollerhoj/work/crafting_rails_apps/2/fixed_model/test/dummy/app/assets/stylesheets/application.css?type=text/css&id=63e9ec441a272c9d9af68633e0686152907a5fb21f608cf03df8377a69c03ca5:ET
|
@@ -0,0 +1 @@
|
|
1
|
+
"%Ѱč@�����6H�uZoX�Z�gbh0W��V
|
@@ -0,0 +1,2 @@
|
|
1
|
+
[o:Set:
|
2
|
+
@hash{I"environment-version:ETTI"environment-paths;TTI"Lprocessors:type=application/javascript&file_type=application/javascript;TTI"{file-digest:///Users/mollerhoj/work/crafting_rails_apps/2/fixed_model/test/dummy/app/assets/javascripts/application.js;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI"lfile-digest:///Users/mollerhoj/work/crafting_rails_apps/2/fixed_model/test/dummy/app/assets/javascripts;TT
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�file:///Users/mollerhoj/work/crafting_rails_apps/2/fixed_model/test/dummy/app/assets/javascripts/application.js?type=application/javascript&pipeline=self&id=5171969fb93fa0bf36d435ce37ba29b06023798139463ece73576cc8736abe47:ET
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�file:///Users/mollerhoj/work/crafting_rails_apps/2/fixed_model/test/dummy/app/assets/stylesheets/application.css?type=text/css&pipeline=self&id=5e4ecf95b1dc59ff715eeee2dc628300495f36194374c71504925069505e706c:ET
|
@@ -0,0 +1,3 @@
|
|
1
|
+
[o:Set:
|
2
|
+
@hash{
|
3
|
+
I"environment-version:ETTI"environment-paths;TTI">processors:type=text/css&file_type=text/css&pipeline=self;TTI"|file-digest:///Users/mollerhoj/work/crafting_rails_apps/2/fixed_model/test/dummy/app/assets/stylesheets/application.css;TTI"lfile-digest:///Users/mollerhoj/work/crafting_rails_apps/2/fixed_model/test/dummy/app/assets/stylesheets;TT
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�file:///Users/mollerhoj/work/crafting_rails_apps/2/fixed_model/test/dummy/app/assets/javascripts/application.js?type=application/javascript&id=d14bf0fc789c29ca8e680c90d913a68e4865fbbd819f9ea5f2d794a8c4fecab9:ET
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
"%��Rm�v�S3.��O�L���ڹc�ƕq�=_j�
|
Binary file
|
@@ -0,0 +1,2 @@
|
|
1
|
+
[o:Set:
|
2
|
+
@hash{I"environment-version:ETTI"environment-paths;TTI"0processors:type=text/css&file_type=text/css;TTI"|file-digest:///Users/mollerhoj/work/crafting_rails_apps/2/fixed_model/test/dummy/app/assets/stylesheets/application.css;TTI">processors:type=text/css&file_type=text/css&pipeline=self;TTI"lfile-digest:///Users/mollerhoj/work/crafting_rails_apps/2/fixed_model/test/dummy/app/assets/stylesheets;TT
|
@@ -0,0 +1,3 @@
|
|
1
|
+
[o:Set:
|
2
|
+
@hash{
|
3
|
+
I"environment-version:ETTI"environment-paths;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI"{file-digest:///Users/mollerhoj/work/crafting_rails_apps/2/fixed_model/test/dummy/app/assets/javascripts/application.js;TTI"lfile-digest:///Users/mollerhoj/work/crafting_rails_apps/2/fixed_model/test/dummy/app/assets/javascripts;TT
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
"%�W\�yho9S���ƫ˥��)|�~���(���
|
@@ -0,0 +1,127 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class FixedModelTest < ActiveSupport::TestCase
|
4
|
+
setup do
|
5
|
+
@denmark = Country.find_by_name('Denmark')
|
6
|
+
@england = Country.find_by_name('England')
|
7
|
+
end
|
8
|
+
|
9
|
+
test "#self.find" do
|
10
|
+
assert_equal @denmark, Country.find { |c| c.name == "Denmark" }
|
11
|
+
end
|
12
|
+
|
13
|
+
test "#self.first, second, thrid" do
|
14
|
+
assert_equal @england, Country.first
|
15
|
+
assert_equal @denmark, Country.second
|
16
|
+
assert_equal nil, Country.third
|
17
|
+
end
|
18
|
+
|
19
|
+
test "#self.last" do
|
20
|
+
assert_equal @denmark, Country.last
|
21
|
+
end
|
22
|
+
|
23
|
+
test "has default file_path set" do
|
24
|
+
assert_equal ['config/fixed_models'], FixedModel.file_paths
|
25
|
+
end
|
26
|
+
|
27
|
+
test "default to use environment paths" do
|
28
|
+
assert_equal true, FixedModel.use_environment_paths
|
29
|
+
end
|
30
|
+
|
31
|
+
test "con configure the use of environment paths" do
|
32
|
+
begin
|
33
|
+
FixedModel.use_environment_paths = false
|
34
|
+
Country.instance_variable_set(:@data, nil) # forces reload
|
35
|
+
assert_equal 1, Country.count
|
36
|
+
ensure
|
37
|
+
FixedModel.use_environment_paths = true
|
38
|
+
Country.instance_variable_set(:@data, nil) # forces reload
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
test "can configure file paths" do
|
43
|
+
begin
|
44
|
+
FixedModel.file_paths = ['config/custom_directory']
|
45
|
+
Country.instance_variable_set(:@data, nil) # forces reload
|
46
|
+
assert_equal "Spain", Country.first.name
|
47
|
+
ensure
|
48
|
+
FixedModel.file_paths = ['config/fixed_models']
|
49
|
+
Country.instance_variable_set(:@data, nil) # forces reload
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
test "can hold arrays" do
|
54
|
+
assert_equal @england.center, [53.562925, 1.806361]
|
55
|
+
end
|
56
|
+
|
57
|
+
test "can hold nested attributes" do
|
58
|
+
expected = {"name"=>"London", "status"=>:capital}
|
59
|
+
assert_equal expected, @england.cities[:london]
|
60
|
+
end
|
61
|
+
|
62
|
+
test "can hold symbols" do
|
63
|
+
assert_equal :capital, @england.cities[:london]['status']
|
64
|
+
end
|
65
|
+
|
66
|
+
test "fixed models has always persisted" do
|
67
|
+
assert_equal true, @denmark.persisted?
|
68
|
+
end
|
69
|
+
|
70
|
+
test "fixed models are never new" do
|
71
|
+
assert_equal false, @denmark.new_record?
|
72
|
+
end
|
73
|
+
|
74
|
+
test "#self.find_by_<attribute>" do
|
75
|
+
assert_equal @denmark, Country.find_by_capital('Copenhagen')
|
76
|
+
end
|
77
|
+
|
78
|
+
test "#self.find_by_<attribute>!" do
|
79
|
+
assert_raise FixedModel::RecordNotFound do
|
80
|
+
Country.find_by_capital!('Honolulu')
|
81
|
+
end
|
82
|
+
assert_equal @denmark, Country.find_by_capital!('Copenhagen')
|
83
|
+
end
|
84
|
+
|
85
|
+
test "#<attribute>?" do
|
86
|
+
assert_equal true, @denmark.name?
|
87
|
+
assert_equal false, @denmark.language?
|
88
|
+
end
|
89
|
+
|
90
|
+
test "#attributes" do
|
91
|
+
expected = {"name" => "Denmark", "capital" => "Copenhagen"}
|
92
|
+
assert_equal expected, @denmark.attributes
|
93
|
+
end
|
94
|
+
|
95
|
+
test "#self.all" do
|
96
|
+
assert_equal [@england, @denmark], Country.all
|
97
|
+
end
|
98
|
+
|
99
|
+
test "#self.count" do
|
100
|
+
assert_equal 2, Country.count
|
101
|
+
end
|
102
|
+
|
103
|
+
test "#self.each" do
|
104
|
+
names = []
|
105
|
+
Country.each do |country|
|
106
|
+
names << country.name
|
107
|
+
end
|
108
|
+
assert_equal ["Denmark", "England"].sort, names.sort
|
109
|
+
end
|
110
|
+
|
111
|
+
test "#attribute_names" do
|
112
|
+
assert_equal ["name", "capital"].sort, @denmark.attribute_names.sort
|
113
|
+
end
|
114
|
+
|
115
|
+
test "#self.attribute_names" do
|
116
|
+
assert_equal ["name", "center", "cities", "capital", "language"].sort, Country.attribute_names.sort
|
117
|
+
end
|
118
|
+
|
119
|
+
test "#read_attribute" do
|
120
|
+
assert_equal "Denmark", @denmark.read_attribute("name")
|
121
|
+
assert_equal nil, @denmark.read_attribute("user")
|
122
|
+
end
|
123
|
+
|
124
|
+
test "attribute readers" do
|
125
|
+
assert_equal "Denmark", @denmark.name
|
126
|
+
end
|
127
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CountriesControllerTest < ActionController::TestCase
|
2
|
+
# test "should get index" do
|
3
|
+
# get :index
|
4
|
+
# assert_response :success
|
5
|
+
# assert_not_nil assigns(:countries)
|
6
|
+
# end
|
7
|
+
|
8
|
+
# test "should get show" do
|
9
|
+
# # denmark = Country.find_by_name('Denmark') # get :show, id: denmark.id
|
10
|
+
# # raise denmark.inspect
|
11
|
+
# # assert_response :success
|
12
|
+
# # assert_not_nil assigns(:country)
|
13
|
+
# end
|
14
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# Configure Rails Environment
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
|
4
|
+
require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
|
5
|
+
require "rails/test_help"
|
6
|
+
|
7
|
+
# Filter out Minitest backtrace while allowing backtrace from other libraries
|
8
|
+
# to be shown.
|
9
|
+
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
|
10
|
+
|
11
|
+
# Load support files
|
12
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
13
|
+
|
14
|
+
# Load fixtures from the engine
|
15
|
+
if ActiveSupport::TestCase.respond_to?(:fixture_path=)
|
16
|
+
ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
|
17
|
+
ActiveSupport::TestCase.fixtures :all
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,198 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fixed_model
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jens Dahl Møllerhøj
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-07-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.2.3
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.2.3
|
27
|
+
description: Fixed Models act like ActiveRecord models, but they are immutable and
|
28
|
+
read from data files.
|
29
|
+
email:
|
30
|
+
- mollerhoj3@gmail.com
|
31
|
+
executables: []
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- MIT-LICENSE
|
36
|
+
- README.md
|
37
|
+
- Rakefile
|
38
|
+
- lib/fixed_model.rb
|
39
|
+
- lib/fixed_model/base.rb
|
40
|
+
- lib/fixed_model/loader.rb
|
41
|
+
- lib/fixed_model/version.rb
|
42
|
+
- lib/tasks/fixed_model_tasks.rake
|
43
|
+
- test/compliance_test.rb
|
44
|
+
- test/dummy/README.rdoc
|
45
|
+
- test/dummy/Rakefile
|
46
|
+
- test/dummy/app/assets/javascripts/application.js
|
47
|
+
- test/dummy/app/assets/stylesheets/application.css
|
48
|
+
- test/dummy/app/controllers/application_controller.rb
|
49
|
+
- test/dummy/app/controllers/countries_controller.rb
|
50
|
+
- test/dummy/app/helpers/application_helper.rb
|
51
|
+
- test/dummy/app/models/country.rb
|
52
|
+
- test/dummy/app/views/countries/index.html.erb
|
53
|
+
- test/dummy/app/views/layouts/application.html.erb
|
54
|
+
- test/dummy/bin/bundle
|
55
|
+
- test/dummy/bin/rails
|
56
|
+
- test/dummy/bin/rake
|
57
|
+
- test/dummy/bin/setup
|
58
|
+
- test/dummy/config.ru
|
59
|
+
- test/dummy/config/application.rb
|
60
|
+
- test/dummy/config/boot.rb
|
61
|
+
- test/dummy/config/custom_directory/countries.yml
|
62
|
+
- test/dummy/config/environment.rb
|
63
|
+
- test/dummy/config/environments/development.rb
|
64
|
+
- test/dummy/config/environments/production.rb
|
65
|
+
- test/dummy/config/environments/test.rb
|
66
|
+
- test/dummy/config/fixed_models/countries.yml
|
67
|
+
- test/dummy/config/fixed_models/test/countries.yml
|
68
|
+
- test/dummy/config/initializers/assets.rb
|
69
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
70
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
71
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
72
|
+
- test/dummy/config/initializers/inflections.rb
|
73
|
+
- test/dummy/config/initializers/mime_types.rb
|
74
|
+
- test/dummy/config/initializers/session_store.rb
|
75
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
76
|
+
- test/dummy/config/locales/en.yml
|
77
|
+
- test/dummy/config/routes.rb
|
78
|
+
- test/dummy/config/secrets.yml
|
79
|
+
- test/dummy/db/development.sqlite3
|
80
|
+
- test/dummy/db/schema.rb
|
81
|
+
- test/dummy/db/test.sqlite3
|
82
|
+
- test/dummy/log/development.log
|
83
|
+
- test/dummy/log/test.log
|
84
|
+
- test/dummy/public/404.html
|
85
|
+
- test/dummy/public/422.html
|
86
|
+
- test/dummy/public/500.html
|
87
|
+
- test/dummy/public/favicon.ico
|
88
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/-6Aexu4-9zXP7fttMrwdcp6ut5W4svYiwYaN1S11p9U.cache
|
89
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/APhcRkuSUag3sAMrv147SiqtfM-n4sIyfNkqkP5p69M.cache
|
90
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/AQff0XbTiXjznwSo3fs-LpH7XQV9hwLzDr7Hn6w4RQQ.cache
|
91
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/EXAQ6pLNH4aYOxoJcmNdZAmsPZQsxPhQe8rlbRUOeos.cache
|
92
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/TncLlV4b8r5OvOLRIye-1hdOy8VRPZug5cZ_MA3IsHQ.cache
|
93
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/V-KescSabX7T78JV-ihOuiwXQAAaK6TutFbWePxQF1E.cache
|
94
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/XZgUSUY6JX5YiIG-pYsSkUr7ydqJlk8XruCemoMycV0.cache
|
95
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/ZGNTCr85QzLaZulY-capAFXvkDEEr6N81d3bn6Iz4cA.cache
|
96
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/cOXTJSqqUSSZiPnW-HtRwyBPMvwE4ha2qZLSbmaxbIw.cache
|
97
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/gBGP0GxcODm_c-aOQnAahOusWVfj-YYTkmGUAj-E6JM.cache
|
98
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/hHaCdnnepQTM2egBk_nNjx2qtE0nJ9AoCURFgFCimW0.cache
|
99
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/o6ueeBxouoMB3i0BojV9csF7Nv7vj-VOG_uQuI50Bsw.cache
|
100
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/qU-CZGfXFumxCXsfIRmNyVkxQbynRnZU9MB3VCPUBOI.cache
|
101
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/sRGS14pPtrh56KyQ_kl9N-zL1uB9ioBkupw2fsFv5Qg.cache
|
102
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/uQRTceYLrl73R0pgWCxVOnYpJ45bJLISR0_4UDPlJz4.cache
|
103
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/ySK7zTiTeC0Yma0kl-Eg7cApzKz-5tN6Y5p6ljvFAV8.cache
|
104
|
+
- test/fixed_model/base_test.rb
|
105
|
+
- test/fixed_model_test.rb
|
106
|
+
- test/integration/navigation_test.rb
|
107
|
+
- test/test_helper.rb
|
108
|
+
homepage: https://github.com/mollerhoj/
|
109
|
+
licenses:
|
110
|
+
- MIT
|
111
|
+
metadata: {}
|
112
|
+
post_install_message:
|
113
|
+
rdoc_options: []
|
114
|
+
require_paths:
|
115
|
+
- lib
|
116
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
requirements: []
|
127
|
+
rubyforge_project:
|
128
|
+
rubygems_version: 2.2.2
|
129
|
+
signing_key:
|
130
|
+
specification_version: 4
|
131
|
+
summary: Fixed Models act like ActiveRecord models, but they are immutable and read
|
132
|
+
from data files.
|
133
|
+
test_files:
|
134
|
+
- test/compliance_test.rb
|
135
|
+
- test/dummy/app/assets/javascripts/application.js
|
136
|
+
- test/dummy/app/assets/stylesheets/application.css
|
137
|
+
- test/dummy/app/controllers/application_controller.rb
|
138
|
+
- test/dummy/app/controllers/countries_controller.rb
|
139
|
+
- test/dummy/app/helpers/application_helper.rb
|
140
|
+
- test/dummy/app/models/country.rb
|
141
|
+
- test/dummy/app/views/countries/index.html.erb
|
142
|
+
- test/dummy/app/views/layouts/application.html.erb
|
143
|
+
- test/dummy/bin/bundle
|
144
|
+
- test/dummy/bin/rails
|
145
|
+
- test/dummy/bin/rake
|
146
|
+
- test/dummy/bin/setup
|
147
|
+
- test/dummy/config/application.rb
|
148
|
+
- test/dummy/config/boot.rb
|
149
|
+
- test/dummy/config/custom_directory/countries.yml
|
150
|
+
- test/dummy/config/environment.rb
|
151
|
+
- test/dummy/config/environments/development.rb
|
152
|
+
- test/dummy/config/environments/production.rb
|
153
|
+
- test/dummy/config/environments/test.rb
|
154
|
+
- test/dummy/config/fixed_models/countries.yml
|
155
|
+
- test/dummy/config/fixed_models/test/countries.yml
|
156
|
+
- test/dummy/config/initializers/assets.rb
|
157
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
158
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
159
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
160
|
+
- test/dummy/config/initializers/inflections.rb
|
161
|
+
- test/dummy/config/initializers/mime_types.rb
|
162
|
+
- test/dummy/config/initializers/session_store.rb
|
163
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
164
|
+
- test/dummy/config/locales/en.yml
|
165
|
+
- test/dummy/config/routes.rb
|
166
|
+
- test/dummy/config/secrets.yml
|
167
|
+
- test/dummy/config.ru
|
168
|
+
- test/dummy/db/development.sqlite3
|
169
|
+
- test/dummy/db/schema.rb
|
170
|
+
- test/dummy/db/test.sqlite3
|
171
|
+
- test/dummy/log/development.log
|
172
|
+
- test/dummy/log/test.log
|
173
|
+
- test/dummy/public/404.html
|
174
|
+
- test/dummy/public/422.html
|
175
|
+
- test/dummy/public/500.html
|
176
|
+
- test/dummy/public/favicon.ico
|
177
|
+
- test/dummy/Rakefile
|
178
|
+
- test/dummy/README.rdoc
|
179
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/-6Aexu4-9zXP7fttMrwdcp6ut5W4svYiwYaN1S11p9U.cache
|
180
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/APhcRkuSUag3sAMrv147SiqtfM-n4sIyfNkqkP5p69M.cache
|
181
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/AQff0XbTiXjznwSo3fs-LpH7XQV9hwLzDr7Hn6w4RQQ.cache
|
182
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/cOXTJSqqUSSZiPnW-HtRwyBPMvwE4ha2qZLSbmaxbIw.cache
|
183
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/EXAQ6pLNH4aYOxoJcmNdZAmsPZQsxPhQe8rlbRUOeos.cache
|
184
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/gBGP0GxcODm_c-aOQnAahOusWVfj-YYTkmGUAj-E6JM.cache
|
185
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/hHaCdnnepQTM2egBk_nNjx2qtE0nJ9AoCURFgFCimW0.cache
|
186
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/o6ueeBxouoMB3i0BojV9csF7Nv7vj-VOG_uQuI50Bsw.cache
|
187
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/qU-CZGfXFumxCXsfIRmNyVkxQbynRnZU9MB3VCPUBOI.cache
|
188
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/sRGS14pPtrh56KyQ_kl9N-zL1uB9ioBkupw2fsFv5Qg.cache
|
189
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/TncLlV4b8r5OvOLRIye-1hdOy8VRPZug5cZ_MA3IsHQ.cache
|
190
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/uQRTceYLrl73R0pgWCxVOnYpJ45bJLISR0_4UDPlJz4.cache
|
191
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/V-KescSabX7T78JV-ihOuiwXQAAaK6TutFbWePxQF1E.cache
|
192
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/XZgUSUY6JX5YiIG-pYsSkUr7ydqJlk8XruCemoMycV0.cache
|
193
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/ySK7zTiTeC0Yma0kl-Eg7cApzKz-5tN6Y5p6ljvFAV8.cache
|
194
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/ZGNTCr85QzLaZulY-capAFXvkDEEr6N81d3bn6Iz4cA.cache
|
195
|
+
- test/fixed_model/base_test.rb
|
196
|
+
- test/fixed_model_test.rb
|
197
|
+
- test/integration/navigation_test.rb
|
198
|
+
- test/test_helper.rb
|