require_relative '../lib/projects.rb' require 'fileutils' describe Projects do it "should be able to add a new Project" do projects=Projects.new projects['github/dev_projects.gem'] = 'https://github.com/lou-parslow/dev_projects.gem.git' projects.update expect(projects['github/dev_projects.gem'].is_a?(Project)).to eq(true) expect(projects['github/dev_projects.gem'][:name]).to eq('github/dev_projects.gem') end it "should be able to store and load" do FileUtils.mkdir('tmp') if(!File.exists?('tmp')) FileUtils.rm('tmp/test.project.json') if(File.exists?('tmp/test.project.json')) expect(File.exists?('tmp/test.project.json')).to eq(false) projects=Projects.new projects['github/dev_projects.gem'] = 'https://github.com/lou-parslow/dev_projects.gem.git' projects.save 'tmp/test.project.json' expect(File.exists?('tmp/test.project.json')).to eq(true) projects2=Projects.new projects2.open 'tmp/test.project.json' expect(projects2['github/dev_projects.gem'].is_a?(Project)).to eq(true) FileUtils.rm('tmp/test.project.json') if(File.exists?('tmp/test.project.json')) end it "should be able to get the current Project" do expect(Projects.current).not_to eq(nil) end it "should be able to pull" do projects=Projects.new projects.pull end end