spec/cli/add_spec.rb in bpm-1.0.0.rc.3 vs spec/cli/add_spec.rb in bpm-1.0.0.rc.4

- old
+ new

@@ -15,11 +15,11 @@ end it "must be called from within a project" do cd home # outside of project bpm "add", "jquery", :track_stderr => true - stderr.read.should include("inside of a bpm project") + stderr.read.should include("inside of a BPM project") end it "should add a new hard dependency" do bpm 'add', 'jquery' wait @@ -175,34 +175,49 @@ it "should add as a development dependency" do bpm "add", "custom_generator", "--dev" and wait output = stdout.read output.should include("Added development package 'custom_generator' (1.0)") - + bpm 'rebuild', '--mode=debug' and wait has_development_dependency 'custom_generator', '1.0' no_dependency 'custom_generator', false end end end describe "bpm add using a vendor directory" do - before do + before do goto_home set_host start_fake(FakeGemServer.new) FileUtils.cp_r project_fixture('hello_dev'), '.' FileUtils.mkdir_p home('hello_dev', 'vendor') FileUtils.cp_r project_fixture('hello_world'), home('hello_dev', 'vendor', 'hello_world') cd home('hello_dev') end - + it "should include custom_package defined in a project found vendor" do bpm 'add', 'custom_package' and wait - + File.read(home('hello_dev', 'assets', 'bpm_libs.js')).should include("custom_package (2.0.0)") end - + end +describe "bpm add with a package" do + before do + goto_home + set_host + start_fake(FakeGemServer.new) + FileUtils.cp_r(package_fixture('spade'), '.') + cd home('spade') + end + + it "should add dependency to package.json" do + File.read(home('spade', 'package.json')).should_not include('jquery') + bpm 'add', 'jquery', '--package' and wait + File.read(home('spade', 'package.json')).should include('jquery') + end +end