timecop-console 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/Gemfile +3 -0
  2. data/README.rdoc +29 -26
  3. data/Rakefile +15 -0
  4. data/app/controllers/timecop_console/main_controller.rb +39 -0
  5. data/config/routes.rb +4 -0
  6. data/lib/timecop_console/controller_methods.rb +34 -0
  7. data/lib/timecop_console/engine.rb +9 -0
  8. data/lib/timecop_console/version.rb +17 -0
  9. data/lib/timecop_console.rb +6 -5
  10. data/spec/controllers/main_controller_spec.rb +33 -0
  11. data/spec/controllers/sample_controller_spec.rb +33 -0
  12. data/spec/dummy_app/Gemfile +5 -0
  13. data/spec/dummy_app/Gemfile.lock +93 -0
  14. data/spec/dummy_app/README.rdoc +261 -0
  15. data/spec/dummy_app/Rakefile +7 -0
  16. data/spec/dummy_app/app/assets/images/rails.png +0 -0
  17. data/spec/dummy_app/app/assets/javascripts/application.js +13 -0
  18. data/spec/dummy_app/app/assets/stylesheets/application.css +13 -0
  19. data/spec/dummy_app/app/controllers/application_controller.rb +3 -0
  20. data/spec/dummy_app/app/controllers/sample_controller.rb +2 -0
  21. data/spec/dummy_app/app/helpers/application_helper.rb +2 -0
  22. data/spec/dummy_app/app/views/layouts/application.html.erb +14 -0
  23. data/spec/dummy_app/config/application.rb +65 -0
  24. data/spec/dummy_app/config/boot.rb +6 -0
  25. data/spec/dummy_app/config/environment.rb +5 -0
  26. data/spec/dummy_app/config/environments/development.rb +26 -0
  27. data/spec/dummy_app/config/environments/production.rb +51 -0
  28. data/spec/dummy_app/config/environments/test.rb +35 -0
  29. data/spec/dummy_app/config/initializers/backtrace_silencers.rb +7 -0
  30. data/spec/dummy_app/config/initializers/inflections.rb +15 -0
  31. data/spec/dummy_app/config/initializers/mime_types.rb +5 -0
  32. data/spec/dummy_app/config/initializers/secret_token.rb +7 -0
  33. data/spec/dummy_app/config/initializers/session_store.rb +8 -0
  34. data/spec/dummy_app/config/initializers/wrap_parameters.rb +10 -0
  35. data/spec/dummy_app/config/locales/en.yml +5 -0
  36. data/spec/dummy_app/config/routes.rb +3 -0
  37. data/spec/dummy_app/config.ru +4 -0
  38. data/spec/dummy_app/db/seeds.rb +7 -0
  39. data/spec/dummy_app/doc/README_FOR_APP +2 -0
  40. data/spec/dummy_app/log/development.log +91 -0
  41. data/spec/dummy_app/log/test.log +232 -0
  42. data/spec/dummy_app/public/404.html +26 -0
  43. data/spec/dummy_app/public/422.html +26 -0
  44. data/spec/dummy_app/public/500.html +25 -0
  45. data/spec/dummy_app/public/favicon.ico +0 -0
  46. data/spec/dummy_app/public/index.html +241 -0
  47. data/spec/dummy_app/public/robots.txt +5 -0
  48. data/spec/dummy_app/script/rails +6 -0
  49. data/spec/spec_helper.rb +10 -0
  50. metadata +152 -58
  51. data/VERSION.yml +0 -4
  52. data/lib/timecop-console/controllers/timecop_controller.rb +0 -21
  53. data/lib/timecop-console/routes.rb +0 -16
  54. data/lib/timecop-console/timecop_controller_methods.rb +0 -33
  55. data/test/geminstaller.yml +0 -6
  56. data/test/test_helper.rb +0 -9
  57. data/test/timecop_console_test.rb +0 -29
metadata CHANGED
@@ -1,75 +1,169 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: timecop-console
3
- version: !ruby/object:Gem::Version
4
- version: 0.1.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ prerelease:
5
6
  platform: ruby
