2019-09-04 21:01:54 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe TreeEntryPresenter do
|
2019-09-04 21:01:54 +05:30
|
|
|
include Gitlab::Routing.url_helpers
|
|
|
|
|
|
|
|
let(:project) { create(:project, :repository) }
|
|
|
|
let(:repository) { project.repository }
|
|
|
|
let(:tree) { Gitlab::Graphql::Representation::TreeEntry.new(repository.tree.trees.first, repository) }
|
|
|
|
let(:presenter) { described_class.new(tree) }
|
|
|
|
|
|
|
|
describe '.web_url' do
|
2020-03-13 15:44:24 +05:30
|
|
|
it { expect(presenter.web_url).to eq("http://localhost/#{project.full_path}/-/tree/#{tree.commit_id}/#{tree.path}") }
|
2019-09-04 21:01:54 +05:30
|
|
|
end
|
2020-10-24 23:57:45 +05:30
|
|
|
|
|
|
|
describe '#web_path' do
|
|
|
|
it { expect(presenter.web_path).to eq("/#{project.full_path}/-/tree/#{tree.commit_id}/#{tree.path}") }
|
|
|
|
end
|
2019-09-04 21:01:54 +05:30
|
|
|
end
|