furi-git-prompt 0.0.4 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/furi/git/git.rb +6 -1
- data/lib/furi/git/git_system_call.rb +1 -1
- data/lib/furi/git/prompt/version.rb +1 -1
- data/spec/furi/git/git_spec.rb +27 -3
- 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: f9e5ed6478cfdddcd30c864c75cb7c5d169e19b5
|
4
|
+
data.tar.gz: cb5d1cd5ae5721fcab7289b3718314e6ff8af253
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08e4a08dc195538bfeff736d80f58268f74db5636a054fcaab5a91b0c60a26f7e34ce4ce0f5e4676ad58a94cab7918ae43e43da184dc3dee00f5af01e850d1d3
|
7
|
+
data.tar.gz: b1eab1c25b2ae338ca4cfbf7892ab58139b081fb17b20ea1544aa5f0d0c9fe9f93d60b6552a4104942b8d9d222605798edd6e6c96b2f2fefa905625f956313af
|
data/lib/furi/git/git.rb
CHANGED
data/spec/furi/git/git_spec.rb
CHANGED
@@ -3,9 +3,33 @@ require 'rspec'
|
|
3
3
|
require 'furi/git/git'
|
4
4
|
|
5
5
|
describe Git do
|
6
|
-
|
7
|
-
|
8
|
-
GitSystemCall.any_instance.stub(:git_branch).and_return('master')
|
6
|
+
it 'shows the current branch name of a git repository' do
|
7
|
+
GitSystemCall.any_instance.stub(:git_branch).and_return('* master')
|
9
8
|
Git.new.branch.should == 'master'
|
10
9
|
end
|
10
|
+
|
11
|
+
context 'more than one git repository exist' do
|
12
|
+
it 'shows the current branch name of a git repository if branch is first item in list' do
|
13
|
+
GitSystemCall.any_instance.stub(:git_branch).and_return("* master\n sec branch\n third branch")
|
14
|
+
Git.new.branch.should == 'master'
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'shows the current branch name of a git repository if branch is second item in list' do
|
18
|
+
GitSystemCall.any_instance.stub(:git_branch).and_return(" sec branch\n * master\n third branch")
|
19
|
+
Git.new.branch.should == 'master'
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'shows the current branch name of a git repository if branch is last item in list' do
|
23
|
+
GitSystemCall.any_instance.stub(:git_branch).and_return(" sec branch\n third branch\n * master")
|
24
|
+
Git.new.branch.should == 'master'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context 'no git repository exist' do
|
29
|
+
it 'shows nothing' do
|
30
|
+
GitSystemCall.any_instance.stub(:git_branch).and_return("fatal: Not a git repository (or any of the parent directories): .git\n")
|
31
|
+
Git.new.branch.should be_empty
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
11
35
|
end
|