6
- authors:
7
+ authors:
7
8
  - John Trupiano
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
-
12
- date: 2009-03-07 00:00:00 -05:00
13
- default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: timecop
12
+ date: 2012-11-14 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: &70274154688200 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '3.1'
17
22
  type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
23
+ prerelease: false
24
+ version_requirements: *70274154688200
25
+ - !ruby/object:Gem::Dependency
26
+ name: timecop
27
+ requirement: &70274154687580 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
21
30
  - - ~>
22
- - !ruby/object:Gem::Version
23
- version: 0.2.1
24
- version:
25
- description:
26
- email: jtrupiano@gmail.com
31
+ - !ruby/object:Gem::Version
32
+ version: '0.5'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70274154687580
36
+ - !ruby/object:Gem::Dependency
37
+ name: rspec-rails
38
+ requirement: &70274154687200 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70274154687200
47
+ description: TimecopConsole manipulates Time.now using Timecop gem.
48
+ email:
49
+ - jtrupiano@gmail.com
27
50
  executables: []
28
-
29
51
  extensions: []
30
-
31
- extra_rdoc_files:
32
- - README.rdoc
52
+ extra_rdoc_files: []
53
+ files:
54
+ - Gemfile
33
55
  - LICENSE
34
- files:
35
56
  - README.rdoc
36
- - VERSION.yml
37
- - lib/timecop-console
38
- - lib/timecop-console/controllers
39
- - lib/timecop-console/controllers/timecop_controller.rb
40
- - lib/timecop-console/routes.rb
41
- - lib/timecop-console/timecop_controller_methods.rb
57
+ - Rakefile
58
+ - app/controllers/timecop_console/main_controller.rb
59
+ - config/routes.rb
60
+ - lib/timecop_console/controller_methods.rb
61
+ - lib/timecop_console/engine.rb
62
+ - lib/timecop_console/version.rb
42
63
  - lib/timecop_console.rb
43
- - test/geminstaller.yml
44
- - test/test_helper.rb
45
- - test/timecop_console_test.rb
46
- - LICENSE
47
- has_rdoc: true
48
- homepage: http://github.com/jtrupiano/timecop-console
64
+ - spec/controllers/main_controller_spec.rb
65
+ - spec/controllers/sample_controller_spec.rb
66
+ - spec/dummy_app/app/assets/images/rails.png
67
+ - spec/dummy_app/app/assets/javascripts/application.js
68
+ - spec/dummy_app/app/assets/stylesheets/application.css
69
+ - spec/dummy_app/app/controllers/application_controller.rb
70
+ - spec/dummy_app/app/controllers/sample_controller.rb
71
+ - spec/dummy_app/app/helpers/application_helper.rb
72
+ - spec/dummy_app/app/views/layouts/application.html.erb
73
+ - spec/dummy_app/config/application.rb
74
+ - spec/dummy_app/config/boot.rb
75
+ - spec/dummy_app/config/environment.rb
76
+ - spec/dummy_app/config/environments/development.rb
77
+ - spec/dummy_app/config/environments/production.rb
78
+ - spec/dummy_app/config/environments/test.rb
79
+ - spec/dummy_app/config/initializers/backtrace_silencers.rb
80
+ - spec/dummy_app/config/initializers/inflections.rb
81
+ - spec/dummy_app/config/initializers/mime_types.rb
82
+ - spec/dummy_app/config/initializers/secret_token.rb
83
+ - spec/dummy_app/config/initializers/session_store.rb
84
+ - spec/dummy_app/config/initializers/wrap_parameters.rb
85
+ - spec/dummy_app/config/locales/en.yml
86
+ - spec/dummy_app/config/routes.rb
87
+ - spec/dummy_app/config.ru
88
+ - spec/dummy_app/db/seeds.rb
89
+ - spec/dummy_app/doc/README_FOR_APP
90
+ - spec/dummy_app/Gemfile
91
+ - spec/dummy_app/Gemfile.lock
92
+ - spec/dummy_app/log/development.log
93
+ - spec/dummy_app/log/test.log
94
+ - spec/dummy_app/public/404.html
95
+ - spec/dummy_app/public/422.html
96
+ - spec/dummy_app/public/500.html
97
+ - spec/dummy_app/public/favicon.ico
98
+ - spec/dummy_app/public/index.html
99
+ - spec/dummy_app/public/robots.txt
100
+ - spec/dummy_app/Rakefile
101
+ - spec/dummy_app/README.rdoc
102
+ - spec/dummy_app/script/rails
103
+ - spec/spec_helper.rb
104
+ homepage: https://github.com/jtrupiano/timecop-console
105
+ licenses: []
49
106
  post_install_message:
