models_timeline 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.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +32 -0
- data/Rakefile +40 -0
- data/app/assets/javascripts/timeline/application.js +15 -0
- data/app/assets/javascripts/timeline/tracks.js +2 -0
- data/app/assets/stylesheets/scaffold.css +56 -0
- data/app/assets/stylesheets/timeline/application.css +13 -0
- data/app/assets/stylesheets/timeline/tracks.css +4 -0
- data/app/controllers/timeline/application_controller.rb +4 -0
- data/app/controllers/timeline/tracks_controller.rb +23 -0
- data/app/helpers/timeline/application_helper.rb +4 -0
- data/app/helpers/timeline/tracks_helper.rb +4 -0
- data/app/models/timeline/track.rb +7 -0
- data/app/views/layouts/timeline/application.html.erb +14 -0
- data/app/views/timeline/tracks/_track.erb +10 -0
- data/app/views/timeline/tracks/index.html.erb +5 -0
- data/app/views/timeline/tracks/show.html.erb +25 -0
- data/config/routes.rb +3 -0
- data/db/migrate/20121227092029_create_timeline_tracks.rb +14 -0
- data/lib/tasks/timeline_tasks.rake +4 -0
- data/lib/timeline/engine.rb +9 -0
- data/lib/timeline/model_additions.rb +60 -0
- data/lib/timeline/railtie.rb +9 -0
- data/lib/timeline/version.rb +3 -0
- data/lib/timeline.rb +3 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/models/project.rb +3 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config/application.rb +59 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/migrate/20121227094706_create_projects.rb +11 -0
- data/test/dummy/db/schema.rb +36 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/test/fixtures/projects.yml +11 -0
- data/test/dummy/test/models/project_test.rb +7 -0
- data/test/fixtures/timeline/tracks.yml +13 -0
- data/test/functional/timeline/tracks_controller_test.rb +22 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/model/helpers/timeline/timelines_helper_test.rb +6 -0
- data/test/model/helpers/tracks_helper_test.rb +6 -0
- data/test/model/timeline/track_test.rb +92 -0
- data/test/test_helper.rb +15 -0
- data/test/timeline_test.rb +7 -0
- metadata +200 -0
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'debugger'
|
3
|
+
module Timeline
|
4
|
+
class TrackTest < ActiveSupport::TestCase
|
5
|
+
self.use_transactional_fixtures = true
|
6
|
+
|
7
|
+
setup do
|
8
|
+
Track.destroy_all
|
9
|
+
end
|
10
|
+
|
11
|
+
def attr
|
12
|
+
{name: 'angelo', days: 2, done: true}
|
13
|
+
end
|
14
|
+
|
15
|
+
def new_project
|
16
|
+
Project.create!(attr)
|
17
|
+
end
|
18
|
+
|
19
|
+
test "test model addition" do
|
20
|
+
assert_kind_of Class, Project
|
21
|
+
assert_respond_to Project, :timeline
|
22
|
+
assert_respond_to Project, :timeline, {}
|
23
|
+
end
|
24
|
+
|
25
|
+
test "track all model attributes" do
|
26
|
+
Project.timeline
|
27
|
+
project = new_project
|
28
|
+
|
29
|
+
track = Track.first
|
30
|
+
assert_equal Track.all.count, 1
|
31
|
+
assert_equal track.model_name, 'Project'
|
32
|
+
#test if all attributes are correctly stored
|
33
|
+
attr.each_key do |k|
|
34
|
+
assert_equal track.model_changes[k], [nil, attr[k]]
|
35
|
+
end
|
36
|
+
|
37
|
+
#update
|
38
|
+
project.update_attributes({name: 'pippo'})
|
39
|
+
track = Track.first
|
40
|
+
assert_equal Track.all.count, 2
|
41
|
+
assert_equal track.model_name, 'Project'
|
42
|
+
assert_equal track.action, 'updated'
|
43
|
+
#test track added on update
|
44
|
+
assert_equal track.model_changes.size, 1
|
45
|
+
debugger
|
46
|
+
assert_equal track.model_changes[:name], ['angelo','pippo']
|
47
|
+
|
48
|
+
#destroy
|
49
|
+
project.destroy
|
50
|
+
track = Track.first
|
51
|
+
assert_equal Track.all.count, 3
|
52
|
+
assert_equal track.model_name, 'Project'
|
53
|
+
assert_equal track.action, 'destroyed'
|
54
|
+
#test track added on update
|
55
|
+
assert_equal track.model_changes.size, 0
|
56
|
+
end
|
57
|
+
|
58
|
+
test "track all some attributes" do
|
59
|
+
Project.reset_callbacks :create
|
60
|
+
Project.reset_callbacks :update
|
61
|
+
|
62
|
+
Project.timeline(:name,:days)
|
63
|
+
|
64
|
+
project = Project.create!({name: 'angelo', days: 2, done: true})
|
65
|
+
assert_equal Project.all.count, 1
|
66
|
+
track = Track.first
|
67
|
+
assert_equal track.model_name, 'Project'
|
68
|
+
#test if all attributes are correctly stored
|
69
|
+
[:name, :days].each do |k|
|
70
|
+
assert_equal track.model_changes[k], [nil, attr[k]]
|
71
|
+
end
|
72
|
+
|
73
|
+
#update
|
74
|
+
project.update_attributes({name: 'tom', days: 4})
|
75
|
+
track = Track.first
|
76
|
+
assert_equal track.model_name, 'Project'
|
77
|
+
assert_equal track.action, 'updated'
|
78
|
+
#test track added on update
|
79
|
+
assert_equal track.model_changes.size, 2
|
80
|
+
assert_equal track.model_changes[:name], ['angelo','tom']
|
81
|
+
assert_equal track.model_changes[:days], [2,4]
|
82
|
+
|
83
|
+
#destroy
|
84
|
+
project.destroy
|
85
|
+
track = Track.first
|
86
|
+
assert_equal track.model_name, 'Project'
|
87
|
+
assert_equal track.action, 'destroyed'
|
88
|
+
#test track added on update
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# Configure Rails Environment
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
|
4
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
5
|
+
require "rails/test_help"
|
6
|
+
|
7
|
+
Rails.backtrace_cleaner.remove_silencers!
|
8
|
+
|
9
|
+
# Load support files
|
10
|
+
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
|
metadata
ADDED
@@ -0,0 +1,200 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: models_timeline
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Angelo Capilleri
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-12-28 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.2.9
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.2.9
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: debugger
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: sqlite3
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: ! 'Allow to create a timeline of your crud operations '
|
63
|
+
email:
|
64
|
+
- capilleri@yahoo.com
|
65
|
+
executables: []
|
66
|
+
extensions: []
|
67
|
+
extra_rdoc_files: []
|
68
|
+
files:
|
69
|
+
- app/assets/javascripts/timeline/application.js
|
70
|
+
- app/assets/javascripts/timeline/tracks.js
|
71
|
+
- app/assets/stylesheets/scaffold.css
|
72
|
+
- app/assets/stylesheets/timeline/application.css
|
73
|
+
- app/assets/stylesheets/timeline/tracks.css
|
74
|
+
- app/controllers/timeline/application_controller.rb
|
75
|
+
- app/controllers/timeline/tracks_controller.rb
|
76
|
+
- app/helpers/timeline/application_helper.rb
|
77
|
+
- app/helpers/timeline/tracks_helper.rb
|
78
|
+
- app/models/timeline/track.rb
|
79
|
+
- app/views/layouts/timeline/application.html.erb
|
80
|
+
- app/views/timeline/tracks/_track.erb
|
81
|
+
- app/views/timeline/tracks/index.html.erb
|
82
|
+
- app/views/timeline/tracks/show.html.erb
|
83
|
+
- config/routes.rb
|
84
|
+
- db/migrate/20121227092029_create_timeline_tracks.rb
|
85
|
+
- lib/tasks/timeline_tasks.rake
|
86
|
+
- lib/timeline/engine.rb
|
87
|
+
- lib/timeline/model_additions.rb
|
88
|
+
- lib/timeline/railtie.rb
|
89
|
+
- lib/timeline/version.rb
|
90
|
+
- lib/timeline.rb
|
91
|
+
- MIT-LICENSE
|
92
|
+
- Rakefile
|
93
|
+
- README.rdoc
|
94
|
+
- test/dummy/app/assets/javascripts/application.js
|
95
|
+
- test/dummy/app/assets/stylesheets/application.css
|
96
|
+
- test/dummy/app/controllers/application_controller.rb
|
97
|
+
- test/dummy/app/helpers/application_helper.rb
|
98
|
+
- test/dummy/app/models/project.rb
|
99
|
+
- test/dummy/app/views/layouts/application.html.erb
|
100
|
+
- test/dummy/config/application.rb
|
101
|
+
- test/dummy/config/boot.rb
|
102
|
+
- test/dummy/config/database.yml
|
103
|
+
- test/dummy/config/environment.rb
|
104
|
+
- test/dummy/config/environments/development.rb
|
105
|
+
- test/dummy/config/environments/production.rb
|
106
|
+
- test/dummy/config/environments/test.rb
|
107
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
108
|
+
- test/dummy/config/initializers/inflections.rb
|
109
|
+
- test/dummy/config/initializers/mime_types.rb
|
110
|
+
- test/dummy/config/initializers/secret_token.rb
|
111
|
+
- test/dummy/config/initializers/session_store.rb
|
112
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
113
|
+
- test/dummy/config/locales/en.yml
|
114
|
+
- test/dummy/config/routes.rb
|
115
|
+
- test/dummy/config.ru
|
116
|
+
- test/dummy/db/migrate/20121227094706_create_projects.rb
|
117
|
+
- test/dummy/db/schema.rb
|
118
|
+
- test/dummy/public/404.html
|
119
|
+
- test/dummy/public/422.html
|
120
|
+
- test/dummy/public/500.html
|
121
|
+
- test/dummy/public/favicon.ico
|
122
|
+
- test/dummy/Rakefile
|
123
|
+
- test/dummy/README.rdoc
|
124
|
+
- test/dummy/script/rails
|
125
|
+
- test/dummy/test/fixtures/projects.yml
|
126
|
+
- test/dummy/test/models/project_test.rb
|
127
|
+
- test/fixtures/timeline/tracks.yml
|
128
|
+
- test/functional/timeline/tracks_controller_test.rb
|
129
|
+
- test/integration/navigation_test.rb
|
130
|
+
- test/model/helpers/timeline/timelines_helper_test.rb
|
131
|
+
- test/model/helpers/tracks_helper_test.rb
|
132
|
+
- test/model/timeline/track_test.rb
|
133
|
+
- test/test_helper.rb
|
134
|
+
- test/timeline_test.rb
|
135
|
+
homepage: https://github.com/acapilleri/timeline
|
136
|
+
licenses: []
|
137
|
+
post_install_message:
|
138
|
+
rdoc_options: []
|
139
|
+
require_paths:
|
140
|
+
- lib
|
141
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
142
|
+
none: false
|
143
|
+
requirements:
|
144
|
+
- - ! '>='
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
|
+
none: false
|
149
|
+
requirements:
|
150
|
+
- - ! '>='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
requirements: []
|
154
|
+
rubyforge_project:
|
155
|
+
rubygems_version: 1.8.24
|
156
|
+
signing_key:
|
157
|
+
specification_version: 3
|
158
|
+
summary: Timeline of you model objects
|
159
|
+
test_files:
|
160
|
+
- test/dummy/app/assets/javascripts/application.js
|
161
|
+
- test/dummy/app/assets/stylesheets/application.css
|
162
|
+
- test/dummy/app/controllers/application_controller.rb
|
163
|
+
- test/dummy/app/helpers/application_helper.rb
|
164
|
+
- test/dummy/app/models/project.rb
|
165
|
+
- test/dummy/app/views/layouts/application.html.erb
|
166
|
+
- test/dummy/config/application.rb
|
167
|
+
- test/dummy/config/boot.rb
|
168
|
+
- test/dummy/config/database.yml
|
169
|
+
- test/dummy/config/environment.rb
|
170
|
+
- test/dummy/config/environments/development.rb
|
171
|
+
- test/dummy/config/environments/production.rb
|
172
|
+
- test/dummy/config/environments/test.rb
|
173
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
174
|
+
- test/dummy/config/initializers/inflections.rb
|
175
|
+
- test/dummy/config/initializers/mime_types.rb
|
176
|
+
- test/dummy/config/initializers/secret_token.rb
|
177
|
+
- test/dummy/config/initializers/session_store.rb
|
178
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
179
|
+
- test/dummy/config/locales/en.yml
|
180
|
+
- test/dummy/config/routes.rb
|
181
|
+
- test/dummy/config.ru
|
182
|
+
- test/dummy/db/migrate/20121227094706_create_projects.rb
|
183
|
+
- test/dummy/db/schema.rb
|
184
|
+
- test/dummy/public/404.html
|
185
|
+
- test/dummy/public/422.html
|
186
|
+
- test/dummy/public/500.html
|
187
|
+
- test/dummy/public/favicon.ico
|
188
|
+
- test/dummy/Rakefile
|
189
|
+
- test/dummy/README.rdoc
|
190
|
+
- test/dummy/script/rails
|
191
|
+
- test/dummy/test/fixtures/projects.yml
|
192
|
+
- test/dummy/test/models/project_test.rb
|
193
|
+
- test/fixtures/timeline/tracks.yml
|
194
|
+
- test/functional/timeline/tracks_controller_test.rb
|
195
|
+
- test/integration/navigation_test.rb
|
196
|
+
- test/model/helpers/timeline/timelines_helper_test.rb
|
197
|
+
- test/model/helpers/tracks_helper_test.rb
|
198
|
+
- test/model/timeline/track_test.rb
|
199
|
+
- test/test_helper.rb
|
200
|
+
- test/timeline_test.rb
|