calendar_date_select 1.16.4 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +16 -3
- data/Gemfile +20 -0
- data/Gemfile.lock +111 -0
- data/History.txt +4 -0
- data/{README.txt → README.md} +6 -6
- data/Rakefile +6 -35
- data/VERSION +1 -1
- data/{public → app/assets}/images/calendar_date_select/calendar.gif +0 -0
- data/{public → app/assets}/javascripts/calendar_date_select/calendar_date_select.js +0 -0
- data/{public → app/assets}/javascripts/calendar_date_select/format_american.js +0 -0
- data/{public → app/assets}/javascripts/calendar_date_select/format_danish.js +0 -0
- data/{public → app/assets}/javascripts/calendar_date_select/format_db.js +0 -0
- data/{public → app/assets}/javascripts/calendar_date_select/format_euro_24hr.js +0 -0
- data/{public → app/assets}/javascripts/calendar_date_select/format_euro_24hr_ymd.js +0 -0
- data/{public → app/assets}/javascripts/calendar_date_select/format_finnish.js +0 -0
- data/{public → app/assets}/javascripts/calendar_date_select/format_hyphen_ampm.js +0 -0
- data/{public → app/assets}/javascripts/calendar_date_select/format_iso_date.js +0 -0
- data/{public → app/assets}/javascripts/calendar_date_select/format_italian.js +0 -0
- data/{public → app/assets}/javascripts/calendar_date_select/locale/ar.js +0 -0
- data/app/assets/javascripts/calendar_date_select/locale/cs.js +11 -0
- data/{public → app/assets}/javascripts/calendar_date_select/locale/da.js +0 -0
- data/{public → app/assets}/javascripts/calendar_date_select/locale/de.js +0 -0
- data/{public → app/assets}/javascripts/calendar_date_select/locale/es.js +0 -0
- data/{public → app/assets}/javascripts/calendar_date_select/locale/fi.js +3 -3
- data/{public → app/assets}/javascripts/calendar_date_select/locale/fr.js +0 -0
- data/app/assets/javascripts/calendar_date_select/locale/hu.js +11 -0
- data/{public → app/assets}/javascripts/calendar_date_select/locale/it.js +0 -0
- data/app/assets/javascripts/calendar_date_select/locale/ja.js +11 -0
- data/{public → app/assets}/javascripts/calendar_date_select/locale/nl.js +0 -0
- data/{public → app/assets}/javascripts/calendar_date_select/locale/pl.js +0 -0
- data/{public → app/assets}/javascripts/calendar_date_select/locale/pt.js +0 -0
- data/{public → app/assets}/javascripts/calendar_date_select/locale/ru.js +0 -0
- data/{public → app/assets}/javascripts/calendar_date_select/locale/sl.js +0 -0
- data/app/assets/javascripts/calendar_date_select/locale/sv.js +9 -0
- data/{public → app/assets}/stylesheets/calendar_date_select/blue.css +0 -0
- data/{public → app/assets}/stylesheets/calendar_date_select/default.css +0 -0
- data/{public → app/assets}/stylesheets/calendar_date_select/green.css +0 -0
- data/{public → app/assets}/stylesheets/calendar_date_select/plain.css +0 -0
- data/{public → app/assets}/stylesheets/calendar_date_select/red.css +0 -0
- data/{public → app/assets}/stylesheets/calendar_date_select/silver.css +0 -0
- data/{lib → app/helpers}/calendar_date_select/form_helpers.rb +1 -1
- data/{lib → app/helpers}/calendar_date_select/includes_helper.rb +0 -0
- data/calendar_date_select.gemspec +21 -90
- data/lib/calendar_date_select.rb +9 -29
- data/lib/calendar_date_select/calendar_date_select.rb +0 -2
- data/lib/calendar_date_select/version.rb +3 -0
- data/spec/dummy/.gitignore +15 -0
- data/spec/dummy/Gemfile +38 -0
- data/spec/dummy/Gemfile.lock +118 -0
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/images/rails.png +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +16 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/views/application/example.html.erb +5 -0
- data/spec/dummy/app/views/layouts/application.html.erb +15 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +67 -0
- data/spec/dummy/config/boot.rb +6 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +58 -0
- data/spec/dummy/db/seeds.rb +7 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/lib/tasks/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/robots.txt +5 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/dummy/test/fixtures/.gitkeep +0 -0
- data/spec/dummy/test/functional/.gitkeep +0 -0
- data/spec/dummy/test/integration/.gitkeep +0 -0
- data/spec/dummy/test/test_helper.rb +13 -0
- data/spec/dummy/test/unit/.gitkeep +0 -0
- data/spec/dummy/vendor/assets/javascripts/.gitkeep +0 -0
- data/spec/dummy/vendor/assets/stylesheets/.gitkeep +0 -0
- data/spec/dummy/vendor/plugins/.gitkeep +0 -0
- data/spec/{calendar_date_select → helpers}/calendar_date_select_spec.rb +0 -0
- data/spec/{calendar_date_select → helpers}/form_helpers_spec.rb +32 -40
- data/spec/helpers/includes_helper_spec.rb +42 -0
- data/spec/spec_helper.rb +8 -24
- metadata +235 -102
- data/Manifest.txt +0 -42
- data/init.rb +0 -1
- data/public/blank_iframe.html +0 -2
- data/spec/calendar_date_select/includes_helper_spec.rb +0 -46
@@ -0,0 +1,7 @@
|
|
1
|
+
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
+
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
3
|
+
#
|
4
|
+
# Examples:
|
5
|
+
#
|
6
|
+
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
7
|
+
# Mayor.create(name: 'Emanuel', city: cities.first)
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/404.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/422.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The change you wanted was rejected.</h1>
|
23
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/500.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>We're sorry, but something went wrong.</h1>
|
23
|
+
</div>
|
24
|
+
</body>
|
25
|
+
</html>
|
File without changes
|
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
|
+
require 'rails/commands'
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
2
|
+
require File.expand_path('../../config/environment', __FILE__)
|
3
|
+
require 'rails/test_help'
|
4
|
+
|
5
|
+
class ActiveSupport::TestCase
|
6
|
+
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
|
7
|
+
#
|
8
|
+
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
9
|
+
# -- they do not yet inherit this setting
|
10
|
+
fixtures :all
|
11
|
+
|
12
|
+
# Add more helper methods to be used by all tests here...
|
13
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,14 +1,6 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
-
|
3
2
|
describe CalendarDateSelect::FormHelpers do
|
4
|
-
include
|
5
|
-
include ActionView::Helpers::JavaScriptHelper
|
6
|
-
include ActionView::Helpers::AssetTagHelper
|
7
|
-
include ActionView::Helpers::TagHelper
|
8
|
-
include ActionView::Helpers::FormTagHelper
|
9
|
-
|
10
|
-
include CalendarDateSelect::FormHelpers
|
11
|
-
|
3
|
+
include ERB::Util
|
12
4
|
before(:each) do
|
13
5
|
@controller = ActionController::Base.new
|
14
6
|
@request = OpenStruct.new
|
@@ -20,32 +12,32 @@ describe CalendarDateSelect::FormHelpers do
|
|
20
12
|
describe "mixed mode" do
|
21
13
|
it "should not output a time when the value is a Date" do
|
22
14
|
@model.start_datetime = Date.parse("January 2, 2007")
|
23
|
-
output = calendar_date_select(:model, :start_datetime, :time => "mixed")
|
15
|
+
output = helper.calendar_date_select(:model, :start_datetime, :time => "mixed")
|
24
16
|
output.should_not match(/12:00 AM/)
|
25
17
|
end
|
26
18
|
|
27
19
|
it "should output a time when the value is a Time" do
|
28
20
|
@model.start_datetime = Time.parse("January 2, 2007 12:00 AM")
|
29
|
-
output = calendar_date_select(:model, :start_datetime, :time => "mixed")
|
21
|
+
output = helper.calendar_date_select(:model, :start_datetime, :time => "mixed")
|
30
22
|
output.should match(/12:00 AM/)
|
31
23
|
end
|
32
24
|
end
|
33
25
|
|
34
26
|
it "should render a time when time is passed as 'true'" do
|
35
27
|
@model.start_datetime = Date.parse("January 2, 2007")
|
36
|
-
output = calendar_date_select(:model, :start_datetime, :time => "true")
|
28
|
+
output = helper.calendar_date_select(:model, :start_datetime, :time => "true")
|
37
29
|
output.should match(/12:00 AM/)
|
38
30
|
end
|
39
31
|
|
40
32
|
it "should time_false__model_returns_time__should_render_without_time" do
|
41
33
|
@model.start_datetime = Time.parse("January 2, 2007 12:00 AM")
|
42
|
-
output = calendar_date_select(:model, :start_datetime)
|
34
|
+
output = helper.calendar_date_select(:model, :start_datetime)
|
43
35
|
output.should_not match(/12:00 AM/)
|
44
36
|
end
|
45
37
|
|
46
38
|
it "should _nil_model__shouldnt_populate_value" do
|
47
39
|
@model = nil
|
48
|
-
output = calendar_date_select(:model, :start_datetime)
|
40
|
+
output = helper.calendar_date_select(:model, :start_datetime)
|
49
41
|
|
50
42
|
output.should_not match(/value/)
|
51
43
|
end
|
@@ -53,40 +45,40 @@ describe CalendarDateSelect::FormHelpers do
|
|
53
45
|
describe "default time mode" do
|
54
46
|
it "should wrap default date in javascript function when passed as string" do
|
55
47
|
@model.start_datetime = nil
|
56
|
-
output = calendar_date_select(:model, :start_datetime, :default_time => "new Date()")
|
48
|
+
output = helper.calendar_date_select(:model, :start_datetime, :default_time => "new Date()")
|
57
49
|
output.should match(/value=""/)
|
58
50
|
output.should include("default_time:function() { return new Date() }")
|
59
51
|
end
|
60
52
|
|
61
53
|
it "should wrap formatted date with default time with Date() when passed a date object" do
|
62
54
|
@model.start_datetime = nil
|
63
|
-
output = calendar_date_select(:model, :start_datetime, :default_time => Date.parse("January 2, 2007"))
|
55
|
+
output = helper.calendar_date_select(:model, :start_datetime, :default_time => Date.parse("January 2, 2007"))
|
64
56
|
output.should match(/value=""/)
|
65
|
-
output.should include("default_time:new Date('January 02, 2007 12:00 AM')")
|
57
|
+
output.should include(h "default_time:new Date('January 02, 2007 12:00 AM')")
|
66
58
|
end
|
67
59
|
|
68
60
|
it "should wrap formatted date and time with Date() when passed a time object" do
|
69
61
|
@model.start_datetime = nil
|
70
|
-
output = calendar_date_select(:model, :start_datetime, :default_time => Time.parse("January 2, 2007 5:45 PM"))
|
62
|
+
output = helper.calendar_date_select(:model, :start_datetime, :default_time => Time.parse("January 2, 2007 5:45 PM"))
|
71
63
|
output.should match(/value=""/)
|
72
|
-
output.should include("default_time:new Date('January 02, 2007 05:45 PM')")
|
64
|
+
output.should include(h "default_time:new Date('January 02, 2007 05:45 PM')")
|
73
65
|
end
|
74
66
|
end
|
75
67
|
|
76
68
|
it "should _vdc__should_auto_format_function" do
|
77
69
|
@model.start_datetime = Time.parse("January 2, 2007 12:00 AM")
|
78
|
-
output = calendar_date_select(:model,
|
70
|
+
output = helper.calendar_date_select(:model,
|
79
71
|
:start_datetime,
|
80
72
|
:valid_date_check => "date < new Date()"
|
81
73
|
)
|
82
74
|
output.should include("valid_date_check:function(date) { return(date < new Date()) }")
|
83
75
|
|
84
|
-
output = calendar_date_select(:model,
|
76
|
+
output = helper.calendar_date_select(:model,
|
85
77
|
:start_datetime,
|
86
78
|
:valid_date_check => "return(date < new Date())"
|
87
79
|
)
|
88
80
|
output.should include("valid_date_check:function(date) { return(date < new Date()) }")
|
89
|
-
output = calendar_date_select(:model,
|
81
|
+
output = helper.calendar_date_select(:model,
|
90
82
|
:start_datetime,
|
91
83
|
:valid_date_check => "function(p) { return(date < new Date()) }"
|
92
84
|
)
|
@@ -96,14 +88,14 @@ describe CalendarDateSelect::FormHelpers do
|
|
96
88
|
it "should raise an error if the valid_date_check function is missing a return statement" do
|
97
89
|
message = ":valid_date_check function is missing a 'return' statement. Try something like: :valid_date_check => 'if (date > new(Date)) return true; else return false;'"
|
98
90
|
lambda {
|
99
|
-
output = calendar_date_select(:model,
|
91
|
+
output = helper.calendar_date_select(:model,
|
100
92
|
:start_datetime,
|
101
93
|
:valid_date_check => "date = 5; date < new Date());"
|
102
94
|
)
|
103
95
|
}.should raise_error(ArgumentError, message)
|
104
96
|
|
105
97
|
lambda {
|
106
|
-
output = calendar_date_select(:model,
|
98
|
+
output = helper.calendar_date_select(:model,
|
107
99
|
:start_datetime,
|
108
100
|
:valid_date_check => "function(p) { date = 5; date < new Date()); }"
|
109
101
|
)
|
@@ -111,78 +103,78 @@ describe CalendarDateSelect::FormHelpers do
|
|
111
103
|
end
|
112
104
|
|
113
105
|
it "should render the year_range argument correctly" do
|
114
|
-
output = calendar_date_select(:model, :start_datetime)
|
106
|
+
output = helper.calendar_date_select(:model, :start_datetime)
|
115
107
|
output.should include("year_range:10")
|
116
|
-
output = calendar_date_select(:model, :start_datetime, :year_range => 2000..2010)
|
108
|
+
output = helper.calendar_date_select(:model, :start_datetime, :year_range => 2000..2010)
|
117
109
|
output.should include("year_range:[2000, 2010]")
|
118
|
-
output = calendar_date_select(:model, :start_datetime, :year_range => (15.years.ago..5.years.ago))
|
110
|
+
output = helper.calendar_date_select(:model, :start_datetime, :year_range => (15.years.ago..5.years.ago))
|
119
111
|
output.should include("year_range:[#{15.years.ago.year}, #{5.years.ago.year}]")
|
120
112
|
end
|
121
113
|
|
122
114
|
it "should disregard the :object parameter when nil" do
|
123
115
|
@model.start_datetime = Time.parse("January 2, 2007 12:00 AM")
|
124
|
-
output = calendar_date_select(:model, :start_datetime, :time => true, :object => nil)
|
116
|
+
output = helper.calendar_date_select(:model, :start_datetime, :time => true, :object => nil)
|
125
117
|
output.should include(CalendarDateSelect.format_date(@model.start_datetime))
|
126
118
|
end
|
127
119
|
|
128
120
|
it "should regard :object parameter" do
|
129
121
|
@model.start_datetime = Time.parse("January 2, 2007 12:00 AM")
|
130
|
-
output = calendar_date_select(:lame_o, :start_datetime, :time => true, :object => @model)
|
122
|
+
output = helper.calendar_date_select(:lame_o, :start_datetime, :time => true, :object => @model)
|
131
123
|
output.should include(CalendarDateSelect.format_date(@model.start_datetime))
|
132
124
|
end
|
133
125
|
|
134
126
|
it "should respect parameters provided in default_options" do
|
135
127
|
new_options = CalendarDateSelect.default_options.merge(:popup => "force")
|
136
128
|
CalendarDateSelect.stub!(:default_options).and_return(new_options)
|
137
|
-
calendar_date_select_tag(:name, "").should include("popup:'force'")
|
129
|
+
helper.calendar_date_select_tag(:name, "").should include(h "popup:'force'")
|
138
130
|
end
|
139
131
|
|
140
132
|
it "should respect the :image option" do
|
141
|
-
output = calendar_date_select_tag(:name, "Some String", :image => "boogy.png")
|
133
|
+
output = helper.calendar_date_select_tag(:name, "Some String", :image => "boogy.png")
|
142
134
|
output.should include("boogy.png")
|
143
135
|
end
|
144
136
|
|
145
137
|
it "should not pass the :image option as a javascript option" do
|
146
|
-
output = calendar_date_select_tag(:name, "Some String", :image => "boogy.png")
|
138
|
+
output = helper.calendar_date_select_tag(:name, "Some String", :image => "boogy.png")
|
147
139
|
output.should_not include("image:")
|
148
140
|
end
|
149
141
|
|
150
|
-
it "should use the CSS class calendar_date_select_tag for popup selector icon" do
|
151
|
-
output = calendar_date_select_tag(:name, "Some String", :image => "boogy.png")
|
142
|
+
it "should use the CSS class helper.calendar_date_select_tag for popup selector icon" do
|
143
|
+
output = helper.calendar_date_select_tag(:name, "Some String", :image => "boogy.png")
|
152
144
|
output.should include("calendar_date_select_popup_icon")
|
153
145
|
end
|
154
146
|
|
155
|
-
describe "calendar_date_select_tag" do
|
147
|
+
describe "helper.calendar_date_select_tag" do
|
156
148
|
before(:each) do
|
157
149
|
@time = Time.parse("January 2, 2007 12:01:23 AM")
|
158
150
|
end
|
159
151
|
|
160
152
|
it "should use the string verbatim when provided" do
|
161
|
-
output = calendar_date_select_tag(:name, "Some String")
|
153
|
+
output = helper.calendar_date_select_tag(:name, "Some String")
|
162
154
|
|
163
155
|
output.should include("Some String")
|
164
156
|
end
|
165
157
|
|
166
158
|
it "should not render the time when time is false (or nil)" do
|
167
|
-
output = calendar_date_select_tag(:name, @time, :time => false)
|
159
|
+
output = helper.calendar_date_select_tag(:name, @time, :time => false)
|
168
160
|
|
169
161
|
output.should_not match(/12:01 AM/)
|
170
162
|
output.should include(CalendarDateSelect.format_date(@time.to_date))
|
171
163
|
end
|
172
164
|
|
173
165
|
it "should render the time when :time => true" do
|
174
|
-
output = calendar_date_select_tag(:name, @time, :time => true)
|
166
|
+
output = helper.calendar_date_select_tag(:name, @time, :time => true)
|
175
167
|
|
176
168
|
output.should include(CalendarDateSelect.format_date(@time))
|
177
169
|
end
|
178
170
|
|
179
171
|
it "should render the time when :time => 'mixed'" do
|
180
|
-
output = calendar_date_select_tag(:name, @time, :time => 'mixed')
|
172
|
+
output = helper.calendar_date_select_tag(:name, @time, :time => 'mixed')
|
181
173
|
output.should include(CalendarDateSelect.format_date(@time))
|
182
174
|
end
|
183
175
|
|
184
176
|
it "not include the image option in the result input tag" do
|
185
|
-
output = calendar_date_select_tag(:name, @time, :time => 'mixed')
|
177
|
+
output = helper.calendar_date_select_tag(:name, @time, :time => 'mixed')
|
186
178
|
output.should_not include("image=")
|
187
179
|
end
|
188
180
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CalendarDateSelect::IncludesHelper do
|
4
|
+
describe "calendar_date_select_includes" do
|
5
|
+
it "should include the specified locale" do
|
6
|
+
helper.calendar_date_select_includes(:locale => "fr").should include("calendar_date_select/locale/fr.js")
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should include the specified style" do
|
10
|
+
helper.calendar_date_select_includes(:style => "blue").should include("calendar_date_select/blue.css")
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should complain if you provide an illegitimate argument" do
|
14
|
+
lambda { helper.calendar_date_select_includes(:language => "fr") }.should raise_error(ArgumentError)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "calendar_date_select_javascripts" do
|
19
|
+
it "should return an array of javascripts" do
|
20
|
+
helper.calendar_date_select_javascripts.should == ["calendar_date_select/calendar_date_select"]
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should return the :javascript_include of the specified format, if the specified format expects it" do
|
24
|
+
CalendarDateSelect.stub!(:format).and_return(CalendarDateSelect::FORMATS[:hyphen_ampm])
|
25
|
+
helper.calendar_date_select_javascripts.should == ["calendar_date_select/calendar_date_select", "calendar_date_select/format_hyphen_ampm"]
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should blow up if an illegitimate argument is passed" do
|
29
|
+
lambda { helper.calendar_date_select_javascripts(:language => "fr") }.should raise_error(ArgumentError)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "calendar_date_select_stylesheets" do
|
34
|
+
it "should return an array of stylesheet" do
|
35
|
+
helper.calendar_date_select_javascripts.should == ["calendar_date_select/calendar_date_select"]
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should blow up if an illegitimate argument is passed" do
|
39
|
+
lambda { helper.calendar_date_select_stylesheets(:css_version => "blue") }.should raise_error(ArgumentError)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,26 +1,10 @@
|
|
1
|
-
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
2
2
|
|
3
|
-
require
|
3
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
4
|
+
require 'rspec/rails'
|
5
|
+
# require 'active_support'
|
6
|
+
# require 'action_pack'
|
7
|
+
# require 'action_controller'
|
8
|
+
# require 'action_view'
|
4
9
|
|
5
|
-
|
6
|
-
gem 'actionpack', ">= 2.2.0"
|
7
|
-
|
8
|
-
require 'active_support'
|
9
|
-
require 'action_pack'
|
10
|
-
require 'action_controller'
|
11
|
-
require 'action_view'
|
12
|
-
|
13
|
-
require 'ostruct'
|
14
|
-
|
15
|
-
ActionView::Helpers::InstanceTag.class_eval do
|
16
|
-
class << self; alias new_with_backwards_compatibility new; end
|
17
|
-
end
|
18
|
-
|
19
|
-
$: << (File.dirname(__FILE__) + "/../lib")
|
20
|
-
require "calendar_date_select"
|
21
|
-
|
22
|
-
class String
|
23
|
-
def to_regexp
|
24
|
-
is_a?(Regexp) ? self : Regexp.new(Regexp.escape(self.to_s))
|
25
|
-
end
|
26
|
-
end
|
10
|
+
Rails.backtrace_cleaner.remove_silencers!
|
metadata
CHANGED
@@ -1,115 +1,248 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: calendar_date_select
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 1.16.4
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
6
5
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
authors:
|
7
|
+
- Shih-gian Lee
|
8
|
+
- Enrique Garcia Cota (kikito)
|
9
|
+
- Tim Charper
|
10
|
+
- Lars E. Hoeg
|
11
|
+
- Marc-André Lafortune
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
date: 2013-10-15 00:00:00.000000000 Z
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
18
|
+
name: rails
|
19
|
+
requirement: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - '>='
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '3.1'
|
24
|
+
type: :runtime
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
requirements:
|
28
|
+
- - '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '3.1'
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: bundler
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '1.3'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '1.3'
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: rake
|
47
|
+
requirement: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
type: :development
|
53
|
+
prerelease: false
|
54
|
+
version_requirements: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - '>='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
20
59
|
description: Calendar date picker for rails
|
21
|
-
email:
|
60
|
+
email:
|
61
|
+
- github@marc-andre.ca
|
22
62
|
executables: []
|
23
|
-
|
24
63
|
extensions: []
|
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
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
64
|
+
extra_rdoc_files: []
|
65
|
+
files:
|
66
|
+
- .gitignore
|
67
|
+
- Gemfile
|
68
|
+
- Gemfile.lock
|
69
|
+
- History.txt
|
70
|
+
- MIT-LICENSE
|
71
|
+
- README.md
|
72
|
+
- Rakefile
|
73
|
+
- VERSION
|
74
|
+
- app/assets/images/calendar_date_select/calendar.gif
|
75
|
+
- app/assets/javascripts/calendar_date_select/calendar_date_select.js
|
76
|
+
- app/assets/javascripts/calendar_date_select/format_american.js
|
77
|
+
- app/assets/javascripts/calendar_date_select/format_danish.js
|
78
|
+
- app/assets/javascripts/calendar_date_select/format_db.js
|
79
|
+
- app/assets/javascripts/calendar_date_select/format_euro_24hr.js
|
80
|
+
- app/assets/javascripts/calendar_date_select/format_euro_24hr_ymd.js
|
81
|
+
- app/assets/javascripts/calendar_date_select/format_finnish.js
|
82
|
+
- app/assets/javascripts/calendar_date_select/format_hyphen_ampm.js
|
83
|
+
- app/assets/javascripts/calendar_date_select/format_iso_date.js
|
84
|
+
- app/assets/javascripts/calendar_date_select/format_italian.js
|
85
|
+
- app/assets/javascripts/calendar_date_select/locale/ar.js
|
86
|
+
- app/assets/javascripts/calendar_date_select/locale/cs.js
|
87
|
+
- app/assets/javascripts/calendar_date_select/locale/da.js
|
88
|
+
- app/assets/javascripts/calendar_date_select/locale/de.js
|
89
|
+
- app/assets/javascripts/calendar_date_select/locale/es.js
|
90
|
+
- app/assets/javascripts/calendar_date_select/locale/fi.js
|
91
|
+
- app/assets/javascripts/calendar_date_select/locale/fr.js
|
92
|
+
- app/assets/javascripts/calendar_date_select/locale/hu.js
|
93
|
+
- app/assets/javascripts/calendar_date_select/locale/it.js
|
94
|
+
- app/assets/javascripts/calendar_date_select/locale/ja.js
|
95
|
+
- app/assets/javascripts/calendar_date_select/locale/nl.js
|
96
|
+
- app/assets/javascripts/calendar_date_select/locale/pl.js
|
97
|
+
- app/assets/javascripts/calendar_date_select/locale/pt.js
|
98
|
+
- app/assets/javascripts/calendar_date_select/locale/ru.js
|
99
|
+
- app/assets/javascripts/calendar_date_select/locale/sl.js
|
100
|
+
- app/assets/javascripts/calendar_date_select/locale/sv.js
|
101
|
+
- app/assets/stylesheets/calendar_date_select/blue.css
|
102
|
+
- app/assets/stylesheets/calendar_date_select/default.css
|
103
|
+
- app/assets/stylesheets/calendar_date_select/green.css
|
104
|
+
- app/assets/stylesheets/calendar_date_select/plain.css
|
105
|
+
- app/assets/stylesheets/calendar_date_select/red.css
|
106
|
+
- app/assets/stylesheets/calendar_date_select/silver.css
|
107
|
+
- app/helpers/calendar_date_select/form_helpers.rb
|
108
|
+
- app/helpers/calendar_date_select/includes_helper.rb
|
109
|
+
- calendar_date_select.gemspec
|
110
|
+
- js_test/functional/.tmp_cds_test.html
|
111
|
+
- js_test/functional/cds_test.html
|
112
|
+
- js_test/functional/format_iso_date_test.html
|
113
|
+
- js_test/prototype.js
|
114
|
+
- js_test/test.css
|
115
|
+
- js_test/unit/cds_helper_methods.html
|
116
|
+
- js_test/unittest.js
|
117
|
+
- lib/calendar_date_select.rb
|
118
|
+
- lib/calendar_date_select/calendar_date_select.rb
|
119
|
+
- lib/calendar_date_select/version.rb
|
120
|
+
- spec/dummy/.gitignore
|
121
|
+
- spec/dummy/Gemfile
|
122
|
+
- spec/dummy/Gemfile.lock
|
123
|
+
- spec/dummy/README.rdoc
|
124
|
+
- spec/dummy/Rakefile
|
125
|
+
- spec/dummy/app/assets/images/rails.png
|
126
|
+
- spec/dummy/app/assets/javascripts/application.js
|
127
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
128
|
+
- spec/dummy/app/controllers/application_controller.rb
|
129
|
+
- spec/dummy/app/helpers/application_helper.rb
|
130
|
+
- spec/dummy/app/mailers/.gitkeep
|
131
|
+
- spec/dummy/app/models/.gitkeep
|
132
|
+
- spec/dummy/app/views/application/example.html.erb
|
133
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
134
|
+
- spec/dummy/config.ru
|
135
|
+
- spec/dummy/config/application.rb
|
136
|
+
- spec/dummy/config/boot.rb
|
137
|
+
- spec/dummy/config/database.yml
|
138
|
+
- spec/dummy/config/environment.rb
|
139
|
+
- spec/dummy/config/environments/development.rb
|
140
|
+
- spec/dummy/config/environments/production.rb
|
141
|
+
- spec/dummy/config/environments/test.rb
|
142
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
143
|
+
- spec/dummy/config/initializers/inflections.rb
|
144
|
+
- spec/dummy/config/initializers/mime_types.rb
|
145
|
+
- spec/dummy/config/initializers/secret_token.rb
|
146
|
+
- spec/dummy/config/initializers/session_store.rb
|
147
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
148
|
+
- spec/dummy/config/locales/en.yml
|
149
|
+
- spec/dummy/config/routes.rb
|
150
|
+
- spec/dummy/db/seeds.rb
|
151
|
+
- spec/dummy/lib/assets/.gitkeep
|
152
|
+
- spec/dummy/lib/tasks/.gitkeep
|
153
|
+
- spec/dummy/log/.gitkeep
|
154
|
+
- spec/dummy/public/404.html
|
155
|
+
- spec/dummy/public/422.html
|
156
|
+
- spec/dummy/public/500.html
|
157
|
+
- spec/dummy/public/favicon.ico
|
158
|
+
- spec/dummy/public/robots.txt
|
159
|
+
- spec/dummy/script/rails
|
160
|
+
- spec/dummy/test/fixtures/.gitkeep
|
161
|
+
- spec/dummy/test/functional/.gitkeep
|
162
|
+
- spec/dummy/test/integration/.gitkeep
|
163
|
+
- spec/dummy/test/test_helper.rb
|
164
|
+
- spec/dummy/test/unit/.gitkeep
|
165
|
+
- spec/dummy/vendor/assets/javascripts/.gitkeep
|
166
|
+
- spec/dummy/vendor/assets/stylesheets/.gitkeep
|
167
|
+
- spec/dummy/vendor/plugins/.gitkeep
|
168
|
+
- spec/helpers/calendar_date_select_spec.rb
|
169
|
+
- spec/helpers/form_helpers_spec.rb
|
170
|
+
- spec/helpers/includes_helper_spec.rb
|
171
|
+
- spec/spec_helper.rb
|
172
|
+
homepage: http://github.com/marcandre/calendar_date_select
|
173
|
+
licenses:
|
174
|
+
- MIT
|
175
|
+
metadata: {}
|
87
176
|
post_install_message:
|
88
|
-
rdoc_options:
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: "0"
|
177
|
+
rdoc_options: []
|
178
|
+
require_paths:
|
179
|
+
- lib
|
180
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
181
|
+
requirements:
|
182
|
+
- - '>='
|
183
|
+
- !ruby/object:Gem::Version
|
184
|
+
version: '0'
|
185
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
|
+
requirements:
|
187
|
+
- - '>='
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '0'
|
104
190
|
requirements: []
|
105
|
-
|
106
191
|
rubyforge_project:
|
107
|
-
rubygems_version: 1.
|
192
|
+
rubygems_version: 2.1.3
|
108
193
|
signing_key:
|
109
|
-
specification_version:
|
194
|
+
specification_version: 4
|
110
195
|
summary: Calendar date picker for rails
|
111
|
-
test_files:
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
196
|
+
test_files:
|
197
|
+
- spec/dummy/.gitignore
|
198
|
+
- spec/dummy/Gemfile
|
199
|
+
- spec/dummy/Gemfile.lock
|
200
|
+
- spec/dummy/README.rdoc
|
201
|
+
- spec/dummy/Rakefile
|
202
|
+
- spec/dummy/app/assets/images/rails.png
|
203
|
+
- spec/dummy/app/assets/javascripts/application.js
|
204
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
205
|
+
- spec/dummy/app/controllers/application_controller.rb
|
206
|
+
- spec/dummy/app/helpers/application_helper.rb
|
207
|
+
- spec/dummy/app/mailers/.gitkeep
|
208
|
+
- spec/dummy/app/models/.gitkeep
|
209
|
+
- spec/dummy/app/views/application/example.html.erb
|
210
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
211
|
+
- spec/dummy/config.ru
|
212
|
+
- spec/dummy/config/application.rb
|
213
|
+
- spec/dummy/config/boot.rb
|
214
|
+
- spec/dummy/config/database.yml
|
215
|
+
- spec/dummy/config/environment.rb
|
216
|
+
- spec/dummy/config/environments/development.rb
|
217
|
+
- spec/dummy/config/environments/production.rb
|
218
|
+
- spec/dummy/config/environments/test.rb
|
219
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
220
|
+
- spec/dummy/config/initializers/inflections.rb
|
221
|
+
- spec/dummy/config/initializers/mime_types.rb
|
222
|
+
- spec/dummy/config/initializers/secret_token.rb
|
223
|
+
- spec/dummy/config/initializers/session_store.rb
|
224
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
225
|
+
- spec/dummy/config/locales/en.yml
|
226
|
+
- spec/dummy/config/routes.rb
|
227
|
+
- spec/dummy/db/seeds.rb
|
228
|
+
- spec/dummy/lib/assets/.gitkeep
|
229
|
+
- spec/dummy/lib/tasks/.gitkeep
|
230
|
+
- spec/dummy/log/.gitkeep
|
231
|
+
- spec/dummy/public/404.html
|
232
|
+
- spec/dummy/public/422.html
|
233
|
+
- spec/dummy/public/500.html
|
234
|
+
- spec/dummy/public/favicon.ico
|
235
|
+
- spec/dummy/public/robots.txt
|
236
|
+
- spec/dummy/script/rails
|
237
|
+
- spec/dummy/test/fixtures/.gitkeep
|
238
|
+
- spec/dummy/test/functional/.gitkeep
|
239
|
+
- spec/dummy/test/integration/.gitkeep
|
240
|
+
- spec/dummy/test/test_helper.rb
|
241
|
+
- spec/dummy/test/unit/.gitkeep
|
242
|
+
- spec/dummy/vendor/assets/javascripts/.gitkeep
|
243
|
+
- spec/dummy/vendor/assets/stylesheets/.gitkeep
|
244
|
+
- spec/dummy/vendor/plugins/.gitkeep
|
245
|
+
- spec/helpers/calendar_date_select_spec.rb
|
246
|
+
- spec/helpers/form_helpers_spec.rb
|
247
|
+
- spec/helpers/includes_helper_spec.rb
|
248
|
+
- spec/spec_helper.rb
|