Skip to content

Commit

Permalink
Get specs running
Browse files Browse the repository at this point in the history
  • Loading branch information
bdunne committed Dec 14, 2016
1 parent dd85146 commit a08378a
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
Gemfile.lock

spec/manageiq
4 changes: 4 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
--require manageiq/spec/spec_helper
--require spec_helper
--color
--order random
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
source 'https://rubygems.org'

gemspec

# Load Gemfile with dependencies from manageiq
eval_gemfile(File.expand_path("spec/manageiq/Gemfile", __dir__))

gem "codeclimate-test-reporter", :require => false
28 changes: 28 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env ruby
require 'pathname'

GEM_ROOT = Pathname.new File.expand_path('../../', __FILE__)

Dir.chdir(GEM_ROOT) do
if File.exist?("spec/manageiq")
puts "== Updating manageiq sample app =="
system "cd spec/manageiq && git pull"
else
puts "== Cloning manageiq sample app =="
system "git clone [email protected]:ManageIQ/manageiq.git --depth 1 spec/manageiq"
end

puts "== Installing dependencies =="
system "gem install bundler --conservative"
system "bundle check || bundle install"

unless File.exist?("spec/manageiq/config/database.yml")
puts "\n== Copying sample config/database.yml =="
system "cp spec/manageiq/config/database.pg.yml spec/manageiq/config/database.yml"
end

unless File.exist?("spec/manageiq/certs/v2_key")
puts "\n== Copying sample certs/v2_key =="
system "cp spec/manageiq/certs/v2_key.dev spec/manageiq/certs/v2_key"
end
end
23 changes: 23 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
require 'manageiq-content'

def require_domain_file
spec_name = caller_locations.first.path
file_name = spec_name.sub("spec/", "").sub("_spec.rb", ".rb")

require file_name
end

RSpec.configure do |config|
config.include Spec::Support::AutomationHelper

config.before(:suite) do
puts "** Resetting #{ENV["AUTOMATE_DOMAINS"]} domain(s)"
Tenant.seed
MiqAeDatastore.reset
MiqAeDatastore.reset_to_defaults
end

config.after(:suite) do
MiqAeDatastore.reset
end
end

0 comments on commit a08378a

Please sign in to comment.