edtf-rails 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +15 -0
- data/Gemfile +4 -3
- data/README.md +5 -5
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/edtf-rails.gemspec +21 -13
- data/gemfiles/rails_3.gemfile +18 -0
- data/gemfiles/rails_4.gemfile +18 -0
- data/lib/edtf-rails/edtf-rails.rb +57 -65
- data/lib/edtf-rails/util.rb +28 -0
- data/lib/edtf-rails.rb +2 -1
- data/spec/edtf-rails_spec.rb +20 -22
- data/spec/spec_helper.rb +7 -10
- metadata +53 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d05c5472a7fd5e3c15a47a6e15efea1d1c9ef899
|
4
|
+
data.tar.gz: 5c6d55bfa1aa477c2f6bd7f427d2de5eeb7874cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86525f39556877d3b32344836d8621090e21c346ab4134f5759d96b821120c5df28adb14bf06bde68180e16b9ab9c39614474cfece35ab740d3c30eb48b212be
|
7
|
+
data.tar.gz: 299e87917535e7b19b1740bbd0c54f9bd9b050dbd261f9435f383fca06b303a4539cec935e4dd8998b04c0e9bd61fc71c771ace2c509ce745dd4f93c3ed2fd29
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
@@ -1,18 +1,19 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
# Add dependencies required to use your gem here.
|
3
|
-
gem "activerecord", "
|
3
|
+
gem "activerecord", "<5"
|
4
4
|
gem "edtf", :git => "https://github.com/inukshuk/edtf-ruby.git"
|
5
5
|
|
6
6
|
# Add dependencies to develop your gem here.
|
7
7
|
# Include everything needed to run rake, tests, features, etc.
|
8
8
|
group :development do
|
9
|
-
gem "rspec", "~>
|
9
|
+
gem "rspec", "~> 3"
|
10
|
+
gem "rspec-its"
|
10
11
|
gem "rdoc", "~> 3.12"
|
11
12
|
gem "bundler", "~> 1.0"
|
12
13
|
gem "jeweler", "~> 1.8"
|
13
|
-
gem "debugger"
|
14
14
|
gem "sqlite3"
|
15
15
|
gem "awesome_print"
|
16
16
|
gem "appraisal"
|
17
|
+
gem "byebug"
|
17
18
|
# gem "rcov", ">= 0"
|
18
19
|
end
|
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# Edtf-Rails
|
2
|
-
|
2
|
+
[![Build Status](https://travis-ci.org/masciugo/edtf-rails.svg?branch=master)](https://travis-ci.org/masciugo/edtf-rails)
|
3
|
+
|
3
4
|
An ActiveRecord extension to deal with Extended DateTime Format attributes
|
4
5
|
|
5
6
|
## Description
|
@@ -16,11 +17,10 @@ In your model specify which attributes must be treated as EDTF:
|
|
16
17
|
They needs to be of type string in the database.
|
17
18
|
|
18
19
|
## Test
|
19
|
-
To test
|
20
|
-
|
21
|
-
appraisal rails-4 rake
|
22
|
-
appraisal rails-3 rake
|
20
|
+
To test compatibility with different versions of ActiveRecord [appraisal](https://github.com/thoughtbot/appraisal) was used
|
23
21
|
|
22
|
+
appraisal rake
|
23
|
+
|
24
24
|
## Contributing
|
25
25
|
|
26
26
|
Comments and feedback are welcome
|
data/Rakefile
CHANGED
@@ -30,7 +30,7 @@ require 'rspec/core/rake_task'
|
|
30
30
|
|
31
31
|
RSpec::Core::RakeTask.new(:spec, :tag) do |t, task_args|
|
32
32
|
t.pattern = FileList['spec/**/*_spec.rb']
|
33
|
-
t.rspec_opts = "--format documentation --color
|
33
|
+
t.rspec_opts = "--format documentation --color"
|
34
34
|
t.rspec_opts += " --tag #{task_args[:tag]}" unless task_args[:tag].nil?
|
35
35
|
end
|
36
36
|
# RSpec::Core::RakeTask.new(:rcov) do |spec|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/edtf-rails.gemspec
CHANGED
@@ -2,14 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: edtf-rails 0.3.1 ruby lib
|
5
6
|
|
6
7
|
Gem::Specification.new do |s|
|
7
8
|
s.name = "edtf-rails"
|
8
|
-
s.version = "0.3.
|
9
|
+
s.version = "0.3.1"
|
9
10
|
|
10
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
11
13
|
s.authors = ["masciugo"]
|
12
|
-
s.date = "
|
14
|
+
s.date = "2015-03-17"
|
13
15
|
s.description = "An ActiveRecord extension to deal with Extended DateTime Format attributes"
|
14
16
|
s.email = "masciugo@gmail.com"
|
15
17
|
s.extra_rdoc_files = [
|
@@ -19,6 +21,7 @@ Gem::Specification.new do |s|
|
|
19
21
|
s.files = [
|
20
22
|
".document",
|
21
23
|
".rspec",
|
24
|
+
".travis.yml",
|
22
25
|
"Appraisals",
|
23
26
|
"Gemfile",
|
24
27
|
"LICENSE.txt",
|
@@ -26,9 +29,12 @@ Gem::Specification.new do |s|
|
|
26
29
|
"Rakefile",
|
27
30
|
"VERSION",
|
28
31
|
"edtf-rails.gemspec",
|
32
|
+
"gemfiles/rails_3.gemfile",
|
33
|
+
"gemfiles/rails_4.gemfile",
|
29
34
|
"lib/edtf-rails.rb",
|
30
35
|
"lib/edtf-rails/constants.rb",
|
31
36
|
"lib/edtf-rails/edtf-rails.rb",
|
37
|
+
"lib/edtf-rails/util.rb",
|
32
38
|
"local_history",
|
33
39
|
"spec/edtf-rails_spec.rb",
|
34
40
|
"spec/spec_helper.rb",
|
@@ -37,47 +43,49 @@ Gem::Specification.new do |s|
|
|
37
43
|
]
|
38
44
|
s.homepage = "http://github.com/masciugo/edtf-rails"
|
39
45
|
s.licenses = ["MIT"]
|
40
|
-
s.
|
41
|
-
s.rubygems_version = "2.0.14"
|
46
|
+
s.rubygems_version = "2.4.5"
|
42
47
|
s.summary = "An ActiveRecord extension to deal with Extended DateTime Format attributes"
|
43
48
|
|
44
49
|
if s.respond_to? :specification_version then
|
45
50
|
s.specification_version = 4
|
46
51
|
|
47
52
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
48
|
-
s.add_runtime_dependency(%q<activerecord>, ["
|
53
|
+
s.add_runtime_dependency(%q<activerecord>, ["< 5"])
|
49
54
|
s.add_runtime_dependency(%q<edtf>, [">= 0"])
|
50
|
-
s.add_development_dependency(%q<rspec>, ["~>
|
55
|
+
s.add_development_dependency(%q<rspec>, ["~> 3"])
|
56
|
+
s.add_development_dependency(%q<rspec-its>, [">= 0"])
|
51
57
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
52
58
|
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
53
59
|
s.add_development_dependency(%q<jeweler>, ["~> 1.8"])
|
54
|
-
s.add_development_dependency(%q<debugger>, [">= 0"])
|
55
60
|
s.add_development_dependency(%q<sqlite3>, [">= 0"])
|
56
61
|
s.add_development_dependency(%q<awesome_print>, [">= 0"])
|
57
62
|
s.add_development_dependency(%q<appraisal>, [">= 0"])
|
63
|
+
s.add_development_dependency(%q<byebug>, [">= 0"])
|
58
64
|
else
|
59
|
-
s.add_dependency(%q<activerecord>, ["
|
65
|
+
s.add_dependency(%q<activerecord>, ["< 5"])
|
60
66
|
s.add_dependency(%q<edtf>, [">= 0"])
|
61
|
-
s.add_dependency(%q<rspec>, ["~>
|
67
|
+
s.add_dependency(%q<rspec>, ["~> 3"])
|
68
|
+
s.add_dependency(%q<rspec-its>, [">= 0"])
|
62
69
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
63
70
|
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
64
71
|
s.add_dependency(%q<jeweler>, ["~> 1.8"])
|
65
|
-
s.add_dependency(%q<debugger>, [">= 0"])
|
66
72
|
s.add_dependency(%q<sqlite3>, [">= 0"])
|
67
73
|
s.add_dependency(%q<awesome_print>, [">= 0"])
|
68
74
|
s.add_dependency(%q<appraisal>, [">= 0"])
|
75
|
+
s.add_dependency(%q<byebug>, [">= 0"])
|
69
76
|
end
|
70
77
|
else
|
71
|
-
s.add_dependency(%q<activerecord>, ["
|
78
|
+
s.add_dependency(%q<activerecord>, ["< 5"])
|
72
79
|
s.add_dependency(%q<edtf>, [">= 0"])
|
73
|
-
s.add_dependency(%q<rspec>, ["~>
|
80
|
+
s.add_dependency(%q<rspec>, ["~> 3"])
|
81
|
+
s.add_dependency(%q<rspec-its>, [">= 0"])
|
74
82
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
75
83
|
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
76
84
|
s.add_dependency(%q<jeweler>, ["~> 1.8"])
|
77
|
-
s.add_dependency(%q<debugger>, [">= 0"])
|
78
85
|
s.add_dependency(%q<sqlite3>, [">= 0"])
|
79
86
|
s.add_dependency(%q<awesome_print>, [">= 0"])
|
80
87
|
s.add_dependency(%q<appraisal>, [">= 0"])
|
88
|
+
s.add_dependency(%q<byebug>, [">= 0"])
|
81
89
|
end
|
82
90
|
end
|
83
91
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "http://rubygems.org"
|
4
|
+
|
5
|
+
gem "activerecord", "~> 3.2.0"
|
6
|
+
gem "edtf", :git => "https://github.com/inukshuk/edtf-ruby.git"
|
7
|
+
|
8
|
+
group :development do
|
9
|
+
gem "rspec", "~> 3"
|
10
|
+
gem "rspec-its"
|
11
|
+
gem "rdoc", "~> 3.12"
|
12
|
+
gem "bundler", "~> 1.0"
|
13
|
+
gem "jeweler", "~> 1.8"
|
14
|
+
gem "sqlite3"
|
15
|
+
gem "awesome_print"
|
16
|
+
gem "appraisal"
|
17
|
+
gem "byebug"
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "http://rubygems.org"
|
4
|
+
|
5
|
+
gem "activerecord", "~> 4.0"
|
6
|
+
gem "edtf", :git => "https://github.com/inukshuk/edtf-ruby.git"
|
7
|
+
|
8
|
+
group :development do
|
9
|
+
gem "rspec", "~> 3"
|
10
|
+
gem "rspec-its"
|
11
|
+
gem "rdoc", "~> 3.12"
|
12
|
+
gem "bundler", "~> 1.0"
|
13
|
+
gem "jeweler", "~> 1.8"
|
14
|
+
gem "sqlite3"
|
15
|
+
gem "awesome_print"
|
16
|
+
gem "appraisal"
|
17
|
+
gem "byebug"
|
18
|
+
end
|
@@ -1,90 +1,82 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
|
1
3
|
module EdtfRails
|
2
4
|
|
3
|
-
|
5
|
+
extend ActiveSupport::Concern
|
4
6
|
|
5
|
-
|
6
|
-
check_options(options, admitted_keys)
|
7
|
+
module ClassMethods
|
7
8
|
|
8
|
-
|
9
|
-
self.edtf_attributes = [options[:attributes]].flatten
|
9
|
+
def edtf options = {}
|
10
10
|
|
11
|
-
|
11
|
+
admitted_keys = [:attributes]
|
12
|
+
|
13
|
+
include Util
|
14
|
+
check_edtf_options(options, admitted_keys)
|
12
15
|
|
13
|
-
|
16
|
+
class_attribute :edtf_attributes
|
17
|
+
self.edtf_attributes = [options[:attributes]].flatten
|
14
18
|
|
15
|
-
|
16
|
-
|
17
|
-
# getters
|
18
|
-
define_method(d) do
|
19
|
-
# read_attribute(d) && (EDTF.parse(read_attribute(d)) || read_attribute(d)) #if the format is not EDTF compatible the string will be returned (validation call this getter and need a value)
|
20
|
-
EDTF.parse(read_attribute(d)) || read_attribute(d)
|
21
|
-
end
|
19
|
+
validates_format_of edtf_attributes, :with => EDTF_STRING_FORMAT, :allow_nil => true
|
22
20
|
|
23
|
-
|
24
|
-
[:y, :m, :d].each do |xx|
|
25
|
-
attr_accessor "#{d}_#{xx}"
|
26
|
-
attr_accessible("#{d}_#{xx}".to_sym) if USE_ATTRIBUTE_ACCESSIBLE
|
27
|
-
end
|
21
|
+
edtf_attributes.each do |d|
|
28
22
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
23
|
+
attr_accessible(d.to_sym) if USE_ATTRIBUTE_ACCESSIBLE
|
24
|
+
|
25
|
+
# getters
|
26
|
+
define_method(d) do
|
27
|
+
# read_attribute(d) && (EDTF.parse(read_attribute(d)) || read_attribute(d)) #if the format is not EDTF compatible the string will be returned (validation call this getter and need a value)
|
28
|
+
EDTF.parse(read_attribute(d)) || read_attribute(d)
|
29
|
+
end
|
33
30
|
|
34
|
-
|
31
|
+
# virtual attributes dob_y, dob_m....
|
32
|
+
[:y, :m, :d].each do |xx|
|
33
|
+
attr_accessor "#{d}_#{xx}"
|
34
|
+
attr_accessible("#{d}_#{xx}".to_sym) if USE_ATTRIBUTE_ACCESSIBLE
|
35
|
+
end
|
36
|
+
|
37
|
+
# setters
|
38
|
+
define_method("#{d}=") do |edtf_date|
|
39
|
+
edtf_date = edtf_date.edtf if edtf_date.is_a? Date
|
40
|
+
transaction do
|
41
|
+
|
42
|
+
write_attribute(d,edtf_date)
|
43
|
+
|
44
|
+
# virtual attributes settings after any assignment (including initialization)
|
45
|
+
date_array = read_attribute(d).to_s.split('-')
|
46
|
+
[:y, :m, :d].each_with_index do |x,i|
|
47
|
+
send("#{d}_#{x}=",date_array[i])
|
48
|
+
end
|
35
49
|
|
36
|
-
# virtual attributes settings after any assignment (including initialization)
|
37
|
-
date_array = read_attribute(d).to_s.split('-')
|
38
|
-
[:y, :m, :d].each_with_index do |x,i|
|
39
|
-
send("#{d}_#{x}=",date_array[i])
|
40
50
|
end
|
41
|
-
|
42
51
|
end
|
52
|
+
|
43
53
|
end
|
44
|
-
|
45
|
-
end
|
46
54
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
55
|
+
# virtual attributes utilization to set date before validation (they are used only if at least one of them is defined)
|
56
|
+
before_validation do
|
57
|
+
edtf_attributes.each do |d|
|
58
|
+
date_array = [:y, :m, :d].map{|x| send("#{d}_#{x}")}
|
59
|
+
self[d]= if (res = date_array.shift).present? #they are used only if at least one of them is defined
|
60
|
+
date_array.each{|x| x.blank? ? break : (res += "-#{x}") }
|
61
|
+
res
|
62
|
+
else
|
63
|
+
nil
|
64
|
+
end
|
56
65
|
end
|
57
66
|
end
|
58
|
-
end
|
59
67
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
68
|
+
# virtual attributes settings after any initialization
|
69
|
+
after_initialize do
|
70
|
+
unless new_record?
|
71
|
+
edtf_attributes.each do |d|
|
72
|
+
date_array = read_attribute(d).to_s.split('-')
|
73
|
+
[:y, :m, :d].each_with_index do |x,i|
|
74
|
+
send("#{d}_#{x}=",date_array[i])
|
75
|
+
end
|
67
76
|
end
|
68
77
|
end
|
69
78
|
end
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|
73
|
-
|
74
|
-
private
|
75
|
-
|
76
|
-
def check_options(options, admitted_keys)
|
77
79
|
|
78
|
-
raise WrongArgumentException, "first argument must be in a hash." unless options.is_a? Hash
|
79
|
-
raise WrongArgumentException, "seconf argument must be in an array." unless admitted_keys.is_a? Array
|
80
|
-
|
81
|
-
options.each do |key, value|
|
82
|
-
unless admitted_keys.include? key
|
83
|
-
raise WrongOptionException.new("Unknown option: #{key.inspect} => #{value.inspect}.")
|
84
|
-
end
|
85
|
-
if block_given?
|
86
|
-
yield key, value
|
87
|
-
end
|
88
80
|
end
|
89
81
|
|
90
82
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
|
3
|
+
module EdtfRails
|
4
|
+
module Util
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
module ClassMethods
|
8
|
+
|
9
|
+
def check_edtf_options(options, admitted_keys)
|
10
|
+
|
11
|
+
raise WrongArgumentException, "first argument must be in a hash." unless options.is_a? Hash
|
12
|
+
raise WrongArgumentException, "seconf argument must be in an array." unless admitted_keys.is_a? Array
|
13
|
+
|
14
|
+
options.each do |key, value|
|
15
|
+
unless admitted_keys.include? key
|
16
|
+
raise WrongOptionException.new("Unknown option: #{key.inspect} => #{value.inspect}.")
|
17
|
+
end
|
18
|
+
if block_given?
|
19
|
+
yield key, value
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
data/lib/edtf-rails.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "edtf"
|
2
2
|
require File.join(File.expand_path(File.dirname(__FILE__)), 'edtf-rails/constants')
|
3
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), 'edtf-rails/util')
|
3
4
|
require File.join(File.expand_path(File.dirname(__FILE__)), 'edtf-rails/edtf-rails')
|
4
5
|
|
5
|
-
ActiveRecord::Base.send :
|
6
|
+
ActiveRecord::Base.send :include, EdtfRails
|
data/spec/edtf-rails_spec.rb
CHANGED
@@ -73,16 +73,25 @@ describe EdtfRails do
|
|
73
73
|
|
74
74
|
end
|
75
75
|
|
76
|
-
|
77
|
-
describe EdtfRailsTest::Model do
|
76
|
+
describe "Test Model" do
|
78
77
|
|
79
78
|
before(:each) do
|
80
|
-
EdtfRailsTest.define_test_model_class({:attributes =>
|
81
|
-
@obj =
|
79
|
+
EdtfRailsTest.define_test_model_class({:attributes => [:dob,:dod]}) #define model again so that the underline table get recreated with the correct columns
|
80
|
+
@obj = EdtfRailsTest::Model.new(params)
|
82
81
|
end
|
83
82
|
|
84
83
|
subject { @obj }
|
85
84
|
|
85
|
+
shared_examples "return a Date object but store a String in the db" do
|
86
|
+
describe "#dob" do
|
87
|
+
subject { @obj.dob }
|
88
|
+
specify { should be_a Date }
|
89
|
+
end
|
90
|
+
it "has a string as value in the db" do
|
91
|
+
expect(@obj.read_attribute(:dob)).to be_a String
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
86
95
|
describe "#new" do
|
87
96
|
context "when initialized with no params" do
|
88
97
|
let(:params) { nil }
|
@@ -96,16 +105,6 @@ describe EdtfRailsTest::Model do
|
|
96
105
|
@obj.save!
|
97
106
|
end
|
98
107
|
|
99
|
-
shared_examples "return a Date object but store a String in the db" do
|
100
|
-
describe "#dob" do
|
101
|
-
subject { @obj.dob }
|
102
|
-
specify { should be_a Date }
|
103
|
-
end
|
104
|
-
it "has a string as value in the db" do
|
105
|
-
expect(@obj.read_attribute(:dob)).to be_a String
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
108
|
context "when new_date is Date.new(2001,9,10)" do
|
110
109
|
let(:new_date) { Date.new(2001,9,10) }
|
111
110
|
it_should_behave_like "return a Date object but store a String in the db"
|
@@ -167,14 +166,14 @@ describe EdtfRailsTest::Model do
|
|
167
166
|
end
|
168
167
|
end
|
169
168
|
|
170
|
-
|
169
|
+
shared_examples "a composed date" do |attribute|
|
170
|
+
let(:date_array) { subject.read_attribute(attribute).to_s.split('-') }
|
171
|
+
its(:dob_y) { should == date_array[0]}
|
172
|
+
its(:dob_m) { should == date_array[1]}
|
173
|
+
its(:dob_d) { should == date_array[2]}
|
174
|
+
end
|
171
175
|
|
172
|
-
|
173
|
-
let(:date_array) { subject.read_attribute(attribute).to_s.split('-') }
|
174
|
-
its(:dob_y) { should == date_array[0]}
|
175
|
-
its(:dob_m) { should == date_array[1]}
|
176
|
-
its(:dob_d) { should == date_array[2]}
|
177
|
-
end
|
176
|
+
describe "#dob_? atomic getters" do
|
178
177
|
|
179
178
|
context "when initialized with dob 1995-12" do
|
180
179
|
let(:params) { {:dob => "1995-12" } }
|
@@ -202,7 +201,6 @@ describe EdtfRailsTest::Model do
|
|
202
201
|
end
|
203
202
|
end
|
204
203
|
|
205
|
-
|
206
204
|
describe "#dob_?= atomic setters effect" do
|
207
205
|
context "when initialized with no params" do
|
208
206
|
let(:params) { nil }
|
data/spec/spec_helper.rb
CHANGED
@@ -1,10 +1,14 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
1
|
require 'rspec'
|
2
|
+
require 'rspec/its'
|
4
3
|
require "active_record"
|
5
4
|
require "logger"
|
6
|
-
require 'edtf-rails'
|
7
5
|
require 'awesome_print'
|
6
|
+
require 'byebug'
|
7
|
+
|
8
|
+
# this is to make absolutely sure we test this one, not the one
|
9
|
+
# installed on the system.
|
10
|
+
require File.expand_path('../../lib/edtf-rails', __FILE__)
|
11
|
+
|
8
12
|
|
9
13
|
# Requires supporting files with custom matchers and macros, etc,
|
10
14
|
# in ./support/ and its subdirectories.
|
@@ -12,13 +16,6 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
|
12
16
|
|
13
17
|
RSpec.configure do |config|
|
14
18
|
config.expect_with :rspec do |c|
|
15
|
-
# # Disable the `expect` sytax...
|
16
|
-
c.syntax = :should
|
17
|
-
|
18
|
-
# ...or disable the `should` syntax...
|
19
|
-
c.syntax = :expect
|
20
|
-
|
21
|
-
# # ...or explicitly enable both
|
22
19
|
c.syntax = [:should, :expect]
|
23
20
|
end
|
24
21
|
end
|
metadata
CHANGED
@@ -1,153 +1,167 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: edtf-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- masciugo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "<"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '5'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - "<"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '5'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: edtf
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: '3'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: '3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec-its
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rdoc
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- - ~>
|
73
|
+
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
75
|
version: '3.12'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- - ~>
|
80
|
+
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '3.12'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: bundler
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- - ~>
|
87
|
+
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
89
|
version: '1.0'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- - ~>
|
94
|
+
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '1.0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: jeweler
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
|
-
- - ~>
|
101
|
+
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
103
|
version: '1.8'
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
|
-
- - ~>
|
108
|
+
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '1.8'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
112
|
+
name: sqlite3
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
|
-
- -
|
115
|
+
- - ">="
|
102
116
|
- !ruby/object:Gem::Version
|
103
117
|
version: '0'
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
|
-
- -
|
122
|
+
- - ">="
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
126
|
+
name: awesome_print
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
|
-
- -
|
129
|
+
- - ">="
|
116
130
|
- !ruby/object:Gem::Version
|
117
131
|
version: '0'
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
|
-
- -
|
136
|
+
- - ">="
|
123
137
|
- !ruby/object:Gem::Version
|
124
138
|
version: '0'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
140
|
+
name: appraisal
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
128
142
|
requirements:
|
129
|
-
- -
|
143
|
+
- - ">="
|
130
144
|
- !ruby/object:Gem::Version
|
131
145
|
version: '0'
|
132
146
|
type: :development
|
133
147
|
prerelease: false
|
134
148
|
version_requirements: !ruby/object:Gem::Requirement
|
135
149
|
requirements:
|
136
|
-
- -
|
150
|
+
- - ">="
|
137
151
|
- !ruby/object:Gem::Version
|
138
152
|
version: '0'
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
154
|
+
name: byebug
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
142
156
|
requirements:
|
143
|
-
- -
|
157
|
+
- - ">="
|
144
158
|
- !ruby/object:Gem::Version
|
145
159
|
version: '0'
|
146
160
|
type: :development
|
147
161
|
prerelease: false
|
148
162
|
version_requirements: !ruby/object:Gem::Requirement
|
149
163
|
requirements:
|
150
|
-
- -
|
164
|
+
- - ">="
|
151
165
|
- !ruby/object:Gem::Version
|
152
166
|
version: '0'
|
153
167
|
description: An ActiveRecord extension to deal with Extended DateTime Format attributes
|
@@ -158,8 +172,9 @@ extra_rdoc_files:
|
|
158
172
|
- LICENSE.txt
|
159
173
|
- README.md
|
160
174
|
files:
|
161
|
-
- .document
|
162
|
-
- .rspec
|
175
|
+
- ".document"
|
176
|
+
- ".rspec"
|
177
|
+
- ".travis.yml"
|
163
178
|
- Appraisals
|
164
179
|
- Gemfile
|
165
180
|
- LICENSE.txt
|
@@ -167,9 +182,12 @@ files:
|
|
167
182
|
- Rakefile
|
168
183
|
- VERSION
|
169
184
|
- edtf-rails.gemspec
|
185
|
+
- gemfiles/rails_3.gemfile
|
186
|
+
- gemfiles/rails_4.gemfile
|
170
187
|
- lib/edtf-rails.rb
|
171
188
|
- lib/edtf-rails/constants.rb
|
172
189
|
- lib/edtf-rails/edtf-rails.rb
|
190
|
+
- lib/edtf-rails/util.rb
|
173
191
|
- local_history
|
174
192
|
- spec/edtf-rails_spec.rb
|
175
193
|
- spec/spec_helper.rb
|
@@ -185,17 +203,17 @@ require_paths:
|
|
185
203
|
- lib
|
186
204
|
required_ruby_version: !ruby/object:Gem::Requirement
|
187
205
|
requirements:
|
188
|
-
- -
|
206
|
+
- - ">="
|
189
207
|
- !ruby/object:Gem::Version
|
190
208
|
version: '0'
|
191
209
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
192
210
|
requirements:
|
193
|
-
- -
|
211
|
+
- - ">="
|
194
212
|
- !ruby/object:Gem::Version
|
195
213
|
version: '0'
|
196
214
|
requirements: []
|
197
215
|
rubyforge_project:
|
198
|
-
rubygems_version: 2.
|
216
|
+
rubygems_version: 2.4.5
|
199
217
|
signing_key:
|
200
218
|
specification_version: 4
|
201
219
|
summary: An ActiveRecord extension to deal with Extended DateTime Format attributes
|