aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/calendar_spec.rb
diff options
context:
space:
mode:
authorRobert2017-06-21 14:52:46 +0200
committerRobert2017-06-22 09:05:19 +0200
commitd51985fc2a7c2138fd12cb9116ebf05d8b0e7dac (patch)
tree678edcf8dc0c5f956e7969a6aaa1e77f35f73940 /spec/models/calendar_spec.rb
parent400898d14514aaf6df991dd2cb73e10b991ae34b (diff)
downloadchouette-core-d51985fc2a7c2138fd12cb9116ebf05d8b0e7dac.tar.bz2
Refs: #3595@3h; fixing tests, evaluating timeliness gem :(
Diffstat (limited to 'spec/models/calendar_spec.rb')
-rw-r--r--spec/models/calendar_spec.rb18
1 files changed, 10 insertions, 8 deletions
diff --git a/spec/models/calendar_spec.rb b/spec/models/calendar_spec.rb
index 33d9676cd..6a2b24011 100644
--- a/spec/models/calendar_spec.rb
+++ b/spec/models/calendar_spec.rb
@@ -42,10 +42,10 @@ RSpec.describe Calendar, :type => :model do
subject { period }
def period(attributes = {})
- return @period if attributes.empty? and @period
- Calendar::Period.new(attributes).tap do |period|
- @period = period if attributes.empty?
- end
+ @__period__ ||= {}
+ @__period__.fetch(attributes){
+ @__period__[attributes] = Calendar::Period.new(attributes)
+ }
end
it 'should support mark_for_destruction (required by cocoon)' do
@@ -125,9 +125,9 @@ RSpec.describe Calendar, :type => :model do
subject { date_value }
def date_value(attributes = {})
- return @date_value if attributes.empty? and @date_value
- Calendar::DateValue.new(attributes).tap do |date_value|
- @date_value = date_value if attributes.empty?
+ @__date_values__ ||= Hash.new
+ @__date_values__.fetch(attributes) do
+ @__date_values__[attributes] = Calendar::DateValue.new(attributes)
end
end
@@ -150,7 +150,9 @@ RSpec.describe Calendar, :type => :model do
expect(date_value(value: '2017-01-03').value).to eq(Date.new(2017,01,03))
end
- it { is_expected.to validate_presence_of(:value) }
+ it 'validates presence' do
+ is_expected.to validate_presence_of(:value)
+ end
end
end