everything-core 0.0.8 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,195 +0,0 @@
1
- describe Everything::Piece do
2
- let(:given_full_path) do
3
- 'some/fake/path/here-is-our-piece'
4
- end
5
- let(:piece) do
6
- described_class.new(given_full_path)
7
- end
8
-
9
- shared_context 'with content double' do
10
- let(:content_double) do
11
- instance_double(Everything::Piece::Content)
12
- end
13
-
14
- before do
15
- allow(Everything::Piece::Content)
16
- .to receive(:new)
17
- .and_return(content_double)
18
- end
19
- end
20
-
21
- shared_context 'with metadata double' do
22
- let(:metadata_double) do
23
- instance_double(Everything::Piece::Metadata)
24
- end
25
-
26
- before do
27
- allow(Everything::Piece::Metadata)
28
- .to receive(:new)
29
- .and_return(metadata_double)
30
- end
31
- end
32
-
33
- describe '#body' do
34
- include_context 'with content double'
35
-
36
- it 'delegates to the content' do
37
- allow(content_double).to receive(:body)
38
-
39
- piece.body
40
-
41
- expect(content_double).to have_received(:body)
42
- end
43
- end
44
-
45
- describe '#content' do
46
- it 'is an instance of Content' do
47
- expect(piece.content).to be_a(Everything::Piece::Content)
48
- end
49
-
50
- it "is created with the piece's full path" do
51
- expect(Everything::Piece::Content)
52
- .to receive(:new)
53
- .with(given_full_path)
54
-
55
- piece.content
56
- end
57
- end
58
-
59
- describe '#full_path' do
60
- it "returns the piece's full path" do
61
- expect(piece.full_path).to eq(given_full_path)
62
- end
63
- end
64
-
65
- describe '#metadata' do
66
- it 'is an instance of Metadata' do
67
- expect(piece.metadata).to be_a(Everything::Piece::Metadata)
68
- end
69
-
70
- it "is created with the piece's full path" do
71
- expect(Everything::Piece::Metadata)
72
- .to receive(:new)
73
- .with(given_full_path)
74
-
75
- piece.metadata
76
- end
77
- end
78
-
79
- describe '#name' do
80
- let(:expected_name) do
81
- 'here-is-our-piece'
82
- end
83
-
84
- it 'is the last part of the path' do
85
- expect(piece.name).to eq(expected_name)
86
- end
87
- end
88
-
89
- describe '#public?' do
90
- let(:metadata_double) do
91
- instance_double(Everything::Piece::Metadata)
92
- end
93
-
94
- it "returns the metadata's public value" do
95
- allow(Everything::Piece::Metadata)
96
- .to receive(:new)
97
- .and_return(metadata_double)
98
-
99
- expect(metadata_double)
100
- .to receive(:[])
101
- .with('public')
102
- .and_return(false)
103
-
104
- expect(piece.public?).to eq(false)
105
- end
106
- end
107
-
108
- describe '#raw_markdown' do
109
- include_context 'with content double'
110
-
111
- it 'delegates to the content' do
112
- allow(content_double).to receive(:raw_markdown)
113
-
114
- piece.raw_markdown
115
-
116
- expect(content_double).to have_received(:raw_markdown)
117
- end
118
- end
119
-
120
- describe '#raw_markdown=' do
121
- include_context 'with content double'
122
-
123
- it 'delegates to the content' do
124
- allow(content_double).to receive(:raw_markdown=)
125
-
126
- piece.raw_markdown=("# Test markdown")
127
-
128
- expect(content_double)
129
- .to have_received(:raw_markdown=)
130
- .with("# Test markdown")
131
- end
132
- end
133
-
134
- describe '#title' do
135
- include_context 'with content double'
136
-
137
- it 'delegates to the content' do
138
- allow(content_double).to receive(:title)
139
-
140
- piece.title
141
-
142
- expect(content_double).to have_received(:title)
143
- end
144
- end
145
-
146
- describe '#raw_yaml' do
147
- include_context 'with metadata double'
148
-
149
- it 'delegates to the metadata' do
150
- allow(metadata_double).to receive(:raw_yaml)
151
-
152
- piece.raw_yaml
153
-
154
- expect(metadata_double).to have_received(:raw_yaml)
155
- end
156
- end
157
-
158
- describe '#raw_yaml=' do
159
- include_context 'with metadata double'
160
-
161
- it 'delegates to the metadata' do
162
- allow(metadata_double).to receive(:raw_yaml=)
163
-
164
- piece.raw_yaml=("---\nanything: works")
165
-
166
- expect(metadata_double)
167
- .to have_received(:raw_yaml=)
168
- .with("---\nanything: works")
169
- end
170
- end
171
-
172
- describe '#save' do
173
- include_context 'with content double'
174
- include_context 'with metadata double'
175
-
176
- before do
177
- allow(content_double).to receive(:save)
178
- allow(metadata_double).to receive(:save)
179
- end
180
-
181
- it 'calls save on the content' do
182
- piece.save
183
-
184
- expect(content_double)
185
- .to have_received(:save)
186
- end
187
-
188
- it 'calls save on the metadata' do
189
- piece.save
190
-
191
- expect(metadata_double)
192
- .to have_received(:save)
193
- end
194
- end
195
- end
@@ -1,19 +0,0 @@
1
- describe Everything do
2
- it 'has a version number' do
3
- expect(Everything::VERSION).not_to be nil
4
- end
5
-
6
- describe '.path' do
7
- let(:expected_path) do
8
- '/some/path/to/your/everything/repo/'
9
- end
10
-
11
- before do
12
- ENV['EVERYTHING_PATH'] = expected_path
13
- end
14
-
15
- it 'is the path from the environment' do
16
- expect(described_class.path).to eq(expected_path)
17
- end
18
- end
19
- end
@@ -1,99 +0,0 @@
1
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
- require 'everything'
3
-
4
- # This file was generated by the `rspec --init` command. Conventionally, all
5
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
6
- # The generated `.rspec` file contains `--require spec_helper` which will cause
7
- # this file to always be loaded, without a need to explicitly require it in any
8
- # files.
9
- #
10
- # Given that it is always loaded, you are encouraged to keep this file as
11
- # light-weight as possible. Requiring heavyweight dependencies from this file
12
- # will add to the boot time of your test suite on EVERY test run, even for an
13
- # individual file that may not need all of that loaded. Instead, consider making
14
- # a separate helper file that requires the additional dependencies and performs
15
- # the additional setup, and require it from the spec files that actually need
16
- # it.
17
- #
18
- # The `.rspec` file also contains a few flags that are not defaults but that
19
- # users commonly want.
20
- #
21
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
22
- RSpec.configure do |config|
23
- # rspec-expectations config goes here. You can use an alternate
24
- # assertion/expectation library such as wrong or the stdlib/minitest
25
- # assertions if you prefer.
26
- config.expect_with :rspec do |expectations|
27
- # This option will default to `true` in RSpec 4. It makes the `description`
28
- # and `failure_message` of custom matchers include text for helper methods
29
- # defined using `chain`, e.g.:
30
- # be_bigger_than(2).and_smaller_than(4).description
31
- # # => "be bigger than 2 and smaller than 4"
32
- # ...rather than:
33
- # # => "be bigger than 2"
34
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
35
- end
36
-
37
- # rspec-mocks config goes here. You can use an alternate test double
38
- # library (such as bogus or mocha) by changing the `mock_with` option here.
39
- config.mock_with :rspec do |mocks|
40
- # Prevents you from mocking or stubbing a method that does not exist on
41
- # a real object. This is generally recommended, and will default to
42
- # `true` in RSpec 4.
43
- mocks.verify_partial_doubles = true
44
- end
45
-
46
- # These two settings work together to allow you to limit a spec run
47
- # to individual examples or groups you care about by tagging them with
48
- # `:focus` metadata. When nothing is tagged with `:focus`, all examples
49
- # get run.
50
- config.filter_run :focus
51
- config.run_all_when_everything_filtered = true
52
-
53
- # This setting enables warnings. It's recommended, but in some cases may
54
- # be too noisy due to issues in dependencies.
55
- config.warnings = true
56
-
57
- # Run specs in random order to surface order dependencies. If you find an
58
- # order dependency and want to debug it, you can fix the order by providing
59
- # the seed, which is printed after each run.
60
- # --seed 1234
61
- config.order = :random
62
-
63
- # Seed global randomization in this process using the `--seed` CLI option.
64
- # Setting this allows you to use `--seed` to deterministically reproduce
65
- # test failures related to randomization by passing the same `--seed` value
66
- # as the one that triggered the failure.
67
- Kernel.srand config.seed
68
-
69
- # The settings below are suggested to provide a good initial experience
70
- # with RSpec, but feel free to customize to your heart's content.
71
- =begin
72
- # Limits the available syntax to the non-monkey patched syntax that is
73
- # recommended. For more details, see:
74
- # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
75
- # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
76
- # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
77
- config.disable_monkey_patching!
78
-
79
- # Many RSpec users commonly either run the entire suite or an individual
80
- # file, and it's useful to allow more verbose output when running an
81
- # individual spec file.
82
- if config.files_to_run.one?
83
- # Use the documentation formatter for detailed output,
84
- # unless a formatter has already been configured
85
- # (e.g. via a command-line flag).
86
- config.default_formatter = 'doc'
87
- end
88
-
89
- # Allows RSpec to persist some state between runs in order to support
90
- # the `--only-failures` and `--next-failure` CLI options. We recommend
91
- # you configure your source control system to ignore this file.
92
- config.example_status_persistence_file_path = "spec/examples.txt"
93
-
94
- # Print the 10 slowest examples and example groups at the
95
- # end of the spec run, to help surface which specs are running
96
- # particularly slow.
97
- config.profile_examples = 10
98
- =end
99
- end
@@ -1,13 +0,0 @@
1
- require 'tmpdir'
2
- require 'fileutils'
3
-
4
- RSpec.shared_context 'with tmp piece on disk' do
5
- let!(:tmp_piece_path) do
6
- Dir.mktmpdir
7
- end
8
-
9
- after do
10
- # This will recursively remove everything under that tmp dir.
11
- FileUtils.remove_entry(tmp_piece_path)
12
- end
13
- end