witch_doctor 0.1.0 → 0.1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,7 @@
1
1
  FactoryGirl.define do
2
2
  factory :document do
3
-
3
+ trait :with_attachment do
4
+ attachment 'blank_pdf.pdf'
5
+ end
4
6
  end
5
7
  end
@@ -1,6 +1,6 @@
1
1
  FactoryGirl.define do
2
2
  factory :virus_scan do
3
- association :resource, factory: :document
3
+ association :resource, factory: [:document, :with_attachment]
4
4
  mount_point 'attachment'
5
5
 
6
6
  trait :clean do
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe 'WitchDoctor' do
4
+ describe '.time_stamper' do
5
+ context 'by default' do
6
+ it 'generate Time.now' do
7
+ expect(WitchDoctor.time_stamper.call)
8
+ .to be_within(10.seconds)
9
+ .of(Time.now)
10
+ end
11
+ end
12
+
13
+ context 'passing midnight stamp' do
14
+ before { WitchDoctor.time_stamper = -> { Time.now.midnight } }
15
+ after { WitchDoctor.time_stamper = nil }
16
+
17
+ it 'generate midnight' do
18
+ expect(WitchDoctor.time_stamper.call)
19
+ .to be_within(10.seconds)
20
+ .of(Time.now.midnight)
21
+ end
22
+ end
23
+ end
24
+ end
@@ -33,7 +33,7 @@ describe VirusScan do
33
33
  end
34
34
 
35
35
  describe "as_json" do
36
- let(:document) { create :document, attachment: 'blank_pdf.pdf' }
36
+ let(:document) { create :document, :with_attachment }
37
37
  let(:virus_scan) {
38
38
  build_stubbed :virus_scan,
39
39
  scan_result: nil,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: witch_doctor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Valent
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-25 00:00:00.000000000 Z
11
+ date: 2015-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -180,6 +180,7 @@ files:
180
180
  - spec/factories/witch_doctor_virus_scans.rb
181
181
  - spec/helpers/application_helper_spec.rb
182
182
  - spec/lib/antivirus_spec.rb
183
+ - spec/lib/witch_doctor_spec.rb
183
184
  - spec/models/virus_scan_spec.rb
184
185
  - spec/permitters/virus_scan_permitter_spec.rb
185
186
  - spec/spec_helper.rb
@@ -256,4 +257,5 @@ test_files:
256
257
  - spec/factories/witch_doctor_virus_scans.rb
257
258
  - spec/factories/witch_doctor_documents.rb
258
259
  - spec/lib/antivirus_spec.rb
260
+ - spec/lib/witch_doctor_spec.rb
259
261
  - spec/helpers/application_helper_spec.rb