microscope 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c0b1a959c55d680d6eb38ad762324e8b158546d5
4
- data.tar.gz: 101b9f5e4e80977535d936fae45a791862f0d49c
3
+ metadata.gz: 24e09b4e48791db9f310f31e0fe03e5bd128e81b
4
+ data.tar.gz: a5a0daa121df4e1881be79830ad9dc7a56c47f09
5
5
  SHA512:
6
- metadata.gz: 9c570297e11b58f9941fc8d47cbb62a4a8341fddb36e2cb24c5c368ac47922dc240ded07d5b98b0d92435662a762e0381ec2236bb9fcb3b23da66b5df6f6ac43
7
- data.tar.gz: 463ac93cdcca8b54da650b84ae92d5e3b5583df028a534ec41310068cc2c76407f3850d3d427bfa0c727e2e3228ee6eda60c22357088178647ba8f8c838c3ceb
6
+ metadata.gz: 063f89d86a2addd04a19809b0470df9b2cad71be676223e420118540606c072d7176c608b11a406542783b5e8130973794e656a8189f398c5b90acdd670dab52
7
+ data.tar.gz: ce3228220d767572b5c511d9a30862150b437fc7729b2560c9d8355206f4d4956f8713efa4c8d61d172f16c01c3ca0cf3e32ed7947137b3c469d837f788462af
@@ -13,7 +13,7 @@ module Microscope
13
13
 
14
14
  define_method "#{cropped_field}=" do |value|
15
15
  if Microscope::InstanceMethod.value_to_boolean(value)
16
- self.#{field.name} = Date.today
16
+ self.#{field.name} ||= Date.today
17
17
  else
18
18
  self.#{field.name} = nil
19
19
  end
@@ -13,7 +13,7 @@ module Microscope
13
13
 
14
14
  define_method "#{cropped_field}=" do |value|
15
15
  if Microscope::InstanceMethod.value_to_boolean(value)
16
- self.#{field.name} = Time.now
16
+ self.#{field.name} ||= Time.now
17
17
  else
18
18
  self.#{field.name} = nil
19
19
  end
@@ -1,3 +1,3 @@
1
1
  module Microscope
2
- VERSION = '0.5.4'
2
+ VERSION = '0.5.5'
3
3
  end
@@ -28,19 +28,29 @@ describe Microscope::InstanceMethod::DateInstanceMethod do
28
28
  describe '#started=' do
29
29
  before { subject.started = value }
30
30
 
31
- context 'with present argument' do
31
+ context 'with blank argument' do
32
32
  subject { Event.create(started_on: 2.months.ago) }
33
33
  let(:value) { '0' }
34
34
 
35
35
  it { should_not be_started }
36
36
  end
37
37
 
38
- context 'with blank argument' do
38
+ context 'with present argument' do
39
39
  subject { Event.create }
40
40
  let(:value) { '1' }
41
41
 
42
42
  it { should be_started }
43
43
  end
44
+
45
+ context 'with present argument, twice' do
46
+ subject { Event.create(started_on: time) }
47
+ let(:time) { 2.months.ago }
48
+ let(:value) { '1' }
49
+
50
+ it { expect(subject.started_on.day).to eql time.day }
51
+ it { expect(subject.started_on.month).to eql time.month }
52
+ it { expect(subject.started_on.year).to eql time.year }
53
+ end
44
54
  end
45
55
 
46
56
  describe '#not_started?' do
@@ -26,19 +26,27 @@ describe Microscope::InstanceMethod::DatetimeInstanceMethod do
26
26
  describe '#started=' do
27
27
  before { subject.started = value }
28
28
 
29
- context 'with present argument' do
29
+ context 'with blank argument' do
30
30
  subject { Event.create(started_at: 2.months.ago) }
31
31
  let(:value) { '0' }
32
32
 
33
33
  it { should_not be_started }
34
34
  end
35
35
 
36
- context 'with blank argument' do
36
+ context 'with present argument' do
37
37
  subject { Event.create }
38
38
  let(:value) { '1' }
39
39
 
40
40
  it { should be_started }
41
41
  end
42
+
43
+ context 'with present argument, twice' do
44
+ subject { Event.create(started_at: time) }
45
+ let(:time) { 2.months.ago }
46
+ let(:value) { '1' }
47
+
48
+ it { expect(subject.started_at).to eql time }
49
+ end
42
50
  end
43
51
 
44
52
  describe '#not_started?' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: microscope
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Prévost
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-01-13 00:00:00.000000000 Z
12
+ date: 2014-01-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport