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
6b92bfb
commit 887f909
Showing
5 changed files
with
79 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module Git | ||
module Open | ||
VERSION = "0.1.0" | ||
VERSION = "1.0.0" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,39 @@ | ||
require "spec_helper" | ||
|
||
describe Git::Open do | ||
RSpec.describe Git::Open do | ||
it "has a version number" do | ||
expect(Git::Open::VERSION).not_to be nil | ||
end | ||
end | ||
|
||
RSpec.describe Git::Open::CLI do | ||
it "works for origin" do | ||
expect(Launchy).to receive(:open).with("https://github.com/JuanitoFatas/git-open") | ||
|
||
Git::Open::CLI.execute | ||
end | ||
|
||
it "fallback if origin not found" do | ||
`git remote remove origin` | ||
`git remote add upstream https://github.com/EvilJuanitoFatas/git-open.git` | ||
|
||
expect(Launchy).to receive(:open).with("https://github.com/EvilJuanitoFatas/git-open") | ||
|
||
Git::Open::CLI.execute | ||
|
||
`git remote add origin git@github.com:JuanitoFatas/git-open.git` | ||
`git remote remove upstream` | ||
end | ||
|
||
context "something went wrong with the Git::Remote::Parser" do | ||
it "prints exception" do | ||
expect(Git::Remote::Parser).to receive_message_chain(:new, :parse, :html_url) { nil } | ||
failure_message = <<~FAILURE_MESSAGE | ||
Attempted to open `' and failed because Failure in opening uri nil with options {}: undefined method `to_hash' for nil:NilClass | ||
Did you mean? to_h | ||
FAILURE_MESSAGE | ||
|
||
expect { Git::Open::CLI.execute }.to output(failure_message).to_stdout | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__) | ||
require "git/open" | ||
require "launchy" | ||
require "git/remote/parser" |