spec/jumpup/heroku/configuration_spec.rb in jumpup-heroku-0.0.5 vs spec/jumpup/heroku/configuration_spec.rb in jumpup-heroku-0.0.6
- old
+ new
@@ -13,21 +13,19 @@
before do
Jumpup::Heroku.configure do |config|
end
end
- subject do
- Jumpup::Heroku.configuration
- end
+ subject { Jumpup::Heroku.configuration }
- its(:app) { should be_nil }
- its(:staging_app) { should be_nil }
- its(:production_app) { should be_nil }
- its(:run_database_tasks) { should be_true }
- its(:host) { should == 'heroku.com' }
- its(:deploy_branch) { should eq('master') }
- its(:deploy_to_production_branch) { should eq('master') }
+ it { expect(subject.app).to be_nil }
+ it { expect(subject.staging_app).to be_nil }
+ it { expect(subject.production_app).to be_nil }
+ it { expect(subject.run_database_tasks).to be_truthy }
+ it { expect(subject.host).to eq('heroku.com') }
+ it { expect(subject.deploy_branch).to eq('master') }
+ it { expect(subject.deploy_to_production_branch).to eq('master') }
end
describe "with configurations" do
before do
@@ -38,28 +36,26 @@
config.run_database_tasks = false
config.host = 'myhost.com'
end
end
- subject do
- Jumpup::Heroku.configuration
- end
+ subject { Jumpup::Heroku.configuration }
- its(:app) { should eq('myapp') }
- its(:staging_app) { should eq('myapp-staging')}
- its(:production_app) { should eq('myapp-production') }
- its(:run_database_tasks) { should be_false }
- its(:host) { should eq('myhost.com') }
- its(:deploy_branch) { should eq('master') }
- its(:deploy_to_production_branch) { should eq('production') }
+ it { expect(subject.app).to eq('myapp') }
+ it { expect(subject.staging_app).to eq('myapp-staging')}
+ it { expect(subject.production_app).to eq('myapp-production') }
+ it { expect(subject.run_database_tasks).to be_falsey }
+ it { expect(subject.host).to eq('myhost.com') }
+ it { expect(subject.deploy_branch).to eq('master') }
+ it { expect(subject.deploy_to_production_branch).to eq('production') }
end
describe "with multiple accounts" do
context "first account" do
- before { ENV.stub(:[]).with("HEROKU_ACCOUNT").and_return("first") }
+ before { allow(ENV).to receive(:[]).with("HEROKU_ACCOUNT").and_return("first") }
before do
Jumpup::Heroku.configure do |config|
config.app = 'myapp'
config.run_database_tasks = false
config.account(:first) do |first|
@@ -71,25 +67,23 @@
second.staging_app = 'myapp2-staging'
end
end
end
- subject do
- Jumpup::Heroku.configuration
- end
+ subject { Jumpup::Heroku.configuration }
- its(:valid?) { should be_true }
- its(:app) { should be_nil }
- its(:staging_app) { should eq('myapp1-staging')}
- its(:production_app) { should eq('myapp1-production') }
- its(:run_database_tasks) { should be_false }
- its(:host) { should eq('heroku.first') }
+ it { expect(subject.valid?).to be_truthy }
+ it { expect(subject.app).to be_nil }
+ it { expect(subject.staging_app).to eq('myapp1-staging')}
+ it { expect(subject.production_app).to eq('myapp1-production') }
+ it { expect(subject.run_database_tasks).to be_falsey }
+ it { expect(subject.host).to eq('heroku.first') }
end
context "second account with default values" do
- before { ENV.stub(:[]).with("HEROKU_ACCOUNT").and_return("second") }
+ before { allow(ENV).to receive(:[]).with("HEROKU_ACCOUNT").and_return("second") }
before do
Jumpup::Heroku.configure do |config|
config.production_app = 'myapp1-production'
config.staging_app = 'myapp1-staging'
config.run_database_tasks = true
@@ -100,25 +94,23 @@
second.host = 'mysecondhost.com'
end
end
end
- subject do
- Jumpup::Heroku.configuration
- end
+ subject { Jumpup::Heroku.configuration }
- its(:valid?) { should be_true }
- its(:app) { should be_nil }
- its(:staging_app) { should eq('myapp2-staging')}
- its(:production_app) { should eq('myapp2-production') }
- its(:run_database_tasks) { should be_false }
- its(:host) { should eq('mysecondhost.com') }
+ it { expect(subject.valid?).to be_truthy }
+ it { expect(subject.app).to be_nil }
+ it { expect(subject.staging_app).to eq('myapp2-staging')}
+ it { expect(subject.production_app).to eq('myapp2-production') }
+ it { expect(subject.run_database_tasks).to be_falsey }
+ it { expect(subject.host).to eq('mysecondhost.com') }
end
context "other account" do
- before { ENV.stub(:[]).with("HEROKU_ACCOUNT").and_return("third") }
+ before { allow(ENV).to receive(:[]).with("HEROKU_ACCOUNT").and_return("third") }
before do
Jumpup::Heroku.configure do |config|
config.account(:first) do |first|
first.app = 'myapp1'
first.production_app = 'myapp1-production'
@@ -131,24 +123,22 @@
end
config.run_database_tasks = false
end
end
- subject do
- Jumpup::Heroku.configuration
- end
+ subject { Jumpup::Heroku.configuration }
- its(:valid?) { should be_false }
- its(:app) { should be_nil }
- its(:staging_app) { should be_nil }
- its(:production_app) { should be_nil }
- its(:run_database_tasks) { should be_false }
- its(:host) { should eq('heroku.com') }
+ it { expect(subject.valid?).to be_falsey }
+ it { expect(subject.app).to be_nil }
+ it { expect(subject.staging_app).to be_nil }
+ it { expect(subject.production_app).to be_nil }
+ it { expect(subject.run_database_tasks).to be_falsey }
+ it { expect(subject.host).to eq('heroku.com') }
end
context "without heroku accounts installed" do
- before { Jumpup::Heroku::Configuration.any_instance.stub(:current_account).and_return(:"") }
+ before { allow_any_instance_of(Jumpup::Heroku::Configuration).to receive(:current_account).and_return(:"") }
before do
Jumpup::Heroku.configure do |config|
config.account(:second) do |second|
second.app = 'myapp2'
second.production_app = 'myapp2-production'
@@ -156,24 +146,22 @@
config.run_database_tasks = false
end
end
end
- subject do
- Jumpup::Heroku.configuration
- end
+ subject { Jumpup::Heroku.configuration }
- its(:valid?) { should be_false }
- its(:app) { should be_nil }
- its(:staging_app) { should be_nil }
- its(:production_app) { should be_nil }
- its(:run_database_tasks) { should be_true }
- its(:host) { should eq('heroku.com') }
+ it { expect(subject.valid?).to be_falsey }
+ it { expect(subject.app).to be_nil }
+ it { expect(subject.staging_app).to be_nil }
+ it { expect(subject.production_app).to be_nil }
+ it { expect(subject.run_database_tasks).to be_truthy }
+ it { expect(subject.host).to eq('heroku.com') }
end
- context "without herou accounts installed and default values" do
- before { Jumpup::Heroku::Configuration.any_instance.stub(:current_account).and_return(:"") }
+ context "without heroku accounts installed and default values" do
+ before { allow_any_instance_of(Jumpup::Heroku::Configuration).to receive(:current_account).and_return(:"") }
before do
Jumpup::Heroku.configure do |config|
config.production_app = 'myapp1-production'
config.staging_app = 'myapp1-staging'
config.run_database_tasks = true
@@ -183,19 +171,17 @@
config.run_database_tasks = false
end
end
end
- subject do
- Jumpup::Heroku.configuration
- end
+ subject { Jumpup::Heroku.configuration }
- its(:valid?) { should be_true }
- its(:app) { should be_nil }
- its(:staging_app) { should eq('myapp1-staging')}
- its(:production_app) { should eq('myapp1-production') }
- its(:run_database_tasks) { should be_true }
+ it { expect(subject.valid?).to be_truthy }
+ it { expect(subject.app).to be_nil }
+ it { expect(subject.staging_app).to eq('myapp1-staging')}
+ it { expect(subject.production_app).to eq('myapp1-production') }
+ it { expect(subject.run_database_tasks).to be_truthy }
end
end
end
describe "#valid?" do
@@ -361,10 +347,10 @@
before do
Jumpup::Heroku.configuration = nil
end
it 'not be valid' do
- pending "The bug is raised when have no config/initialier/heroku-deploy.rb file"
+ skip "The bug is raised when have no config/initializer/heroku-deploy.rb file"
expect(Jumpup::Heroku.configuration).to_not be_valid
end
end
end
end