-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b8dff8f
commit e3032a0
Showing
7 changed files
with
37 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,36 @@ | ||
# frozen_string_literal: true | ||
|
||
# spec/vault_spec.rb | ||
require 'obsidian_api/vault' | ||
require "obsidian_api/vault" | ||
|
||
RSpec.describe ObsidianAPI::Vault do | ||
let(:vault_path) { 'spec/fixtures/vault' } | ||
let(:vault_path) { "spec/fixtures/vault" } | ||
let(:vault) { ObsidianAPI::Vault.new(vault_path) } | ||
|
||
describe '#list_files' do | ||
it 'lists all markdown files in the vault' do | ||
expect(vault.list_files).to include('spec/fixtures/vault/note1.md', 'spec/fixtures/vault/note2.md') | ||
describe "#list_files" do | ||
it "lists all markdown files in the vault" do | ||
expect(vault.list_files).to include("spec/fixtures/vault/note1.md", "spec/fixtures/vault/note2.md") | ||
end | ||
end | ||
|
||
describe '#read' do | ||
it 'reads the content of a markdown file' do | ||
content = vault.read('note1.md') | ||
describe "#read" do | ||
it "reads the content of a markdown file" do | ||
content = vault.read("note1.md") | ||
expect(content).to eq("# Note 1\nThis is the first note.") | ||
end | ||
end | ||
|
||
describe '#write' do | ||
it 'writes content to a markdown file' do | ||
vault.write('note3.md', "# Note 3\nThis is a new note.") | ||
expect(vault.read('note3.md')).to eq("# Note 3\nThis is a new note.") | ||
describe "#write" do | ||
it "writes content to a markdown file" do | ||
vault.write("note3.md", "# Note 3\nThis is a new note.") | ||
expect(vault.read("note3.md")).to eq("# Note 3\nThis is a new note.") | ||
end | ||
end | ||
|
||
describe '#delete' do | ||
it 'deletes a markdown file' do | ||
vault.delete('note3.md') | ||
expect(File.exist?('spec/fixtures/vault/note3.md')).to be false | ||
describe "#delete" do | ||
it "deletes a markdown file" do | ||
vault.delete("note3.md") | ||
expect(File.exist?("spec/fixtures/vault/note3.md")).to be false | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters