Sha256: feab0c8d116739a41ec88fb0222432ea09d45f77ff3e2a080a6e765b7f641724
Contents?: true
Size: 1.3 KB
Versions: 4
Compression:
Stored size: 1.3 KB
Contents
require 'test_helper' module Gemdiff class RepoFinderTest < MiniTest::Spec describe ".github_url" do it "returns github url from gemspec" do RepoFinder.stubs find_homepage_in_spec: "homepage: http://github.com/rails/arel" assert_equal "http://github.com/rails/arel", RepoFinder.github_url("arel") end it "returns github url from github search" do RepoFinder.stubs octokit_client: mock_octokit("haml/haml") RepoFinder.stubs find_homepage_in_spec: "" assert_equal "http://github.com/haml/haml", RepoFinder.github_url("haml") end it "returns nil when not found" do RepoFinder.stubs octokit_client: mock_octokit(nil) RepoFinder.stubs find_homepage_in_spec: "" assert_nil RepoFinder.github_url("not_found") end it "returns exception url" do assert_equal "http://github.com/rails/rails", RepoFinder.github_url('activerecord') end end private def mock_octokit(full_name) mock_items = if full_name.nil? mock { stubs items: [] } else mock_item = mock { stubs full_name: full_name } mock { stubs items: [mock_item] } end mock { stubs search_repositories: mock_items } end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
gemdiff-0.5.1 | test/repo_finder_test.rb |
gemdiff-0.5.0 | test/repo_finder_test.rb |
gemdiff-0.4.2 | test/repo_finder_test.rb |
gemdiff-0.4.1 | test/repo_finder_test.rb |