50
- rdoc_options:
51
- - --inline-source
52
- - --charset=UTF-8
53
- require_paths:
107
+ rdoc_options: []
108
+ require_paths:
54
109
  - lib
55
- required_ruby_version: !ruby/object:Gem::Requirement
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- version: "0"
60
- version:
61
- required_rubygems_version: !ruby/object:Gem::Requirement
62
- requirements:
63
- - - ">="
64
- - !ruby/object:Gem::Version
65
- version: "0"
66
- version:
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ none: false
112
+ requirements:
113
+ - - ! '>='
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
+ none: false
118
+ requirements:
119
+ - - ! '>='
120
+ - !ruby/object:Gem::Version
121
+ version: 1.3.6
67
122
  requirements: []
68
-
69
- rubyforge_project: johntrupiano
70
- rubygems_version: 1.3.1
123
+ rubyforge_project:
124
+ rubygems_version: 1.8.17
71
125
  signing_key:
72
- specification_version: 2
73
- summary: Expose Timecop's capabilities to the UI in your rails app, allowing QA to take advantage of it.
74
- test_files: []
75
-
126
+ specification_version: 3
127
+ summary: Expose Timecop's capabilities to the UI in your rails app, allowing QA to
128
+ take advantage of it.
129
+ test_files:
130
+ - spec/controllers/main_controller_spec.rb
131
+ - spec/controllers/sample_controller_spec.rb
132
+ - spec/dummy_app/app/assets/images/rails.png
133
+ - spec/dummy_app/app/assets/javascripts/application.js
134
+ - spec/dummy_app/app/assets/stylesheets/application.css
135
+ - spec/dummy_app/app/controllers/application_controller.rb
136
+ - spec/dummy_app/app/controllers/sample_controller.rb
137
+ - spec/dummy_app/app/helpers/application_helper.rb
138
+ - spec/dummy_app/app/views/layouts/application.html.erb
139
+ - spec/dummy_app/config/application.rb
140
+ - spec/dummy_app/config/boot.rb
141
+ - spec/dummy_app/config/environment.rb
142
+ - spec/dummy_app/config/environments/development.rb
143
+ - spec/dummy_app/config/environments/production.rb
144
+ - spec/dummy_app/config/environments/test.rb
145
+ - spec/dummy_app/config/initializers/backtrace_silencers.rb
146
+ - spec/dummy_app/config/initializers/inflections.rb
147
+ - spec/dummy_app/config/initializers/mime_types.rb
148
+ - spec/dummy_app/config/initializers/secret_token.rb
149
+ - spec/dummy_app/config/initializers/session_store.rb
150
+ - spec/dummy_app/config/initializers/wrap_parameters.rb
151
+ - spec/dummy_app/config/locales/en.yml
152
+ - spec/dummy_app/config/routes.rb
153
+ - spec/dummy_app/config.ru
154
+ - spec/dummy_app/db/seeds.rb
155
+ - spec/dummy_app/doc/README_FOR_APP
156
+ - spec/dummy_app/Gemfile
157
+ - spec/dummy_app/Gemfile.lock
158
+ - spec/dummy_app/log/development.log
159
+ - spec/dummy_app/log/test.log
160
+ - spec/dummy_app/public/404.html
161
+ - spec/dummy_app/public/422.html
162
+ - spec/dummy_app/public/500.html
163
+ - spec/dummy_app/public/favicon.ico
164
+ - spec/dummy_app/public/index.html
165
+ - spec/dummy_app/public/robots.txt
166
+ - spec/dummy_app/Rakefile
167
+ - spec/dummy_app/README.rdoc
168
+ - spec/dummy_app/script/rails
169
+ - spec/spec_helper.rb
data/VERSION.yml DELETED
@@ -1,4 +0,0 @@
1
- ---
2
- :patch: 0
3
- :major: 0
4
- :minor: 1
@@ -1,21 +0,0 @@
1
-
2
- # Because we want to use the session, we need to inherit from ApplicationController
3
- # This is currently very brittle....need to think this one through further.
4
- require_dependency 'application' if Object.const_defined?(:RAILS_ENV)
5
- class TimecopController < ApplicationController
6
-
7
- # verify :method => 'post'
8
- skip_filter :handle_timecop_offset
9
-
10
- def update
11
- year, month, day, hour, min, sec = params[:year], params[:month], params[:day], params[:hour], params[:min], params[:sec]
12
- session[:timecop_adjusted_time] = Time.local(year, month, day, hour, min, sec)
13
- render :status => 200, :nothing => true
14
- end
15
-
16
- def reset
17
- session[:timecop_adjusted_time] = nil
18
- render :status => 200, :nothing => true
19
- end
20
-
21
- end
@@ -1,16 +0,0 @@
1
- module ActionController
2
- module Routing #:nodoc:
3
- class RouteSet #:nodoc:
4
- alias_method :draw_without_timecop_routes, :draw
5
- def draw
6
- draw_without_timecop_routes do |map|
7
-
8
- map.update_time '/timecop/update', :controller => 'timecop', :action => 'update'
9
- map.reset_time '/timecop/reset', :controller => 'timecop', :action => 'reset'
10
-
11
- yield map if block_given?
12
- end
13
- end
14
- end
15
- end
16
- end
@@ -1,33 +0,0 @@
1
- # Defines extensions applied to ActionController::Base to support our time travel
2
- module TimecopControllerMethods
3
-
4
- def self.included(base)
5
- base.class_eval do
6
- around_filter :handle_timecop_offset
7
- end
8
- end
9
-
10
- # to be used as an around_filter
11
- def handle_timecop_offset
12
- # Establish now
13
- if !session[:timecop_adjusted_time].nil?
14
- puts "***** Time traveling to #{session[:timecop_adjusted_time].to_s}"
15
- Timecop.travel(session[:timecop_adjusted_time])
16
- else
17
- Timecop.return
18
- end
19
-
20
- # Run the intended action
21
- yield
22
-
23
- # we want to continue to slide time forward, even if it's only 3 seconds at a time.
24
- # this ensures that subsequent calls during the same "time travel" actually pass time
25
- if !session[:timecop_adjusted_time].nil?
26
- puts "====== Resetting session to: #{Time.now + 3}"
27
- session[:timecop_adjusted_time] = Time.now + 3 # slide it forward a couple of seconds
28
- end
29
- end
30
-
31
- private :handle_timecop_offset
32
-
33
- end
@@ -1,6 +0,0 @@
1
-
2
- gems:
3
- - name: Shoulda
4
- version: '~> 1.2.0'
5
- - name: timecop
6
- version: '~> 0.2.1'
data/test/test_helper.rb DELETED
@@ -1,9 +0,0 @@
1
- require 'rubygems'
2
- require 'test/unit'
3
- require 'shoulda'
4
-
5
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
- $LOAD_PATH.unshift(File.dirname(__FILE__))
7
-
8
- class Test::Unit::TestCase
9
- end
@@ -1,29 +0,0 @@
1
- require 'test_helper'
2
- require 'actionpack'
3
- require 'action_controller'
4
- # require 'action_controller/assertions/routing_assertions'
5
-
6
- require "timecop-console/timecop_controller_methods"
7
-
8
- # We need this defined for the session key
9
- class ApplicationController < ActionController::Base
10
-
11
- end
12
-
13
- require 'timecop_console'
14
- class SampleController < ActionController::Base
15
-
16
- end
17
-
18
- class TimecopConsoleTest < Test::Unit::TestCase
19
-
20
- should "add around_filter to SampleController" do
21
- assert SampleController.around_filter.any?{|filter| filter.around? && filter.method == :handle_timecop_offset}, "before_filter should have been applied"
22
- end
23
-
24
- # should "recognize the new routes" do
25
- # assert_recognizes({:controller => 'timecop', :action => 'update'})
26
- # assert_recognizes({:controller => 'timecop', :action => 'reset'})
27
- # end
28
-
29
- end