spec/shelly/app_spec.rb in shelly-0.0.9 vs spec/shelly/app_spec.rb in shelly-0.0.10
- old
+ new
@@ -17,14 +17,20 @@
Shelly::App.guess_code_name.should == "foo"
end
end
describe "#add_git_remote" do
+ before { @app.stub(:system) }
it "should add git remote with proper name and git repository" do
@app.should_receive(:system).with("git remote add staging git@git.shellycloud.com:foo-staging.git")
@app.add_git_remote
end
+
+ it "should remove existing git remote first if invoked with true as first argument" do
+ @app.should_receive(:system).with("git remote rm staging")
+ @app.add_git_remote(true)
+ end
end
describe "#generate_cloudfile" do
it "should return generated cloudfile" do
user = mock(:email => "bob@example.com")
@@ -108,8 +114,26 @@
:environment => "dev",
:ruby_version => "MRI-1.9.2",
:domain_name => "fooo.shellycloud.com"
})
@app.create
+ end
+ end
+
+ describe "#remote_exists?" do
+ context "remote with purpose as name exists" do
+ it "should return true" do
+ @app.purpose = "shelly-prod"
+ IO.stub_chain(:popen, :read => "origin\nshelly-prod\ntest")
+ @app.should be_remote_exists
+ end
+ end
+
+ context "remote with purpose as name doesn't exist" do
+ it "should return false" do
+ @app.purpose = "shelly"
+ IO.stub_chain(:popen, :read => "origin\nshelly-prod\ntest")
+ @app.should_not be_remote_exists
+ end
end
end
end