|
101 | 101 | describe "#version" do |
102 | 102 | context "with a normal version number" do |
103 | 103 | before do |
104 | | - expect(git_proxy).to receive(:git_local).with("--version"). |
| 104 | + expect(described_class).to receive(:full_version). |
105 | 105 | and_return("git version 1.2.3") |
106 | 106 | end |
107 | 107 |
|
|
116 | 116 |
|
117 | 117 | context "with a OSX version number" do |
118 | 118 | before do |
119 | | - expect(git_proxy).to receive(:git_local).with("--version"). |
| 119 | + expect(described_class).to receive(:full_version). |
120 | 120 | and_return("git version 1.2.3 (Apple Git-BS)") |
121 | 121 | end |
122 | 122 |
|
|
131 | 131 |
|
132 | 132 | context "with a msysgit version number" do |
133 | 133 | before do |
134 | | - expect(git_proxy).to receive(:git_local).with("--version"). |
| 134 | + expect(described_class).to receive(:full_version). |
135 | 135 | and_return("git version 1.2.3.msysgit.0") |
136 | 136 | end |
137 | 137 |
|
|
148 | 148 | describe "#full_version" do |
149 | 149 | context "with a normal version number" do |
150 | 150 | before do |
151 | | - expect(git_proxy).to receive(:git_local).with("--version"). |
152 | | - and_return("git version 1.2.3") |
| 151 | + status = double("success?" => true) |
| 152 | + expect(Open3).to receive(:capture3).with("git", "--version"). |
| 153 | + and_return(["git version 1.2.3", "", status]) |
153 | 154 | end |
154 | 155 |
|
155 | 156 | it "returns the git version number" do |
|
159 | 160 |
|
160 | 161 | context "with a OSX version number" do |
161 | 162 | before do |
162 | | - expect(git_proxy).to receive(:git_local).with("--version"). |
163 | | - and_return("git version 1.2.3 (Apple Git-BS)") |
| 163 | + status = double("success?" => true) |
| 164 | + expect(Open3).to receive(:capture3).with("git", "--version"). |
| 165 | + and_return(["git version 1.2.3 (Apple Git-BS)", "", status]) |
164 | 166 | end |
165 | 167 |
|
166 | 168 | it "does not strip out OSX specific additions in the version string" do |
|
170 | 172 |
|
171 | 173 | context "with a msysgit version number" do |
172 | 174 | before do |
173 | | - expect(git_proxy).to receive(:git_local).with("--version"). |
174 | | - and_return("git version 1.2.3.msysgit.0") |
| 175 | + status = double("success?" => true) |
| 176 | + expect(Open3).to receive(:capture3).with("git", "--version"). |
| 177 | + and_return(["git version 1.2.3.msysgit.0", "", status]) |
175 | 178 | end |
176 | 179 |
|
177 | 180 | it "does not strip out msysgit specific additions in the version string" do |
|
0 commit comments