Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
Merge pull request #930 from Fryguy/rspec
Browse files Browse the repository at this point in the history
Add RSpec framework files
  • Loading branch information
mturley committed Apr 9, 2019
2 parents f6dfc22 + ec57569 commit 681ae68
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 22 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -11,6 +11,7 @@ tmp/
.rubocop-*
.ruby-version
/node_modules
/spec/manageiq

# IDEs and editors
/.idea
Expand Down
5 changes: 5 additions & 0 deletions .rspec
@@ -0,0 +1,5 @@
--require manageiq/spec/spec_helper
--require spec_helper
--color
--order random
--exclude-pattern "spec/manageiq/**/*_spec.rb"
6 changes: 6 additions & 0 deletions .rspec_ci
@@ -0,0 +1,6 @@
--require manageiq/spec/spec_helper
--require spec_helper
--color
--order random
--profile 25
--exclude-pattern "spec/manageiq/**/*_spec.rb"
29 changes: 25 additions & 4 deletions .travis.yml
@@ -1,7 +1,28 @@
language: node_js
node_js:
- '8' # current stable
script: yarn test --runInBand
dist: xenial
matrix:
include:
- name: "Node.js: 8"
language: node_js
node_js:
- '8' # current stable
cache: yarn
script: yarn test --runInBand
- name: "Ruby: 2.4.5"
language: ruby
rvm:
- 2.4.5
cache: bundler
addons:
postgresql: '10'
install: bin/setup
- name: "Ruby: 2.5.5"
language: ruby
rvm:
- 2.5.5
cache: bundler
addons:
postgresql: '10'
install: bin/setup
notifications:
webhooks:
urls:
Expand Down
9 changes: 2 additions & 7 deletions Gemfile
Expand Up @@ -5,10 +5,5 @@ source 'https://rubygems.org'
# development dependencies will be added by default to the :development group.
gemspec

# Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.

# To use a debugger
# gem 'byebug', group: [:development, :test]
# Load Gemfile with dependencies from manageiq
eval_gemfile(File.expand_path("spec/manageiq/Gemfile", __dir__))
21 changes: 11 additions & 10 deletions Rakefile
@@ -1,15 +1,16 @@
require 'bundler/setup'

begin
require 'bundler/setup'
require 'rspec/core/rake_task'

APP_RAKEFILE = File.expand_path("../spec/manageiq/Rakefile", __FILE__)
load 'rails/tasks/engine.rake'
load 'rails/tasks/statistics.rake'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end

require 'rdoc/task'
require 'bundler/gem_tasks'

RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'manageiq-v2v'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.md')
rdoc.rdoc_files.include('lib/**/*.rb')
end
FileList['lib/tasks_private/**/*.rake'].each { |r| load r }

task :default => :spec
12 changes: 12 additions & 0 deletions bin/setup
@@ -0,0 +1,12 @@
#!/usr/bin/env ruby
require 'pathname'

gem_root = Pathname.new(__dir__).join("..")

unless gem_root.join("spec/manageiq").exist?
puts "== Cloning manageiq sample app =="
system "git clone https://github.com/ManageIQ/manageiq.git --branch master --depth 1 spec/manageiq"
end

require gem_root.join("spec/manageiq/lib/manageiq/environment").to_s
ManageIQ::Environment.manageiq_plugin_setup
14 changes: 14 additions & 0 deletions bin/update
@@ -0,0 +1,14 @@
#!/usr/bin/env ruby
require 'pathname'

gem_root = Pathname.new(__dir__).join("..")

if gem_root.join("spec/manageiq").symlink?
puts "== SKIPPING update of spec/manageiq because its symlinked =="
else
puts "== Updating manageiq sample app =="
system("git pull", :chdir => gem_root.join("spec/manageiq"))
end

require gem_root.join("spec/manageiq/lib/manageiq/environment").to_s
ManageIQ::Environment.manageiq_plugin_update
10 changes: 10 additions & 0 deletions lib/tasks_private/spec.rake
@@ -0,0 +1,10 @@
namespace :spec do
desc "Setup environment specs"
task :setup => ["app:test:initialize", "app:test:verify_no_db_access_loading_rails_environment", "app:test:setup_db"]
end

desc "Run all specs"
RSpec::Core::RakeTask.new(:spec => ["app:test:initialize", "app:evm:compile_sti_loader"]) do |t|
spec_dir = File.expand_path("../../spec", __dir__)
EvmTestHelper.init_rspec_task(t, ['--require', File.join(spec_dir, 'spec_helper')])
end
5 changes: 4 additions & 1 deletion manageiq-v2v.gemspec
Expand Up @@ -11,7 +11,10 @@ Gem::Specification.new do |s|
s.homepage = 'http://www.manageiq.org'
s.summary = 'ManageIQ plugin for v2v transformations'
s.description = 'ManageIQ plugin for v2v transformations'
s.license = 'MIT'
s.license = 'Apache-2.0'

s.files = Dir['{app,config,db,lib}/**/*', 'Rakefile', 'README.md']

s.add_development_dependency "rake"
s.add_development_dependency "rspec"
end
5 changes: 5 additions & 0 deletions spec/example_spec.rb
@@ -0,0 +1,5 @@
describe MigrationLogController do
it "stuff" do
expect(1).to eq 1
end
end
1 change: 1 addition & 0 deletions spec/spec_helper.rb
@@ -0,0 +1 @@
Dir[Rails.root.join("spec/shared/**/*.rb")].each { |f| require f }

0 comments on commit 681ae68

Please sign in to comment.