castle-log 0.0.5 → 0.1.0

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: 4797c95bdb305b3595774e95cb3286113d71e2af
4
- data.tar.gz: d026af6d58fc1eeee14c7b7a47e6fbf89ea7b159
3
+ metadata.gz: 9d26d17bf903f0038b5057f53782d6d3cb2edcc4
4
+ data.tar.gz: 57101db560f62b05d21c3e732d16f7b664dd5c65
5
5
  SHA512:
6
- metadata.gz: 05ec679d02eff9db2c667b0e24d57c3dfe912999f014dbdb5282731c371aa0c195cdb1ea53ad4f94c2fa3d883a8a3b52dc9398d0c31ba07ce3a312f00e96a7e9
7
- data.tar.gz: b8deaf1e2c31d3983278df6382afccbadffdc2bdb642f51496f750cd64b8e8250bfe42998d9716813d6c9b6a1dac2a7cb186eafb0c26da0d284b1ac696090246
6
+ metadata.gz: 5188fe7b857dfca1b2d8c714a01c7de3cc34f22282e62719a693d10bffe5ffc603366ccaa8b09a81a9ef852a96bd9f5be778cd8b17532ce323bed1c51fa6186f
7
+ data.tar.gz: b089e59141544d7ff6efa8de582a4e28a83dfda01aedb0cadc5b51db80a1e62f942663db46983c70a1f3e5eb41e5d2ee878d2e55d6bfc0e851384e2681f4ac7a
@@ -14,14 +14,12 @@ module Castle
14
14
  # @return [Array<Session>] Sessions contained in this file
15
15
  attr_reader :sessions
16
16
 
17
- # Determines if the file at the given URI is a Castle log file. If one intends
18
- # to read the file, simply using #new should be preferred in favor of this, catching any
19
- # errors that may be raised.
17
+ # Determines if the file at the given URI is a Castle log file.
20
18
  #
21
19
  # @param uri URI to file to read
22
- # @return [Boolean] true if the file is a Castle log file, false otherwise
20
+ # @return [Castle::Log::File] loaded file if the file is a Castle log file, nil otherwise
23
21
  def self.castle? uri
24
- !!File.new(uri) rescue false
22
+ File.new(uri) rescue nil
25
23
  end
26
24
 
27
25
  def initialize uri
@@ -1,5 +1,5 @@
1
1
  module Castle
2
2
  module Log
3
- VERSION = "0.0.5"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -21,7 +21,7 @@ describe Castle::Log::File do
21
21
  it { should have(1).sessions }
22
22
 
23
23
  it 'should have a multi-line note field' do
24
- subject.notes.split("\n").should have(3).lines
24
+ expect(subject.notes.split("\n")).to have(3).lines
25
25
  end
26
26
 
27
27
  end
@@ -81,10 +81,18 @@ describe Castle::Log::File do
81
81
  files.should have(5).files
82
82
 
83
83
  files.each do |f|
84
- Castle::Log::File.castle?(f).should be_true
84
+ expect(Castle::Log::File.castle?(f)).to be_true
85
85
  end
86
86
  end
87
87
 
88
+ it 'should return a file object' do
89
+ expect(Castle::Log::File.castle?(data_files[0])).to be_a(Castle::Log::File)
90
+ end
91
+
92
+ it 'should return nil when invalid' do
93
+ expect(Castle::Log::File.castle?(invalid_data_files[0])).to be_nil
94
+ end
95
+
88
96
  end
89
97
 
90
98
  end
@@ -4,15 +4,15 @@ describe Castle::Log::Session do
4
4
 
5
5
  context 'data file long-flight.csv' do
6
6
 
7
- let(:file) { Castle::Log::File.new(data_file('long-flight.csv')) }
7
+ before(:all) { @file = Castle::Log::File.new(data_file('long-flight.csv')) }
8
8
 
9
- subject { file }
9
+ subject { @file }
10
10
 
11
11
  it { should have(1).sessions }
12
12
 
13
13
  context 'session 1' do
14
14
 
15
- subject { file.sessions[0] }
15
+ subject { @file.sessions[0] }
16
16
 
17
17
  its(:duration) { should be_within(0.1).of(569.2) }
18
18
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: castle-log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Veys
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-02 00:00:00.000000000 Z
11
+ date: 2013-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print