spec/shelly/app_spec.rb in shelly-0.0.20.pre vs spec/shelly/app_spec.rb in shelly-0.0.20
- old
+ new
@@ -9,10 +9,20 @@
Shelly::Client.stub(:new).and_return(@client)
@app = Shelly::App.new
@app.code_name = "foo-staging"
end
+ describe "being initialized" do
+ it "should have default ruby_version: MRI-1.9.2" do
+ @app.ruby_version.should == "MRI-1.9.2"
+ end
+
+ it "should have default environment: production" do
+ @app.environment.should == "production"
+ end
+ end
+
describe ".guess_code_name" do
it "should return name of current working directory" do
Shelly::App.guess_code_name.should == "foo"
end
end
@@ -48,11 +58,11 @@
@app.databases = %w(postgresql mongodb)
@app.domains = %w(foo-staging.winniecloud.com foo.example.com)
FakeFS.deactivate!
expected = <<-config
foo-staging:
- ruby_version: 1.9.2 # 1.9.2 or ree
+ ruby: 1.9.2 # 1.9.2 or ree
environment: production # RAILS_ENV
monitoring_email:
- bob@example.com
domains:
- foo-staging.winniecloud.com
@@ -115,46 +125,48 @@
it "should create the app on shelly cloud via API client" do
@app.code_name = "fooo"
attributes = {
:code_name => "fooo",
:name => "fooo",
- :domains => nil
+ :environment => "production",
+ :ruby_version => "MRI-1.9.2",
+ :domain_name => nil
}
@client.should_receive(:create_app).with(attributes).and_return("git_url" => "git@git.shellycloud.com:fooo.git",
- "domains" => %w(fooo.shellyapp.com))
+ "domain_name" => "fooo.shellyapp.com")
@app.create
end
- it "should assign returned git_url, domains, ruby_version and environment" do
+ it "should assign returned git_url and domain" do
@client.stub(:create_app).and_return("git_url" => "git@git.example.com:fooo.git",
- "domains" => ["fooo.shellyapp.com"], "ruby_version" => "1.9.2", "environment" => "production")
+ "domain_name" => "fooo.shellyapp.com")
@app.create
@app.git_url.should == "git@git.example.com:fooo.git"
@app.domains.should == ["fooo.shellyapp.com"]
- @app.ruby_version.should == "1.9.2"
- @app.environment.should == "production"
end
end
context "with providing domain" do
it "should create the app on shelly cloud via API client" do
@app.code_name = "boo"
@app.domains = ["boo.shellyapp.com", "boo.example.com"]
attributes = {
:code_name => "boo",
:name => "boo",
- :domains => %w(boo.shellyapp.com boo.example.com)
+ :environment => "production",
+ :ruby_version => "MRI-1.9.2",
+ :domain_name => "boo.shellyapp.com boo.example.com"
}
@client.should_receive(:create_app).with(attributes).and_return("git_url" => "git@git.shellycloud.com:fooo.git",
- "domains" => %w(boo.shellyapp.com boo.example.com))
+ "domain_name" => "boo.shellyapp.com boo.example.com")
@app.create
end
it "should assign returned git_url and domain" do
@client.stub(:create_app).and_return("git_url" => "git@git.example.com:fooo.git",
- "domains" => %w(boo.shellyapp.com boo.example.com))
+ "domain_name" => "boo.shellyapp.com boo.example.com")
@app.create
- @app.domains.should == %w(boo.shellyapp.com boo.example.com)
+ @app.domains.should == ["boo.shellyapp.com", "boo.example.com"]
end
end
end
end