Sha256: eda8e8a670669f6a452e394e61333c546de98ca08a880a4c950645a53cbfb22f
Contents?: true
Size: 1.46 KB
Versions: 1
Compression:
Stored size: 1.46 KB
Contents
require File.dirname(__FILE__)+'/../spec_helper' describe Ginst::Project do context "Base" do before(:each) do ::Grit::Repo.stub!(:new).and_return(true) File.should_receive(:read).with('./projects.yml').and_return("--- \n- !ruby/object:Ginst::Project \n dir: /home/guille\n name: guille\n") Ginst::Ginst.working_dir = '.' Ginst::Project.load_projects end it "should load existing projects" do prjs = Ginst::Project.projects prjs.size.should == 1 prjs.first.dir.should == '/home/guille' prjs.first.name.should == 'guille' end it "should be able to save" do file = Object.new File.should_receive(:open).with('./projects.yml','w').and_return(file) file.should_receive(:write).with( "--- \n- !ruby/object:Ginst::Project \n dir: /home/guille\n name: guille\n- !ruby/object:Ginst::Project \n dir: dir\n name: prj\n") file.should_receive(:close) Ginst::Project.new(VALID_ARGS).save.should be end it "should be not create a project when update" do file = Object.new File.should_receive(:open).with('projects.yml','w').and_return(file) file.should_receive(:write).with("--- \n- !ruby/object:Ginst::Project \n dir: /home/guille\n name: Project 2\n") file.should_receive(:close) Ginst::Project.projects Ginst::Project.projects.first.name = 'Project 2' Ginst::Project.projects.first.save.should be end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ginst-0.2.2 | spec/models/project_base_spec.rb |