okuribito_rails 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -12
- data/Rakefile +6 -23
- data/app/controllers/okuribito_rails/application_controller.rb +1 -0
- data/app/controllers/okuribito_rails/method_call_situations_controller.rb +4 -1
- data/app/models/okuribito_rails/method_call_log.rb +4 -0
- data/app/models/okuribito_rails/method_call_situation.rb +7 -0
- data/lib/generators/okuribito_rails/install_generator.rb +9 -10
- data/lib/generators/okuribito_rails/templates/initializer.erb +1 -1
- data/lib/okuribito_rails/config.rb +1 -1
- data/lib/okuribito_rails/observe_method.rb +4 -2
- data/lib/okuribito_rails/railtie.rb +8 -6
- data/lib/okuribito_rails/version.rb +1 -1
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/config/manifest.js +5 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/javascripts/cable.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
- data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/jobs/application_job.rb +2 -0
- data/spec/dummy/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +34 -0
- data/spec/dummy/bin/update +29 -0
- data/spec/dummy/config/application.rb +23 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/cable.yml +9 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +54 -0
- data/spec/dummy/config/environments/production.rb +86 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +6 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/new_framework_defaults.rb +24 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/puma.rb +47 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/config/spring.rb +6 -0
- data/spec/dummy/config.ru +5 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/schema.rb +38 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +5 -0
- data/spec/dummy/log/test.log +2049 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/factories.rb +14 -0
- data/spec/models/method_call_log_spec.rb +93 -0
- data/spec/models/method_call_situation_spec.rb +114 -0
- data/spec/spec_helper.rb +14 -0
- metadata +211 -26
@@ -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
|
File without changes
|
File without changes
|
data/spec/factories.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :method_call_situation, class: OkuribitoRails::MethodCallSituation do
|
3
|
+
class_name "User"
|
4
|
+
method_symbol "."
|
5
|
+
method_name "feed"
|
6
|
+
called_num 0
|
7
|
+
end
|
8
|
+
|
9
|
+
factory :method_call_log, class: OkuribitoRails::MethodCallLog do
|
10
|
+
class_name "User"
|
11
|
+
method_symbol "."
|
12
|
+
method_name "feed"
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe OkuribitoRails::MethodCallLog do
|
4
|
+
let(:method_call_situation) { FactoryGirl.create(:method_call_situation) }
|
5
|
+
let(:method_call_log) do
|
6
|
+
FactoryGirl.build(:method_call_log,
|
7
|
+
method_call_situation: method_call_situation,
|
8
|
+
class_name: class_name,
|
9
|
+
method_symbol: method_symbol,
|
10
|
+
method_name: method_name)
|
11
|
+
end
|
12
|
+
let(:class_name) { "User" }
|
13
|
+
let(:method_symbol) { "." }
|
14
|
+
let(:method_name) { "feed" }
|
15
|
+
|
16
|
+
subject { method_call_log }
|
17
|
+
|
18
|
+
describe "must have a MethodCallSituation" do
|
19
|
+
let(:method_call_log) { FactoryGirl.build :method_call_log, method_call_situation: nil }
|
20
|
+
it { is_expected.not_to be_valid }
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "valid class_name" do
|
24
|
+
it { is_expected.to be_valid }
|
25
|
+
|
26
|
+
context "with valid long name" do
|
27
|
+
let(:class_name) { "a" * 255 }
|
28
|
+
it { is_expected.to be_valid }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "invalid class_name" do
|
33
|
+
context "must have a name" do
|
34
|
+
let(:class_name) { nil }
|
35
|
+
it { is_expected.not_to be_valid }
|
36
|
+
end
|
37
|
+
|
38
|
+
context "with no name" do
|
39
|
+
let(:class_name) { "" }
|
40
|
+
it { is_expected.not_to be_valid }
|
41
|
+
end
|
42
|
+
|
43
|
+
context "with too long name" do
|
44
|
+
let(:class_name) { "a" * 256 }
|
45
|
+
it { is_expected.not_to be_valid }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "valid method_symbol" do
|
50
|
+
context "with valid symbol '.'" do
|
51
|
+
let(:method_symbol) { "." }
|
52
|
+
it { is_expected.to be_valid }
|
53
|
+
end
|
54
|
+
|
55
|
+
context "with valid symbol '#'" do
|
56
|
+
let(:method_symbol) { "#" }
|
57
|
+
it { is_expected.to be_valid }
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "invalid method_symbol" do
|
62
|
+
context "with invalid symbol '$'" do
|
63
|
+
let(:method_symbol) { "$" }
|
64
|
+
it { is_expected.not_to be_valid }
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe "valid method_name" do
|
69
|
+
it { is_expected.to be_valid }
|
70
|
+
|
71
|
+
context "with valid long name" do
|
72
|
+
let(:method_name) { "a" * 255 }
|
73
|
+
it { is_expected.to be_valid }
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe "invalid method_name" do
|
78
|
+
context "must have a name" do
|
79
|
+
let(:method_name) { nil }
|
80
|
+
it { is_expected.not_to be_valid }
|
81
|
+
end
|
82
|
+
|
83
|
+
context "with no name" do
|
84
|
+
let(:method_name) { "" }
|
85
|
+
it { is_expected.not_to be_valid }
|
86
|
+
end
|
87
|
+
|
88
|
+
context "with too long name" do
|
89
|
+
let(:method_name) { "a" * 256 }
|
90
|
+
it { is_expected.not_to be_valid }
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe OkuribitoRails::MethodCallSituation do
|
4
|
+
let(:method_call_situation) do
|
5
|
+
FactoryGirl.build(:method_call_situation,
|
6
|
+
class_name: class_name,
|
7
|
+
method_symbol: method_symbol,
|
8
|
+
method_name: method_name,
|
9
|
+
called_num: called_num)
|
10
|
+
end
|
11
|
+
let(:class_name) { "User" }
|
12
|
+
let(:method_symbol) { "." }
|
13
|
+
let(:method_name) { "feed" }
|
14
|
+
let(:called_num) { 0 }
|
15
|
+
|
16
|
+
subject { method_call_situation }
|
17
|
+
|
18
|
+
describe "valid class_name" do
|
19
|
+
it { is_expected.to be_valid }
|
20
|
+
|
21
|
+
context "with valid long name" do
|
22
|
+
let(:class_name) { "a" * 255 }
|
23
|
+
it { is_expected.to be_valid }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "invalid class_name" do
|
28
|
+
context "must have a name" do
|
29
|
+
let(:class_name) { nil }
|
30
|
+
it { is_expected.not_to be_valid }
|
31
|
+
end
|
32
|
+
|
33
|
+
context "with no name" do
|
34
|
+
let(:class_name) { "" }
|
35
|
+
it { is_expected.not_to be_valid }
|
36
|
+
end
|
37
|
+
|
38
|
+
context "with too long name" do
|
39
|
+
let(:class_name) { "a" * 256 }
|
40
|
+
it { is_expected.not_to be_valid }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "valid method_symbol" do
|
45
|
+
context "with valid symbol '.'" do
|
46
|
+
let(:method_symbol) { "." }
|
47
|
+
it { is_expected.to be_valid }
|
48
|
+
end
|
49
|
+
|
50
|
+
context "with valid symbol '#'" do
|
51
|
+
let(:method_symbol) { "#" }
|
52
|
+
it { is_expected.to be_valid }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe "invalid method_symbol" do
|
57
|
+
context "with invalid symbol '$'" do
|
58
|
+
let(:method_symbol) { "$" }
|
59
|
+
it { is_expected.not_to be_valid }
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe "valid method_name" do
|
64
|
+
it { is_expected.to be_valid }
|
65
|
+
|
66
|
+
context "with valid long name" do
|
67
|
+
let(:method_name) { "a" * 255 }
|
68
|
+
it { is_expected.to be_valid }
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe "invalid method_name" do
|
73
|
+
context "must have a name" do
|
74
|
+
let(:method_name) { nil }
|
75
|
+
it { is_expected.not_to be_valid }
|
76
|
+
end
|
77
|
+
|
78
|
+
context "with no name" do
|
79
|
+
let(:method_name) { "" }
|
80
|
+
it { is_expected.not_to be_valid }
|
81
|
+
end
|
82
|
+
|
83
|
+
context "with too long name" do
|
84
|
+
let(:method_name) { "a" * 256 }
|
85
|
+
it { is_expected.not_to be_valid }
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe "valid called_num" do
|
90
|
+
it { is_expected.to be_valid }
|
91
|
+
|
92
|
+
context "with valid large number" do
|
93
|
+
let(:called_num) { 9999 }
|
94
|
+
it { is_expected.to be_valid }
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
describe "invalid called_num" do
|
99
|
+
context "must have a value" do
|
100
|
+
let(:called_num) { nil }
|
101
|
+
it { is_expected.not_to be_valid }
|
102
|
+
end
|
103
|
+
|
104
|
+
context "with string" do
|
105
|
+
let(:called_num) { "a" }
|
106
|
+
it { is_expected.not_to be_valid }
|
107
|
+
end
|
108
|
+
|
109
|
+
context "with too large number" do
|
110
|
+
let(:called_num) { 10_000 }
|
111
|
+
it { is_expected.not_to be_valid }
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require "simplecov"
|
2
|
+
|
3
|
+
SimpleCov.start do
|
4
|
+
add_filter "/vendor/"
|
5
|
+
add_filter "/spec/"
|
6
|
+
end
|
7
|
+
|
8
|
+
# Configure Rails Envinronment
|
9
|
+
ENV["RAILS_ENV"] = "test"
|
10
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
11
|
+
|
12
|
+
require "rspec/rails"
|
13
|
+
require "factory_girl"
|
14
|
+
require "factories"
|