Sha256: 00a590e2e4e409d7d3cf73178f792c6f6d5d324ac703ef620f75f438fa30d01e
Contents?: true
Size: 1.69 KB
Versions: 2
Compression:
Stored size: 1.69 KB
Contents
require 'spec_helper' require 'anvil/task/projects' describe Anvil::Task::Projects, fakefs: true do let(:dummy_class) do Class.new do include Anvil::Task::Projects end end let(:project) { 'anvil-core' } let(:project_path) { Anvil::Config.base_projects_path + "/#{project}" } subject { dummy_class.new } before { FileUtils.mkdir_p project_path } describe '#project_path' do it "returns the anvil's project path" do expect(subject.project_path(project)) .to eq(project_path) end end describe '#change_project' do let!(:previous_dir) { Dir.getwd } before { FileUtils.mkdir_p project_path } after { Dir.chdir previous_dir } it "cd's into the project's path" do subject.change_project(project) expect(Dir.getwd).to eq(project_path) end end describe '#on_project' do before { allow(subject).to receive(:git).and_return(double('git')) } it 'keeps the project changed inside the block' do subject.on_project project do expect(Dir.pwd).to eq(project_path) end end it 'yields a git project object' do expect { |b| subject.on_project(project, &b) }.to yield_with_args end it 'returns the same thing returned by the yielded block' do return_value = 'return-value' expect(subject.on_project(project) { return_value }).to eq(return_value) end end describe '#on_each_project' do let(:projects) { %w(anvil-core anvil-plugins) } before do expect(subject).to receive(:on_project).twice.and_yield(double('git')) end it 'works on each project' do expect { |b| subject.on_each_project(projects, &b) } .to yield_control.twice end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
anvil-core-0.6.0 | spec/lib/anvil/task/projects_spec.rb |
anvil-core-0.5.0 | spec/lib/anvil/task/projects_spec.rb |