Skip to content

Commit e29b83e

Browse files
committed
Add specs/support for yank popup
1 parent dcbeb95 commit e29b83e

File tree

2 files changed

+56
-5
lines changed

2 files changed

+56
-5
lines changed

spec/buffers/commit_buffer_spec.rb

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,60 @@
1717
expect(nvim.filetype).to eq("NeogitLogView")
1818
end
1919

20-
it "can yank OID" do
20+
it "can open Yank popup" do
2121
nvim.keys("Y")
22-
expect(nvim.screen.last.strip).to match(/\A[a-f0-9]{40}\z/)
22+
expect(nvim.filetype).to eq("NeogitPopup")
23+
end
24+
25+
it "can yank oid" do
26+
nvim.keys("YY")
27+
yank = nvim.cmd("echo @*").first
28+
expect(yank).to match(/[0-9a-f]{40}/)
29+
end
30+
31+
it "can yank author" do
32+
nvim.keys("Ya")
33+
yank = nvim.cmd("echo @*").first
34+
expect(yank).to eq("tester <test@example.com>")
35+
end
36+
37+
it "can yank subject" do
38+
nvim.keys("Ys")
39+
yank = nvim.cmd("echo @*").first
40+
expect(yank).to eq("Initial commit")
41+
end
42+
43+
it "can yank message" do
44+
nvim.keys("Ym")
45+
yank = nvim.cmd("echo @*")
46+
expect(yank).to contain_exactly("Initial commit\n", "commit message")
47+
end
48+
49+
it "can yank body" do
50+
nvim.keys("Yb")
51+
yank = nvim.cmd("echo @*").first
52+
expect(yank).to eq("commit message")
53+
end
54+
55+
it "can yank diff" do
56+
nvim.keys("Yd")
57+
yank = nvim.cmd("echo @*")
58+
expect(yank).to contain_exactly("@@ -0,0 +1 @@\n", "+hello, world")
59+
end
60+
61+
it "can yank tag" do
62+
git.add_tag("test-tag", "HEAD")
63+
nvim.keys("Yt")
64+
yank = nvim.cmd("echo @*").first
65+
expect(yank).to eq("test-tag")
66+
end
67+
68+
it "can yank tags" do
69+
git.add_tag("test-tag-a", "HEAD")
70+
git.add_tag("test-tag-b", "HEAD")
71+
nvim.keys("Yt")
72+
yank = nvim.cmd("echo @*").first
73+
expect(yank).to eq("test-tag-a, test-tag-b")
2374
end
2475

2576
it "can open the bisect popup" do

spec/support/context/git.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
let(:git) { Git.open(Dir.pwd) }
55

66
before do
7-
system("touch testfile")
8-
97
git.config("user.email", "test@example.com")
108
git.config("user.name", "tester")
9+
10+
create_file("testfile", "hello, world\n")
1111
git.add("testfile")
12-
git.commit("Initial commit")
12+
git.commit("Initial commit\ncommit message")
1313
end
1414
end

0 commit comments

Comments
 (0)