enhanced_date_select 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Appraisals +10 -2
- data/Rakefile +10 -2
- data/enhanced_date_select.gemspec +2 -1
- data/spec/enhanced_date_select_spec.rb +50 -43
- data/version.rb +15 -0
- metadata +2 -2
- data/VERSION +0 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTMzNTJmYzUzZmNkZTcyMzJkNGEyM2RmOTY4N2MzOGQwZDNmNDlmMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Mjg4MjI1NWU5NzEzN2QxZmI3ZjhiMTdjZjk1NmNlYTM4Zjk1NDk0YQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDM5M2I3Mzc2OTBkNmYwNjA1M2FhNTcwNGUwMmU1NmYxNTI1ZDRiNzIxMWYz
|
10
|
+
NGI5MDZlZjA1ZmVjMjRlZDM3OTk5MTY0ZjIzYzI3ZmU0Yjk3MGRmZmEzY2Uz
|
11
|
+
MDRhMGZiZWJiMDhkOWQ1M2JmMzBkOTEzNjUzZWZlMDE0YjQ5MTY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTNjZGMyOTg3NTA2NWJkOGUwYzE0NTJiMWQyYWNlMTgwMDRkZTY1MzYzYTMw
|
14
|
+
YjhhYTFiMjI5ZDUzZTVjNmU0NDMyMTVjMTljMGViYTdkYTQ4YjhjMTBkZTQz
|
15
|
+
Zjk0ODQ5ZDQ5MmEyMDI2NGU3ZDAxOGM2MDFlMzA2YjNmNDJjY2M=
|
data/Appraisals
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
appraise "rails-3.
|
2
|
-
gem "rails", "3.
|
1
|
+
appraise "rails-3.2.8" do
|
2
|
+
gem "rails", "3.2.8"
|
3
3
|
end
|
4
4
|
|
5
5
|
appraise "rails-3.2.12" do
|
@@ -8,4 +8,12 @@ end
|
|
8
8
|
|
9
9
|
appraise "rails-4.0.0" do
|
10
10
|
gem "rails", "4.0.0"
|
11
|
+
end
|
12
|
+
|
13
|
+
appraise "rails-4.0.2" do
|
14
|
+
gem "rails", "4.0.2"
|
15
|
+
end
|
16
|
+
|
17
|
+
appraise "rails-4.1.1" do
|
18
|
+
gem "rails", "4.1.1"
|
11
19
|
end
|
data/Rakefile
CHANGED
@@ -5,6 +5,8 @@ require 'bundler/setup'
|
|
5
5
|
require 'bundler/gem_tasks'
|
6
6
|
require 'appraisal'
|
7
7
|
require 'rspec/core/rake_task'
|
8
|
+
require 'coveralls/rake/task'
|
9
|
+
Coveralls::RakeTask.new
|
8
10
|
|
9
11
|
begin
|
10
12
|
Bundler.setup(:default, :development)
|
@@ -17,14 +19,20 @@ require 'rake'
|
|
17
19
|
|
18
20
|
|
19
21
|
|
20
|
-
RSpec::Core::RakeTask.new(:spec)
|
22
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
23
|
+
# spec.rspec_opts = ['--backtrace ']
|
24
|
+
end
|
21
25
|
|
22
26
|
desc "Default: run the unit tests."
|
23
27
|
task :default => [:all]
|
24
28
|
|
25
29
|
desc 'Test the plugin under all supported Rails versions.'
|
26
30
|
task :all do |t|
|
27
|
-
|
31
|
+
if ENV["TRAVIS"]
|
32
|
+
exec(' bundle exec appraisal install && bundle exec rake appraisal spec && bundle exec rake coveralls:push')
|
33
|
+
else
|
34
|
+
exec(' bundle exec appraisal install && bundle exec rake appraisal spec')
|
35
|
+
end
|
28
36
|
end
|
29
37
|
|
30
38
|
require 'rdoc/task'
|
@@ -1,7 +1,8 @@
|
|
1
|
+
require File.expand_path("../version", __FILE__)
|
1
2
|
|
2
3
|
Gem::Specification.new do |s|
|
3
4
|
s.name = "enhanced_date_select"
|
4
|
-
s.version =
|
5
|
+
s.version = EnhancedDateSelect.gem_version
|
5
6
|
s.platform = Gem::Platform::RUBY
|
6
7
|
s.summary = "\"enhanced date select\""
|
7
8
|
s.email = "raoul_ice@yahoo.com"
|
@@ -3,7 +3,8 @@ require "spec_helper"
|
|
3
3
|
describe "Enhanced DateSelect" do
|
4
4
|
include ActionView::Helpers::FormOptionsHelper
|
5
5
|
let(:student) {Object.new}
|
6
|
-
let(:
|
6
|
+
let(:deprecated_form_builder){ ActionView::Helpers::FormBuilder.new(:birthday, student, self, {}, nil)}
|
7
|
+
let(:rails41_form_builder){ ActionView::Helpers::FormBuilder.new(:birthday, student, self, {})}
|
7
8
|
|
8
9
|
let(:instance_tag) { ActionView::Helpers::InstanceTag.new(student.class, 'birthday', self, student )}
|
9
10
|
let(:rails4_instance_tag) {ActionView::Helpers::Tags::Base.new(student.class, 'birthday', self, student ) }
|
@@ -16,19 +17,25 @@ describe "Enhanced DateSelect" do
|
|
16
17
|
:end_year => 1940 }}
|
17
18
|
let(:expected_result) {"<input id=\"birthday_birthday_3i\" name=\"birthday[birthday(3i)]\" type=\"hidden\" value=\"1\" />\n<select id=\"birthday_birthday_2i\" name=\"birthday[birthday(2i)]\">\n<option value=\"1\">January</option>\n<option selected=\"selected\" value=\"2\">February</option>\n<option value=\"3\">March</option>\n<option value=\"4\">April</option>\n<option value=\"5\">May</option>\n<option value=\"6\">June</option>\n<option value=\"7\">July</option>\n<option value=\"8\">August</option>\n<option value=\"9\">September</option>\n<option value=\"10\">October</option>\n<option value=\"11\">November</option>\n<option value=\"12\">December</option>\n</select>\n<select id=\"birthday_birthday_1i\" name=\"birthday[birthday(1i)]\">\n<option value=\"2012\">2012</option>\n<option value=\"2011\">2011</option>\n<option value=\"2010\">2010</option>\n<option value=\"2009\">2009</option>\n<option value=\"2008\">2008</option>\n<option value=\"2007\">2007</option>\n<option value=\"2006\">2006</option>\n<option value=\"2005\">2005</option>\n<option value=\"2004\">2004</option>\n<option value=\"2003\">2003</option>\n<option value=\"2002\">2002</option>\n<option selected=\"selected\" value=\"2001\">2001</option>\n<option value=\"2000\">2000</option>\n<option value=\"1999\">1999</option>\n<option value=\"1998\">1998</option>\n<option value=\"1997\">1997</option>\n<option value=\"1996\">1996</option>\n<option value=\"1995\">1995</option>\n<option value=\"1994\">1994</option>\n<option value=\"1993\">1993</option>\n<option value=\"1992\">1992</option>\n<option value=\"1991\">1991</option>\n<option value=\"1990\">1990</option>\n<option value=\"1989\">1989</option>\n<option value=\"1988\">1988</option>\n<option value=\"1987\">1987</option>\n<option value=\"1986\">1986</option>\n<option value=\"1985\">1985</option>\n<option value=\"1984\">1984</option>\n<option value=\"1983\">1983</option>\n<option value=\"1982\">1982</option>\n<option value=\"1981\">1981</option>\n<option value=\"1980\">1980</option>\n<option value=\"1979\">1979</option>\n<option value=\"1978\">1978</option>\n<option value=\"1977\">1977</option>\n<option value=\"1976\">1976</option>\n<option value=\"1975\">1975</option>\n<option value=\"1974\">1974</option>\n<option value=\"1973\">1973</option>\n<option value=\"1972\">1972</option>\n<option value=\"1971\">1971</option>\n<option value=\"1970\">1970</option>\n<option value=\"1969\">1969</option>\n<option value=\"1968\">1968</option>\n<option value=\"1967\">1967</option>\n<option value=\"1966\">1966</option>\n<option value=\"1965\">1965</option>\n<option value=\"1964\">1964</option>\n<option value=\"1963\">1963</option>\n<option value=\"1962\">1962</option>\n<option value=\"1961\">1961</option>\n<option value=\"1960\">1960</option>\n<option value=\"1959\">1959</option>\n<option value=\"1958\">1958</option>\n<option value=\"1957\">1957</option>\n<option value=\"1956\">1956</option>\n<option value=\"1955\">1955</option>\n<option value=\"1954\">1954</option>\n<option value=\"1953\">1953</option>\n<option value=\"1952\">1952</option>\n<option value=\"1951\">1951</option>\n<option value=\"1950\">1950</option>\n<option value=\"1949\">1949</option>\n<option value=\"1948\">1948</option>\n<option value=\"1947\">1947</option>\n<option value=\"1946\">1946</option>\n<option value=\"1945\">1945</option>\n<option value=\"1944\">1944</option>\n<option value=\"1943\">1943</option>\n<option value=\"1942\">1942</option>\n<option value=\"1941\">1941</option>\n<option value=\"1940\">1940</option>\n</select>\n"}
|
18
19
|
before(:each) do
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
student.stub(:delete).and_return(student)
|
21
|
+
if ( Rails::VERSION::MAJOR.to_i <= 3 )
|
22
|
+
@instance_tag = instance_tag
|
22
23
|
else
|
23
|
-
|
24
|
+
@instance_tag = rails4_instance_tag
|
24
25
|
end
|
26
|
+
if ( Rails::VERSION::MAJOR.to_i >= 4 && Rails::VERSION::MINOR >= 1 )
|
27
|
+
@form_builder = rails41_form_builder
|
28
|
+
else
|
29
|
+
@form_builder = deprecated_form_builder
|
30
|
+
end
|
31
|
+
|
25
32
|
@enhanced_datetime_selector = ActionView::Helpers::EnhancedDateTimeSelector.new(datetime, options, {})
|
26
33
|
end
|
27
34
|
|
28
35
|
|
29
36
|
describe ".enhanced_date_select" do
|
30
37
|
it "constructs 3 selectboxes" do
|
31
|
-
form_builder.enhanced_date_select(:birthday,{ :prompt => {
|
38
|
+
@form_builder.enhanced_date_select(:birthday,{ :prompt => {
|
32
39
|
:day => "please select one",
|
33
40
|
:month => "please select one",
|
34
41
|
:year => "please select one" },
|
@@ -39,7 +46,7 @@ describe "Enhanced DateSelect" do
|
|
39
46
|
end
|
40
47
|
|
41
48
|
it "construct withoud the day dropdown" do
|
42
|
-
form_builder.enhanced_date_select(:birthday,{ :discard_day =>true,
|
49
|
+
@form_builder.enhanced_date_select(:birthday,{ :discard_day =>true,
|
43
50
|
:value => {:year => 2001, :month => 2, :day => 3},
|
44
51
|
:order => [:day, :month, :year],
|
45
52
|
:start_year => 2013,
|
@@ -53,20 +60,20 @@ describe "Enhanced DateSelect" do
|
|
53
60
|
|
54
61
|
before(:each) do
|
55
62
|
if ( Rails::VERSION::MAJOR.to_i <= 3 )
|
56
|
-
|
57
|
-
|
63
|
+
ActionView::Helpers::InstanceTag.stub(:new).and_return(@instance_tag)
|
64
|
+
@class = ActionView::Helpers::InstanceTag
|
58
65
|
else
|
59
|
-
|
60
|
-
|
66
|
+
ActionView::Helpers::Tags::Base.stub(:new).and_return(@instance_tag)
|
67
|
+
@class = ActionView::Helpers::Tags::Base
|
61
68
|
end
|
62
69
|
end
|
63
70
|
|
64
71
|
it "should call the instance tag with argument" do
|
65
|
-
|
66
|
-
|
67
|
-
|
72
|
+
if ( Rails::VERSION::MAJOR.to_i <= 3 )
|
73
|
+
@class.should_receive(:new).with(student, 'birthday', self, options.delete(:object)).and_return(@instance_tag)
|
74
|
+
else
|
68
75
|
@class.should_receive(:new).with(student, 'birthday', self, options).and_return(@instance_tag)
|
69
|
-
|
76
|
+
end
|
70
77
|
enhanced_date_select(student,'birthday',options )
|
71
78
|
end
|
72
79
|
it "should call the tp date_select_tag method" do
|
@@ -76,50 +83,50 @@ describe "Enhanced DateSelect" do
|
|
76
83
|
|
77
84
|
end
|
78
85
|
|
79
|
-
|
80
|
-
|
86
|
+
if ( Rails::VERSION::MAJOR.to_i <= 3 )
|
87
|
+
describe ActionView::Helpers::InstanceTag do
|
81
88
|
|
82
|
-
|
83
|
-
|
84
|
-
|
89
|
+
before(:each) do
|
90
|
+
@instance_tag.stub(:enhanced_datetime_selector).and_return(@enhanced_datetime_selector)
|
91
|
+
end
|
85
92
|
|
86
93
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
94
|
+
it "should call the datetimeselector" do
|
95
|
+
@instance_tag.should_receive(:enhanced_datetime_selector).with(options, html_options).and_return(@enhanced_datetime_selector)
|
96
|
+
@instance_tag.to_enhanced_date_select_tag(options, html_options)
|
97
|
+
end
|
91
98
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
99
|
+
it "should call the datetimeselector" do
|
100
|
+
@enhanced_datetime_selector.should_receive(:enhanced_select_date).and_return(expected_result)
|
101
|
+
@instance_tag.to_enhanced_date_select_tag(options, html_options)
|
102
|
+
end
|
96
103
|
|
97
104
|
|
98
105
|
|
99
|
-
|
106
|
+
end
|
100
107
|
|
101
108
|
else
|
102
|
-
|
109
|
+
describe ActionView::Helpers::Tags::Base do
|
103
110
|
|
104
|
-
|
105
|
-
|
106
|
-
|
111
|
+
before(:each) do
|
112
|
+
@instance_tag.stub(:enhanced_datetime_selector).and_return(@enhanced_datetime_selector)
|
113
|
+
end
|
107
114
|
|
108
115
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
116
|
+
it "should call the datetimeselector" do
|
117
|
+
@instance_tag.should_receive(:enhanced_datetime_selector).with(options, html_options).and_return(@enhanced_datetime_selector)
|
118
|
+
@instance_tag.to_enhanced_date_select_tag(options, html_options)
|
119
|
+
end
|
113
120
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
121
|
+
it "should call the datetimeselector" do
|
122
|
+
@enhanced_datetime_selector.should_receive(:enhanced_select_date).and_return(expected_result)
|
123
|
+
@instance_tag.to_enhanced_date_select_tag(options, html_options)
|
124
|
+
end
|
118
125
|
|
119
126
|
|
120
127
|
|
121
|
-
|
128
|
+
end
|
122
129
|
|
123
|
-
end
|
130
|
+
end
|
124
131
|
|
125
132
|
end
|
data/version.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
module EnhancedDateSelect
|
2
|
+
# Returns the version of the currently loaded Rails as a <tt>Gem::Version</tt>
|
3
|
+
def self.gem_version
|
4
|
+
Gem::Version.new VERSION::STRING
|
5
|
+
end
|
6
|
+
|
7
|
+
module VERSION
|
8
|
+
MAJOR = 1
|
9
|
+
MINOR = 0
|
10
|
+
TINY = 6
|
11
|
+
PRE = nil
|
12
|
+
|
13
|
+
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
|
14
|
+
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enhanced_date_select
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bogdanRada
|
@@ -249,11 +249,11 @@ files:
|
|
249
249
|
- LICENSE.txt
|
250
250
|
- README.rdoc
|
251
251
|
- Rakefile
|
252
|
-
- VERSION
|
253
252
|
- enhanced_date_select.gemspec
|
254
253
|
- lib/enhanced_date_select.rb
|
255
254
|
- spec/enhanced_date_select_spec.rb
|
256
255
|
- spec/spec_helper.rb
|
256
|
+
- version.rb
|
257
257
|
homepage: http://github.com/bogdanRada/enhanced_date_select
|
258
258
|
licenses:
|
259
259
|
- MIT
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
1.0.5
|