Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ lib/bundler/man
pkg
rdoc
spec/reports
spec/examples.txt
test/tmp
test/version_tmp
/.rvmrc
Expand Down
4 changes: 4 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
--color
--format documentation
--format html
--out spec_result.html
5 changes: 0 additions & 5 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,15 @@ require 'bundler/gem_tasks'
require 'rspec/core/rake_task'

namespace :spec do
RSPEC_OPTS = ["--format", "nested", "--format", "html", "--out", "spec_result.html", "--colour"]

RSpec::Core::RakeTask.new(:file) do |t|
t.rspec_opts = RSPEC_OPTS
t.pattern = ENV['SPEC_FILE']
end

RSpec::Core::RakeTask.new(:unit) do |t|
t.rspec_opts = RSPEC_OPTS
t.pattern = 'spec/unit/**/*_spec.rb'
end

RSpec::Core::RakeTask.new(:functional) do |t|
t.rspec_opts = RSPEC_OPTS
t.pattern = 'spec/functional/**/*_spec.rb'
end

Expand Down
2 changes: 1 addition & 1 deletion cf_deployer.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
gem.add_runtime_dependency 'diffy'
gem.add_development_dependency 'yard', '~> 0.8.7.6'
gem.add_development_dependency 'pry', '~> 0.10.1'
gem.add_development_dependency 'rspec', '2.14.1'
gem.add_development_dependency 'rspec', '~> 3.3'
gem.add_development_dependency 'rake', '~> 10.3.0'

gem.files = `git ls-files`.split($\).reject {|f| f =~ /^samples\// }
Expand Down
24 changes: 24 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,27 @@ def puts *args

end

RSpec.configure do |config|
config.example_status_persistence_file_path = 'spec/examples.txt'

config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
expectations.syntax = :expect # Disable `should`
end

config.filter_run :focus

config.mock_with :rspec do |mocks|
mocks.syntax = :expect # Disable `should_receive` and `stub`
# Prevents you from mocking or stubbing a method that does not exist on
# a real object. This is generally recommended, and will default to
# `true` in RSpec 4.
# mocks.verify_partial_doubles = true # causing tests to fail in base_spec
end

config.order = :random
config.run_all_when_everything_filtered = true
# config.warnings = true # way too many warnings right now

Kernel.srand config.seed
end
18 changes: 9 additions & 9 deletions spec/unit/application_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
end

it "application should get all components" do
@app.components.length.should eq(4)
@base.should_not be_nil
@db.should_not be_nil
@queue.should_not be_nil
@web.should_not be_nil
expect(@app.components.length).to eq(4)
expect(@base).not_to be_nil
expect(@db).not_to be_nil
expect(@queue).not_to be_nil
expect(@web).not_to be_nil
end

context "order components by dependencies" do
Expand Down Expand Up @@ -154,15 +154,15 @@
context "deploy all components" do
it "should deploy all components if no component specified" do
@app.deploy
@log.should eq("base db queue web ")
expect(@log).to eq("base db queue web ")
end
end

context "deploy some components" do
it "should deploy specified components" do
@context[:targets] = ['web', 'db']
@app.deploy
@log.should eq("db web ")
expect(@log).to eq("db web ")
end
end
end
Expand All @@ -179,13 +179,13 @@

it 'should get json templates for all components' do
@app.json
@log.should eq("base db queue web ")
expect(@log).to eq("base db queue web ")
end

it 'should get json templates for components specified' do
@context[:targets] = ['web', 'db']
@app.json
@log.should eq('db web ')
expect(@log).to eq('db web ')
end
end
end
6 changes: 3 additions & 3 deletions spec/unit/component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@

it "should ask strategy if component exists" do
expect(@strategy).to receive(:exists?){ true }
@web.exists?.should eq(true)
expect(@web.exists?).to eq(true)
end

it "should find direct dependencies" do
web = CfDeployer::Component.new('myApp', 'uat', 'web', {})
base = CfDeployer::Component.new('myApp', 'uat', 'base', {})
web.dependencies << base

web.depends_on?(base).should eq(true)
expect(web.depends_on?(base)).to eq(true)
end

it "should find transitive dependencies" do
Expand All @@ -87,7 +87,7 @@
haproxy.dependencies << base
web.dependencies << haproxy

web.depends_on?(base).should eq(true)
expect(web.depends_on?(base)).to eq(true)
end

it "should find cyclic dependency" do
Expand Down
Loading