test/libdolt/view/blob_test.rb in libdolt-0.6.0 vs test/libdolt/view/blob_test.rb in libdolt-0.6.2
- old
+ new
@@ -15,54 +15,18 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#++
require "test_helper"
require "libdolt/view/single_repository"
-require "libdolt/view/multi_repository"
require "libdolt/view/blob"
+require "libdolt/view/urls"
describe Dolt::View::Blob do
include Dolt::View::Blob
+ include Dolt::View::Urls
+ include Dolt::View::SingleRepository
- describe "single repo mode" do
- include Dolt::View::SingleRepository
-
- it "returns blame url" do
- url = blame_url("myrepo", "master", "some/path")
- assert_equal "/blame/master:some/path", url
- end
-
- it "returns history url" do
- url = history_url("myrepo", "master", "some/path")
- assert_equal "/history/master:some/path", url
- end
-
- it "returns raw url" do
- url = raw_url("myrepo", "master", "some/path")
- assert_equal "/raw/master:some/path", url
- end
- end
-
- describe "multi repo mode" do
- include Dolt::View::MultiRepository
-
- it "returns blame url" do
- url = blame_url("myrepo", "master", "some/path")
- assert_equal "/myrepo/blame/master:some/path", url
- end
-
- it "returns history url" do
- url = history_url("myrepo", "master", "some/path")
- assert_equal "/myrepo/history/master:some/path", url
- end
-
- it "returns raw url" do
- url = raw_url("myrepo", "master", "some/path")
- assert_equal "/myrepo/raw/master:some/path", url
- end
- end
-
describe "#multiline" do
it "adds line number markup to code" do
html = multiline("A few\nLines\n Here")
assert_match "<pre", html
@@ -87,22 +51,18 @@
assert_match /<hey>/, html
end
end
describe "#format_binary_blob" do
- include Dolt::View::SingleRepository
-
it "renders link to binary blob" do
content = "GIF89aK\000 \000\367\000\000\266\270\274\335\336\337\214"
html = format_binary_blob("some/file.gif", content, "gitorious", "master")
assert_match /<a href="\/raw\/master:some\/file.gif"/, html
assert_match "Download file.gif", html
end
end
describe "#format_blob" do
- include Dolt::View::SingleRepository
-
it "renders link to binary blob" do
content = "GIF89aK\000 \000\367\000\000\266\270\274\335\336\337\214"
html = format_blob("file.gif", content, "gitorious", "master")
assert_match "Download file.gif", html
end