Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions spec/github-file-spec.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
GitHubFile = require '../lib/github-file'
Project = require 'project'
fsUtils = require 'fs-utils'
{fs} = require 'atom'
path = require 'path'

describe "GitHubFile", ->
Expand All @@ -13,23 +12,23 @@ describe "GitHubFile", ->
path.join(__dirname, "fixtures", "#{fixtureName}.git")

setupWorkingDir = (fixtureName) ->
fsUtils.makeTree workingDirPath
fsUtils.move fixturePath(fixtureName), path.join(workingDirPath, '.git')
fs.makeTree workingDirPath
fs.move fixturePath(fixtureName), path.join(workingDirPath, '.git')

subdirectoryPath = path.join(workingDirPath, 'some-dir')
fsUtils.makeTree subdirectoryPath
fs.makeTree subdirectoryPath

filePath = path.join(subdirectoryPath, 'some-file.md')
fsUtils.writeSync filePath, 'some file content'
fs.writeSync filePath, 'some file content'

setupGithubFile = ->
project.setPath(workingDirPath)
editSession = project.open(filePathRelativeToWorkingDir)
githubFile = GitHubFile.fromPath(editSession.getPath())

teardownWorkingDirAndRestoreFixture = (fixtureName) ->
fsUtils.move path.join(workingDirPath, '.git'), fixturePath(fixtureName)
fsUtils.remove workingDirPath
fs.move path.join(workingDirPath, '.git'), fixturePath(fixtureName)
fs.remove workingDirPath

describe "open", ->
describe "when the file is openable on GitHub.com", ->
Expand Down