everything-core 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/CHANGELOG.md +4 -0
- data/lib/everything/piece.rb +6 -4
- data/lib/everything/version.rb +1 -1
- data/spec/everything/piece_spec.rb +33 -21
- data/spec/everything_spec.rb +4 -2
- data/spec/spec_helper.rb +3 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e66db03bfad6a1e58a7aeff49d6798ada6b0964d
|
4
|
+
data.tar.gz: ea00f472f7f0a9c2cb845e657f229e6d0bc96c43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a24df55089664a1af6ad6a84a2610915ec8d2c32102d63ca16a6d9bc0740452fe2c215897ed6c9451a1882e0f227635117ecd232d4da624709bc7c7e322f2248
|
7
|
+
data.tar.gz: ad37737f932f8d77f5d68760fd37ba4b46e868d8b9d17fd49d24b10fbe2563f58327567564c124525d9c4ce8958738743a573a5cf5ee4fe51954b8eced3a583f
|
data/.rspec
CHANGED
data/CHANGELOG.md
CHANGED
data/lib/everything/piece.rb
CHANGED
@@ -1,17 +1,19 @@
|
|
1
1
|
module Everything
|
2
2
|
class Piece
|
3
|
+
attr_reader :full_path
|
4
|
+
|
3
5
|
def initialize(full_path)
|
4
6
|
@full_path = full_path
|
5
7
|
end
|
6
8
|
|
7
|
-
def title
|
8
|
-
@title ||= partitioned_content.first.sub('# ', '')
|
9
|
-
end
|
10
|
-
|
11
9
|
def content
|
12
10
|
@content ||= partitioned_content.last
|
13
11
|
end
|
14
12
|
|
13
|
+
def title
|
14
|
+
@title ||= partitioned_content.first.sub('# ', '')
|
15
|
+
end
|
16
|
+
|
15
17
|
def raw_markdown
|
16
18
|
@raw_markdown ||= File.read(content_path)
|
17
19
|
end
|
data/lib/everything/version.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require './lib/everything/piece'
|
2
|
-
|
3
1
|
describe Everything::Piece do
|
4
2
|
let(:given_full_path) do
|
5
3
|
'some/fake/path/here'
|
@@ -20,14 +18,40 @@ And it might even include multiple lines!
|
|
20
18
|
MD
|
21
19
|
end
|
22
20
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
21
|
+
shared_context 'with fake markdown file' do
|
22
|
+
before do
|
23
|
+
expect(File)
|
24
|
+
.to receive(:read)
|
25
|
+
.with(expected_markdown_file_path)
|
26
|
+
.and_return(fake_markdown_text)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '#content' do
|
31
|
+
include_context 'with fake markdown file'
|
32
|
+
|
33
|
+
let(:expected_content) do
|
34
|
+
<<TEXT
|
35
|
+
The content is totally this right here.
|
36
|
+
|
37
|
+
And it might even include multiple lines!
|
38
|
+
TEXT
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'is only the markdown after the title' do
|
42
|
+
expect(piece.content).to eq(expected_content)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe '#full_path' do
|
47
|
+
it "returns the piece's full path" do
|
48
|
+
expect(piece.full_path).to eq(given_full_path)
|
49
|
+
end
|
28
50
|
end
|
29
51
|
|
30
52
|
describe '#raw_markdown' do
|
53
|
+
include_context 'with fake markdown file'
|
54
|
+
|
31
55
|
let(:expected_raw_markdown) do
|
32
56
|
fake_markdown_text
|
33
57
|
end
|
@@ -38,6 +62,8 @@ MD
|
|
38
62
|
end
|
39
63
|
|
40
64
|
describe '#title' do
|
65
|
+
include_context 'with fake markdown file'
|
66
|
+
|
41
67
|
let(:expected_title) do
|
42
68
|
'Piece Title Here'
|
43
69
|
end
|
@@ -46,18 +72,4 @@ MD
|
|
46
72
|
expect(piece.title).to eq(expected_title)
|
47
73
|
end
|
48
74
|
end
|
49
|
-
|
50
|
-
describe '#content' do
|
51
|
-
let(:expected_content) do
|
52
|
-
<<TEXT
|
53
|
-
The content is totally this right here.
|
54
|
-
|
55
|
-
And it might even include multiple lines!
|
56
|
-
TEXT
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'is only the markdown after the title' do
|
60
|
-
expect(piece.content).to eq(expected_content)
|
61
|
-
end
|
62
|
-
end
|
63
75
|
end
|
data/spec/everything_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
|
+
require 'everything'
|
3
|
+
|
1
4
|
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
5
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
6
|
# The generated `.rspec` file contains `--require spec_helper` which will cause
|