crumbs 2.1.2 → 4.0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +31 -41
- data/Rakefile +1 -14
- data/lib/crumbs/definitions.rb +26 -0
- data/lib/crumbs/dsl/controller.rb +7 -11
- data/lib/crumbs/dsl/namespace.rb +8 -4
- data/lib/crumbs/extensions/action_controller/base.rb +43 -0
- data/lib/crumbs/proxy.rb +10 -7
- data/lib/crumbs/railtie.rb +4 -2
- data/lib/crumbs/version.rb +1 -1
- data/lib/crumbs.rb +7 -38
- data/lib/generators/crumbs/install/install_generator.rb +15 -0
- data/test/dummy/Rakefile +1 -2
- data/test/dummy/app/assets/javascripts/application.js +2 -2
- data/test/dummy/app/assets/stylesheets/application.css +6 -4
- data/test/dummy/app/controllers/admin/reports/deliveries_controller.rb +6 -0
- data/test/dummy/app/controllers/admin/users_controller.rb +9 -0
- data/test/dummy/app/controllers/pages_controller.rb +0 -21
- data/test/dummy/app/views/application/_crumbs.html.erb +3 -0
- data/test/dummy/app/views/application/index.html.erb +1 -0
- data/test/dummy/app/views/application/show.html.erb +1 -0
- data/test/dummy/app/views/layouts/application.html.erb +9 -11
- data/test/dummy/bin/bundle +1 -0
- data/test/dummy/bin/rails +2 -1
- data/test/dummy/bin/rake +1 -0
- data/test/dummy/bin/setup +30 -0
- data/test/dummy/config/application.rb +6 -1
- data/test/dummy/config/boot.rb +1 -1
- data/test/dummy/config/crumbs.rb +15 -12
- data/test/dummy/config/environment.rb +1 -1
- data/test/dummy/config/environments/development.rb +14 -5
- data/test/dummy/config/environments/production.rb +18 -26
- data/test/dummy/config/environments/test.rb +10 -12
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/mime_types.rb +1 -2
- data/test/dummy/config/initializers/session_store.rb +1 -1
- data/test/dummy/config/locales/en.yml +1 -23
- data/test/dummy/config/routes.rb +9 -70
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config.ru +1 -1
- data/test/dummy/log/development.log +0 -0
- data/test/dummy/log/test.log +1050 -0
- data/test/dummy/public/404.html +58 -55
- data/test/dummy/public/422.html +58 -55
- data/test/dummy/public/500.html +57 -54
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/5L/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/8e/8eFn-IE_QAK9wkb3vBoqeyKxaN7o1hbJQnrz-uVvvQA.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/OI/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/RP/RPShcX3Jre4zxu1UEaxs1Tw4slXRjICXTyfQvtEWC7M.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/SG/SGNGr7AZfBE1q7ev2-YM1G-o0XAZ0pKqbsS3NvHtRcA.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/fG/fG_uaNK13wisQiji91xNsGecGxX9QhMCF2eSX_aR0G0.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/gb/gbunrAFVOHPwl2npUgKv_C3f_qiJnZDd9zG5-h3jrpo.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/hZ/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/mv/mvqN6PphkrOOC8zbUEhpC_9E_4ybdO25MRy_gG6dq3Y.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/nm/nmcUZlKAIwyJ_35Nm9P8pukLeRX5aApP6NFj5MpNPgc.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/pE/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/sB/sB6xWxBmgzVC0Co9__ANYrE58lr4WPwiwFa9mswooWM.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/va/vaNrIny9hchHD9eIJxAicyYLC7qeV4PTh4Nh40_Y6Vg.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/xd/xdBKQyhEAlDIstGvXw945PWJoEWi23rKuY7elOcWqHc.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/yv/yv8GQNKBriraHQF7esI3Zifw_OgHI0-bFlUD2nbZ3fw.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/zn/znrkcru9CbH2razkpdTQATvom11yKHllvnOQyyPSJAo.cache +0 -0
- data/test/generator_test.rb +5 -6
- data/test/test_helper.rb +4 -13
- data/test/view_test.rb +40 -0
- metadata +71 -31
- data/lib/crumbs/action_controller/base.rb +0 -47
- data/lib/generators/crumbs/install_generator.rb +0 -14
- data/lib/generators/crumbs/templates/configure.rb +0 -2
- data/test/dummy/README.rdoc +0 -28
- data/test/dummy/app/controllers/namespace/pages_controller.rb +0 -8
- data/test/dummy/app/views/pages/crumbs.html.erb +0 -3
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/initializers/secret_token.rb +0 -13
- data/test/dummy/db/schema.rb +0 -16
- data/test/with_last_test.rb +0 -553
- data/test/without_last_test.rb +0 -495
- /data/lib/generators/crumbs/{templates/define.rb → install/templates/configuration.rb} +0 -0
data/test/dummy/public/404.html
CHANGED
@@ -1,58 +1,61 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
|
-
<head>
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
<
|
53
|
-
<
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
</
|
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
|
+
div.dialog {
|
15
|
+
width: 95%;
|
16
|
+
max-width: 33em;
|
17
|
+
margin: 4em auto 0;
|
18
|
+
}
|
19
|
+
div.dialog > div {
|
20
|
+
border: 1px solid #CCC;
|
21
|
+
border-right-color: #999;
|
22
|
+
border-left-color: #999;
|
23
|
+
border-bottom-color: #BBB;
|
24
|
+
border-top: #B00100 solid 4px;
|
25
|
+
border-top-left-radius: 9px;
|
26
|
+
border-top-right-radius: 9px;
|
27
|
+
background-color: white;
|
28
|
+
padding: 7px 12% 0;
|
29
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
30
|
+
}
|
31
|
+
h1 {
|
32
|
+
font-size: 100%;
|
33
|
+
color: #730E15;
|
34
|
+
line-height: 1.5em;
|
35
|
+
}
|
36
|
+
div.dialog > p {
|
37
|
+
margin: 0 0 1em;
|
38
|
+
padding: 1em;
|
39
|
+
background-color: #F7F7F7;
|
40
|
+
border: 1px solid #CCC;
|
41
|
+
border-right-color: #999;
|
42
|
+
border-left-color: #999;
|
43
|
+
border-bottom-color: #999;
|
44
|
+
border-bottom-left-radius: 4px;
|
45
|
+
border-bottom-right-radius: 4px;
|
46
|
+
border-top-color: #DADADA;
|
47
|
+
color: #666;
|
48
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
49
|
+
}
|
50
|
+
</style>
|
51
|
+
</head>
|
52
|
+
<body>
|
53
|
+
<div class="dialog">
|
54
|
+
<div>
|
55
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
56
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
57
|
+
</div>
|
58
|
+
<p>If you are the application owner check the logs for more information.</p>
|
59
|
+
</div>
|
60
|
+
</body>
|
58
61
|
</html>
|
data/test/dummy/public/422.html
CHANGED
@@ -1,58 +1,61 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
|
-
<head>
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
<
|
53
|
-
<
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
</
|
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
|
+
div.dialog {
|
15
|
+
width: 95%;
|
16
|
+
max-width: 33em;
|
17
|
+
margin: 4em auto 0;
|
18
|
+
}
|
19
|
+
div.dialog > div {
|
20
|
+
border: 1px solid #CCC;
|
21
|
+
border-right-color: #999;
|
22
|
+
border-left-color: #999;
|
23
|
+
border-bottom-color: #BBB;
|
24
|
+
border-top: #B00100 solid 4px;
|
25
|
+
border-top-left-radius: 9px;
|
26
|
+
border-top-right-radius: 9px;
|
27
|
+
background-color: white;
|
28
|
+
padding: 7px 12% 0;
|
29
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
30
|
+
}
|
31
|
+
h1 {
|
32
|
+
font-size: 100%;
|
33
|
+
color: #730E15;
|
34
|
+
line-height: 1.5em;
|
35
|
+
}
|
36
|
+
div.dialog > p {
|
37
|
+
margin: 0 0 1em;
|
38
|
+
padding: 1em;
|
39
|
+
background-color: #F7F7F7;
|
40
|
+
border: 1px solid #CCC;
|
41
|
+
border-right-color: #999;
|
42
|
+
border-left-color: #999;
|
43
|
+
border-bottom-color: #999;
|
44
|
+
border-bottom-left-radius: 4px;
|
45
|
+
border-bottom-right-radius: 4px;
|
46
|
+
border-top-color: #DADADA;
|
47
|
+
color: #666;
|
48
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
49
|
+
}
|
50
|
+
</style>
|
51
|
+
</head>
|
52
|
+
<body>
|
53
|
+
<div class="dialog">
|
54
|
+
<div>
|
55
|
+
<h1>The change you wanted was rejected.</h1>
|
56
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
57
|
+
</div>
|
58
|
+
<p>If you are the application owner check the logs for more information.</p>
|
59
|
+
</div>
|
60
|
+
</body>
|
58
61
|
</html>
|
data/test/dummy/public/500.html
CHANGED
@@ -1,57 +1,60 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
|
-
<head>
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
<
|
53
|
-
<
|
54
|
-
|
55
|
-
|
56
|
-
</
|
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
|
+
div.dialog {
|
15
|
+
width: 95%;
|
16
|
+
max-width: 33em;
|
17
|
+
margin: 4em auto 0;
|
18
|
+
}
|
19
|
+
div.dialog > div {
|
20
|
+
border: 1px solid #CCC;
|
21
|
+
border-right-color: #999;
|
22
|
+
border-left-color: #999;
|
23
|
+
border-bottom-color: #BBB;
|
24
|
+
border-top: #B00100 solid 4px;
|
25
|
+
border-top-left-radius: 9px;
|
26
|
+
border-top-right-radius: 9px;
|
27
|
+
background-color: white;
|
28
|
+
padding: 7px 12% 0;
|
29
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
30
|
+
}
|
31
|
+
h1 {
|
32
|
+
font-size: 100%;
|
33
|
+
color: #730E15;
|
34
|
+
line-height: 1.5em;
|
35
|
+
}
|
36
|
+
div.dialog > p {
|
37
|
+
margin: 0 0 1em;
|
38
|
+
padding: 1em;
|
39
|
+
background-color: #F7F7F7;
|
40
|
+
border: 1px solid #CCC;
|
41
|
+
border-right-color: #999;
|
42
|
+
border-left-color: #999;
|
43
|
+
border-bottom-color: #999;
|
44
|
+
border-bottom-left-radius: 4px;
|
45
|
+
border-bottom-right-radius: 4px;
|
46
|
+
border-top-color: #DADADA;
|
47
|
+
color: #666;
|
48
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
49
|
+
}
|
50
|
+
</style>
|
51
|
+
</head>
|
52
|
+
<body>
|
53
|
+
<div class="dialog">
|
54
|
+
<div>
|
55
|
+
<h1>We're sorry, but something went wrong.</h1>
|
56
|
+
</div>
|
57
|
+
<p>If you are the application owner check the logs for more information.</p>
|
58
|
+
</div>
|
59
|
+
</body>
|
57
60
|
</html>
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/5L/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache
ADDED
@@ -0,0 +1,2 @@
|
|
1
|
+
[o:Set:
|
2
|
+
@hash}I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"0processors:type=text/css&file_type=text/css;TTI"9file-digest://app/assets/stylesheets/application.css;TTI">processors:type=text/css&file_type=text/css&pipeline=self;TTI")file-digest://app/assets/stylesheets;TTF
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/8e/8eFn-IE_QAK9wkb3vBoqeyKxaN7o1hbJQnrz-uVvvQA.cache
ADDED
Binary file
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/RP/RPShcX3Jre4zxu1UEaxs1Tw4slXRjICXTyfQvtEWC7M.cache
ADDED
Binary file
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/SG/SGNGr7AZfBE1q7ev2-YM1G-o0XAZ0pKqbsS3NvHtRcA.cache
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
"%�W\�yho9S���ƫ˥��)|�~���(���
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/fG/fG_uaNK13wisQiji91xNsGecGxX9QhMCF2eSX_aR0G0.cache
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
"%��Rm�v�S3.��O�L���ڹc�ƕq�=_j�
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/gb/gbunrAFVOHPwl2npUgKv_C3f_qiJnZDd9zG5-h3jrpo.cache
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
I"�app/assets/javascripts/application.js?type=application/javascript&pipeline=self&id=fb7406a6607c83aae25b06556676bd04bcbc56484336094d8bb7eace900b1350:ET
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/mv/mvqN6PphkrOOC8zbUEhpC_9E_4ybdO25MRy_gG6dq3Y.cache
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
I"}app/assets/stylesheets/application.css?type=text/css&id=70dbcfc6f7c2b9187e8392ac663ebe5754af5695030a4ce72c19f91b1502fb0a:ET
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/nm/nmcUZlKAIwyJ_35Nm9P8pukLeRX5aApP6NFj5MpNPgc.cache
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
I"�app/assets/javascripts/application.js?type=application/javascript&id=98cdceca1eacb830cbb8f7e6969cfded0fd87dc691192e679aec2d5b03611230:ET
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/pE/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache
ADDED
@@ -0,0 +1,2 @@
|
|
1
|
+
[o:Set:
|
2
|
+
@hash}I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Lprocessors:type=application/javascript&file_type=application/javascript;TTI"8file-digest://app/assets/javascripts/application.js;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI")file-digest://app/assets/javascripts;TTF
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/sB/sB6xWxBmgzVC0Co9__ANYrE58lr4WPwiwFa9mswooWM.cache
ADDED
Binary file
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/va/vaNrIny9hchHD9eIJxAicyYLC7qeV4PTh4Nh40_Y6Vg.cache
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
"%Ѱč@�����6H�uZoX�Z�gbh0W��V
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/xd/xdBKQyhEAlDIstGvXw945PWJoEWi23rKuY7elOcWqHc.cache
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
I"�app/assets/stylesheets/application.css?type=text/css&pipeline=self&id=5d6b959450d8bfaa315369603197bf83d82e5fe61784f51e0da0d5a26eebf3c8:ET
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/yv/yv8GQNKBriraHQF7esI3Zifw_OgHI0-bFlUD2nbZ3fw.cache
ADDED
Binary file
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/zn/znrkcru9CbH2razkpdTQATvom11yKHllvnOQyyPSJAo.cache
ADDED
Binary file
|
data/test/generator_test.rb
CHANGED
@@ -1,18 +1,17 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
require 'rails/generators'
|
3
|
-
require 'generators/crumbs/install_generator'
|
3
|
+
require 'generators/crumbs/install/install_generator'
|
4
4
|
|
5
|
-
class
|
6
|
-
tests Crumbs::InstallGenerator
|
5
|
+
class GeneratorTest < Rails::Generators::TestCase
|
7
6
|
destination Rails.root.join('tmp')
|
8
7
|
|
9
8
|
teardown do
|
10
|
-
FileUtils.rm_rf
|
9
|
+
FileUtils.rm_rf destination_root
|
11
10
|
end
|
12
11
|
|
13
|
-
test '
|
12
|
+
test 'install' do
|
13
|
+
self.class.tests Crumbs::Generators::InstallGenerator
|
14
14
|
run_generator
|
15
|
-
assert_file 'config/initializers/crumbs.rb'
|
16
15
|
assert_file 'config/crumbs.rb'
|
17
16
|
end
|
18
17
|
|
data/test/test_helper.rb
CHANGED
@@ -1,21 +1,12 @@
|
|
1
1
|
# Configure Rails Environment
|
2
2
|
ENV['RAILS_ENV'] = 'test'
|
3
3
|
|
4
|
-
require File.expand_path('
|
4
|
+
require File.expand_path('../../test/dummy/config/environment.rb', __FILE__)
|
5
5
|
require 'rails/test_help'
|
6
6
|
|
7
|
-
|
7
|
+
# Filter out Minitest backtrace while allowing backtrace from other libraries
|
8
|
+
# to be shown.
|
9
|
+
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
|
8
10
|
|
9
11
|
# Load support files
|
10
12
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
11
|
-
|
12
|
-
# Load fixtures from the engine
|
13
|
-
if ActiveSupport::TestCase.method_defined?(:fixture_path=)
|
14
|
-
ActiveSupport::TestCase.fixture_path = File.expand_path('../fixtures', __FILE__)
|
15
|
-
end
|
16
|
-
|
17
|
-
# Load database
|
18
|
-
config = YAML::load(File.read(File.expand_path('../dummy/config/database.yml', __FILE__)))
|
19
|
-
config['test']['adapter'] = 'jdbcsqlite3' if RUBY_PLATFORM == 'java'
|
20
|
-
ActiveRecord::Base.establish_connection(config['test'])
|
21
|
-
load(File.expand_path('../dummy/db/schema.rb', __FILE__))
|
data/test/view_test.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ViewTest < ActionDispatch::IntegrationTest
|
4
|
+
|
5
|
+
test 'links' do
|
6
|
+
get '/'
|
7
|
+
assert_equal Hash.new, session[:referers]
|
8
|
+
assert_select 'a', count: 1
|
9
|
+
assert_select 'a[href=?]', 'http://www.example.com', text: /home/, count: 1
|
10
|
+
|
11
|
+
get '/admin/users?query='
|
12
|
+
assert_equal(
|
13
|
+
{ 'http://www.example.com/admin/users' => 'query=' },
|
14
|
+
session[:referers]
|
15
|
+
)
|
16
|
+
assert_select 'a', count: 2
|
17
|
+
assert_select 'a[href=?]', 'http://www.example.com', text: /home/, count: 1
|
18
|
+
assert_select 'a[href=?]', 'http://www.example.com/admin/users?query=', text: /users/, count: 1
|
19
|
+
|
20
|
+
get '/admin/users/7'
|
21
|
+
assert_equal(
|
22
|
+
{ 'http://www.example.com/admin/users' => 'query=' },
|
23
|
+
session[:referers]
|
24
|
+
)
|
25
|
+
assert_select 'a', count: 3
|
26
|
+
assert_select 'a[href=?]', 'http://www.example.com', text: /home/, count: 1
|
27
|
+
assert_select 'a[href=?]', 'http://www.example.com/admin/users?query=', text: /users/, count: 1
|
28
|
+
assert_select 'a[href=?]', 'http://www.example.com/admin/users/7', text: /user 7/, count: 1
|
29
|
+
|
30
|
+
get '/admin/reports/deliveries'
|
31
|
+
assert_equal(
|
32
|
+
{ 'http://www.example.com/admin/users' => 'query=' },
|
33
|
+
session[:referers]
|
34
|
+
)
|
35
|
+
assert_select 'a', count: 2
|
36
|
+
assert_select 'a[href=?]', 'http://www.example.com', text: /home/, count: 1
|
37
|
+
assert_select 'a[href=?]', 'http://www.example.com/admin/reports/deliveries', text: /deliveries/, count: 1
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|