diff --git a/Gemfile b/Gemfile index 6c3cfb4a61d..00ade5c22a7 100644 --- a/Gemfile +++ b/Gemfile @@ -51,7 +51,7 @@ group :development, :test do gemspec path: 'bosh-dev' gemspec path: 'bosh-stemcell' - gem 'rspec', '3.0.0.beta1' + gem 'rspec', '~> 3.0' gem 'rspec-its' gem 'rubocop', require: false diff --git a/Gemfile.lock b/Gemfile.lock index ea92b5b3558..99311d35d1c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -365,27 +365,27 @@ GEM resque (>= 1.0) rest-client (1.6.7) mime-types (>= 1.16) - rspec (3.0.0.beta1) - rspec-core (= 3.0.0.beta1) - rspec-expectations (= 3.0.0.beta1) - rspec-mocks (= 3.0.0.beta1) - rspec-core (3.0.0.beta1) - rspec-support (= 3.0.0.beta1) - rspec-expectations (3.0.0.beta1) - diff-lcs (>= 1.1.3, < 2.0) - rspec-support (= 3.0.0.beta1) + rspec (3.0.0) + rspec-core (~> 3.0.0) + rspec-expectations (~> 3.0.0) + rspec-mocks (~> 3.0.0) + rspec-core (3.0.0) + rspec-support (~> 3.0.0) + rspec-expectations (3.0.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.0.0) + rspec-instafail (0.2.4) rspec-its (1.0.1) rspec-core (>= 2.99.0.beta1) rspec-expectations (>= 2.99.0.beta1) - rspec-mocks (3.0.0.beta1) - rspec-support (= 3.0.0.beta1) - rspec-support (3.0.0.beta1) - rubocop (0.22.0) - json (>= 1.7.7, < 2) - parser (~> 2.1.9) - powerpack (~> 0.0.6) - rainbow (>= 1.99.1, < 3.0) - ruby-progressbar (~> 1.4) + rspec-mocks (3.0.0) + rspec-support (~> 3.0.0) + rspec-support (3.0.0) + rubocop (0.10.0) + backports (~> 3.3.3) + parser (= 2.0.0.pre2) + powerpack (= 0.0.1) + rainbow (>= 1.1.4) ruby-atmos-pure (1.0.5) log4r (>= 1.1.9) ruby-hmac (>= 0.4.0) @@ -495,7 +495,8 @@ DEPENDENCIES rake (~> 10.0) redis rest-client - rspec (= 3.0.0.beta1) + rspec (~> 3.0) + rspec-instafail rspec-its rubocop ruby_gntp diff --git a/bosh-director/bosh-director.gemspec b/bosh-director/bosh-director.gemspec index 5a42eec26ff..7e524b9ff7b 100644 --- a/bosh-director/bosh-director.gemspec +++ b/bosh-director/bosh-director.gemspec @@ -48,6 +48,8 @@ Gem::Specification.new do |s| s.add_dependency 'membrane', '~>0.0.2' s.add_dependency 'semi_semantic', '~>1.1.0' + s.add_development_dependency 'timecop' + s.bindir = 'bin' s.executables << 'bosh-director' s.executables << 'bosh-director-console' diff --git a/bosh-director/spec/unit/jobs/snapshot_deployment_spec.rb b/bosh-director/spec/unit/jobs/snapshot_deployment_spec.rb index 0051f36553b..e4b69df01eb 100644 --- a/bosh-director/spec/unit/jobs/snapshot_deployment_spec.rb +++ b/bosh-director/spec/unit/jobs/snapshot_deployment_spec.rb @@ -88,20 +88,22 @@ module Bosh::Director let(:fake_nats) { double('nats') } it 'sends an alert over NATS on hm.director.alert' do - fake_nats.should_receive(:publish).with('hm.director.alert', json_match( - eq( - { - 'id' => 'director', - 'severity' => 3, - 'title' => 'director - snapshot failure', - 'summary' => "failed to snapshot #{job}/#{index}: hello", - 'created_at' => anything, - } - )) - ) - - Bosh::Director::Config.stub(:nats => fake_nats) - subject.send_alert(fake_instance, 'hello') + Timecop.freeze do + fake_nats.should_receive(:publish).with('hm.director.alert', json_match( + eq( + { + 'id' => 'director', + 'severity' => 3, + 'title' => 'director - snapshot failure', + 'summary' => "failed to snapshot #{job}/#{index}: hello", + 'created_at' => Time.now.to_i, + } + )) + ) + + Bosh::Director::Config.stub(:nats => fake_nats) + subject.send_alert(fake_instance, 'hello') + end end end end diff --git a/bosh-stemcell/Berksfile.lock b/bosh-stemcell/Berksfile.lock index ac0bf168367..275626a5188 100644 --- a/bosh-stemcell/Berksfile.lock +++ b/bosh-stemcell/Berksfile.lock @@ -1,31 +1,8 @@ -{ - "sources": { - "golang": { - "locked_version": "1.1.2" - }, - "stemcell-golang": { - "path": "./sites-cookbooks/stemcell-golang" - }, - "git": { - "locked_version": "2.8.4" - }, - "dmg": { - "locked_version": "2.0.8" - }, - "build-essential": { - "locked_version": "1.4.2" - }, - "windows": { - "locked_version": "1.11.0" - }, - "chef_handler": { - "locked_version": "1.1.4" - }, - "yum": { - "locked_version": "2.4.4" - }, - "runit": { - "locked_version": "1.4.6" - } - } -} +DEPENDENCIES + golang + stemcell-golang + path: sites-cookbooks/stemcell-golang + +GRAPH + golang (1.3.0) + stemcell-golang (0.0.1) diff --git a/bosh-stemcell/lib/monkeypatch/serverspec/backend/exec.rb b/bosh-stemcell/lib/monkeypatch/serverspec/backend/exec.rb index 279e99ea1d3..1d12cf19967 100644 --- a/bosh-stemcell/lib/monkeypatch/serverspec/backend/exec.rb +++ b/bosh-stemcell/lib/monkeypatch/serverspec/backend/exec.rb @@ -32,7 +32,8 @@ class Exec def run_command(cmd, opts={}) cmd = build_command(cmd) cmd = add_pre_command(cmd) - cmd = build_command(cmd) + # In ruby 1.9, it is possible to use Open3.capture3, but not in 1.8 + # stdout, stderr, status = Open3.capture3(cmd) if use_chroot? chroot_stdout = `#{chroot_cmd(cmd)} 2>&1` @@ -43,12 +44,10 @@ def run_command(cmd, opts={}) stdout = run_with_no_ruby_environment { `#{cmd} 2>&1` } exit_status = $?.exitstatus end - # In ruby 1.9, it is possible to use Open3.capture3, but not in 1.8 - #stdout, stderr, status = Open3.capture3(cmd) if @example @example.metadata[:command] = cmd - @example.metadata[:stdout] = stdout + @example.metadata[:stdout] = stdout end CommandResult.new :stdout => stdout, :exit_status => exit_status diff --git a/bosh-stemcell/spec/support/serverspec.rb b/bosh-stemcell/spec/support/serverspec.rb index 68379292f67..a1b6e099ba1 100644 --- a/bosh-stemcell/spec/support/serverspec.rb +++ b/bosh-stemcell/spec/support/serverspec.rb @@ -2,47 +2,7 @@ # `example` method monkey path unless SpecInfra::VERSION == '1.15.0' - raise "Unexpected SpecInfra version #{SpecInfra::VERSION}" -end - -RSpec.configure do |c| - # RSpec 3.0 explicitly passes in example method into - # before(:each) so we delete non-compatible before each - # added in `lib/specinfra.rb`. - c.hooks[:before][:each].pop - - # c.before do # before - c.before do |example| # after - if respond_to?(:backend) && backend.respond_to?(:set_example) - backend.set_example(example) - end - end -end - -SpecInfra::Helper::Configuration.class_eval do - # Rspec 3.0 removed `example`method but introduced `RSpec.current_example` - def subject - # example.metadata[:subject] = described_class # before - RSpec.current_example.metadata[:subject] = described_class # after - build_configurations - super - end -end - -SpecInfra::Backend::Exec.class_eval do - alias_method :check_os_with_broken_ubuntu_detection, :check_os - - # SpecInfra does not properly detect lsb_release - # so we have to correct family that is returned - # Used to return 'Distributor ID:\tUbuntu\n' as family. - def check_os - result = check_os_with_broken_ubuntu_detection - family = result[:family] - if family.include?('Distributor ID:') - result[:family] = family.split(/\s+/, 3).last.strip - end - result - end + raise "Unexpected Specinfra version #{SpecInfra::VERSION}" end # Exec monkey path diff --git a/vendor/cache/rspec-3.0.0.beta1.gem b/vendor/cache/rspec-3.0.0.beta1.gem deleted file mode 100644 index ff585bd5e2f..00000000000 Binary files a/vendor/cache/rspec-3.0.0.beta1.gem and /dev/null differ diff --git a/vendor/cache/rspec-3.0.0.gem b/vendor/cache/rspec-3.0.0.gem new file mode 100644 index 00000000000..28e57f844fe Binary files /dev/null and b/vendor/cache/rspec-3.0.0.gem differ diff --git a/vendor/cache/rspec-core-3.0.0.beta1.gem b/vendor/cache/rspec-core-3.0.0.beta1.gem deleted file mode 100644 index 99f38c0a243..00000000000 Binary files a/vendor/cache/rspec-core-3.0.0.beta1.gem and /dev/null differ diff --git a/vendor/cache/rspec-core-3.0.0.gem b/vendor/cache/rspec-core-3.0.0.gem new file mode 100644 index 00000000000..438ffe6e802 Binary files /dev/null and b/vendor/cache/rspec-core-3.0.0.gem differ diff --git a/vendor/cache/rspec-expectations-3.0.0.beta1.gem b/vendor/cache/rspec-expectations-3.0.0.beta1.gem deleted file mode 100644 index c60338fdf47..00000000000 Binary files a/vendor/cache/rspec-expectations-3.0.0.beta1.gem and /dev/null differ diff --git a/vendor/cache/rspec-expectations-3.0.0.gem b/vendor/cache/rspec-expectations-3.0.0.gem new file mode 100644 index 00000000000..4453e3b2a4b Binary files /dev/null and b/vendor/cache/rspec-expectations-3.0.0.gem differ diff --git a/vendor/cache/rspec-mocks-3.0.0.beta1.gem b/vendor/cache/rspec-mocks-3.0.0.beta1.gem deleted file mode 100644 index 147d6c3f757..00000000000 Binary files a/vendor/cache/rspec-mocks-3.0.0.beta1.gem and /dev/null differ diff --git a/vendor/cache/rspec-mocks-3.0.0.gem b/vendor/cache/rspec-mocks-3.0.0.gem new file mode 100644 index 00000000000..67bd4161e08 Binary files /dev/null and b/vendor/cache/rspec-mocks-3.0.0.gem differ diff --git a/vendor/cache/rspec-support-3.0.0.beta1.gem b/vendor/cache/rspec-support-3.0.0.beta1.gem deleted file mode 100644 index 1b90b068bf4..00000000000 Binary files a/vendor/cache/rspec-support-3.0.0.beta1.gem and /dev/null differ diff --git a/vendor/cache/rspec-support-3.0.0.gem b/vendor/cache/rspec-support-3.0.0.gem new file mode 100644 index 00000000000..c05beed3282 Binary files /dev/null and b/vendor/cache/rspec-support-3.0.0.gem differ