<commit_before>package in_test

import (
	"io/ioutil"
	"os"
	"path/filepath"

	"github.com/jamiemonserrate/bintray-resource/fakes"
	"github.com/jamiemonserrate/bintray-resource/in"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("InCommand", func() {
	var (
		fakeBintrayClient fakes.BintrayClient
		destRootDir       string
		err               error
	)

	BeforeEach(func() {
		fakeBintrayClient = fakes.BintrayClient{}
		destRootDir, err = ioutil.TempDir("", "bintray-resource-integration-test")
		Expect(err).NotTo(HaveOccurred())
	})

	AfterEach(func() {
		err := os.RemoveAll(destRootDir)
		Expect(err).ToNot(HaveOccurred())
	})

	It("Downloads the correct package", func() {
		inRequest := in.InRequest{Source: in.Source{PackageName: "awesome-package"},
			RawVersion: in.Version{Number: "1.0.0"}}

		inCommand := in.NewInCommand(&fakeBintrayClient)
		inCommand.Execute(inRequest, "on-the-moon")

		Expect(fakeBintrayClient.PackageNameRequested).To(Equal("awesome-package"))
		Expect(fakeBintrayClient.VersionRequested).To(Equal("1.0.0"))
		Expect(fakeBintrayClient.DestinationDirRequested).To(Equal("on-the-moon"))
	})

	It("Creates the directory", func() {
		destDir := filepath.Join(destRootDir, "i-want-to-be-here")
		Expect(destDir).ToNot(BeAnExistingFile())

		inCommand := in.NewInCommand(&fakeBintrayClient)
		inCommand.Execute(in.InRequest{}, destDir)

		Expect(destDir).To(BeAnExistingFile())
	})

	It("Returns the version of the file in the response", func() {
		inRequest := in.InRequest{RawVersion: in.Version{Number: "0.0.1"}}

		inCommand := in.NewInCommand(&fakeBintrayClient)

		Expect(inCommand.Execute(inRequest, "")).To(Equal(in.InResponse{in.Version{Number: "0.0.1"}}))
	})
})<commit_msg>This test was creating a directory locally. Fixing.<commit_after>package in_test

import (
	"io/ioutil"
	"os"
	"path/filepath"

	"github.com/jamiemonserrate/bintray-resource/fakes"
	"github.com/jamiemonserrate/bintray-resource/in"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("InCommand", func() {
	var (
		fakeBintrayClient fakes.BintrayClient
		destRootDir       string
		err               error
	)

	BeforeEach(func() {
		fakeBintrayClient = fakes.BintrayClient{}
		destRootDir, err = ioutil.TempDir("", "bintray-resource-integration-test")
		Expect(err).NotTo(HaveOccurred())
	})

	AfterEach(func() {
		err := os.RemoveAll(destRootDir)
		Expect(err).ToNot(HaveOccurred())
	})

	It("Downloads the correct package", func() {
		destDir := filepath.Join(destRootDir, "on-the-moon")
		inRequest := in.InRequest{Source: in.Source{PackageName: "awesome-package"},
			RawVersion: in.Version{Number: "1.0.0"}}

		inCommand := in.NewInCommand(&fakeBintrayClient)
		inCommand.Execute(inRequest, destDir)

		Expect(fakeBintrayClient.PackageNameRequested).To(Equal("awesome-package"))
		Expect(fakeBintrayClient.VersionRequested).To(Equal("1.0.0"))
		Expect(fakeBintrayClient.DestinationDirRequested).To(Equal(destDir))
	})

	It("Creates the directory", func() {
		destDir := filepath.Join(destRootDir, "i-want-to-be-here")
		Expect(destDir).ToNot(BeAnExistingFile())

		inCommand := in.NewInCommand(&fakeBintrayClient)
		inCommand.Execute(in.InRequest{}, destDir)

		Expect(destDir).To(BeAnExistingFile())
	})

	It("Returns the version of the file in the response", func() {
		inRequest := in.InRequest{RawVersion: in.Version{Number: "0.0.1"}}

		inCommand := in.NewInCommand(&fakeBintrayClient)

		Expect(inCommand.Execute(inRequest, "")).To(Equal(in.InResponse{in.Version{Number: "0.0.1"}}))
	})
})
{'fraction_non_alphanumeric': 0.15923745444350995, 'fraction_numerical': 0.00672834314550042, 'mean_word_length': 5.1411359724612735, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1510412', 'n_tokens_mistral': 1384, 'n_tokens_neox': 1306, 'n_words': 176}