Commit 0f31acd0 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge pull request #6753 from jvanbaarsen/split_tests

Proposal for split testing
parents 1942b97d 490ab228
...@@ -4,10 +4,12 @@ env: ...@@ -4,10 +4,12 @@ env:
- TRAVIS=true - TRAVIS=true
matrix: matrix:
- TASK=spinach DB=mysql - TASK=spinach DB=mysql
- TASK=spec DB=mysql - TASK=spec:api DB=mysql
- TASK=spec:other DB=mysql
- TASK=jasmine:ci DB=mysql - TASK=jasmine:ci DB=mysql
- TASK=spinach DB=postgresql - TASK=spinach DB=postgresql
- TASK=spec DB=postgresql - TASK=spec:api DB=mysql
- TASK=spec:other DB=postgresql
- TASK=jasmine:ci DB=postgresql - TASK=jasmine:ci DB=postgresql
before_install: before_install:
- sudo apt-get install libicu-dev -y - sudo apt-get install libicu-dev -y
......
Rake::Task["spec"].clear if Rake::Task.task_defined?('spec') Rake::Task["spec"].clear if Rake::Task.task_defined?('spec')
namespace :spec do
desc 'GITLAB | Run feature specs'
task :api do
cmds = [
%W(rake gitlab:setup),
%W(rspec spec --tag @api)
]
run_commands(cmds)
end
desc 'GITLAB | Run other specs'
task :other do
cmds = [
%W(rake gitlab:setup),
%W(rspec spec --tag ~@api)
]
run_commands(cmds)
end
end
desc "GITLAB | Run specs" desc "GITLAB | Run specs"
task :spec do task :spec do
cmds = [ cmds = [
%W(rake gitlab:setup), %W(rake gitlab:setup),
%W(rspec spec), %W(rspec spec),
] ]
run_commands(cmds)
end
def run_commands(cmds)
cmds.each do |cmd| cmds.each do |cmd|
system({'RAILS_ENV' => 'test', 'force' => 'yes'}, *cmd) system({'RAILS_ENV' => 'test', 'force' => 'yes'}, *cmd)
raise "#{cmd} failed!" unless $?.exitstatus.zero? raise "#{cmd} failed!" unless $?.exitstatus.zero?
......
require 'spec_helper' require 'spec_helper'
describe "GitLab Flavored Markdown" do describe "GitLab Flavored Markdown", features: true do
let(:project) { create(:project) } let(:project) { create(:project) }
let(:issue) { create(:issue, project: project) } let(:issue) { create(:issue, project: project) }
let(:merge_request) { create(:merge_request, source_project: project, target_project: project) } let(:merge_request) { create(:merge_request, source_project: project, target_project: project) }
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
require 'spec_helper' require 'spec_helper'
describe AssemblaService do describe AssemblaService, models: true do
describe "Associations" do describe "Associations" do
it { should belong_to :project } it { should belong_to :project }
it { should have_one :service_hook } it { should have_one :service_hook }
......
require 'spec_helper' require 'spec_helper'
describe API do describe API, api: true do
include API::APIHelpers include API::APIHelpers
include ApiHelpers include ApiHelpers
let(:user) { create(:user) } let(:user) { create(:user) }
...@@ -158,4 +158,4 @@ describe API do ...@@ -158,4 +158,4 @@ describe API do
sudo_identifier.should == ' 123' sudo_identifier.should == ' 123'
end end
end end
end end
\ No newline at end of file
require 'spec_helper' require 'spec_helper'
require 'mime/types' require 'mime/types'
describe API::API do describe API::API, api: true do
include ApiHelpers include ApiHelpers
before(:each) { enable_observers } before(:each) { enable_observers }
after(:each) {disable_observers} after(:each) {disable_observers}
......
require 'spec_helper' require 'spec_helper'
require 'mime/types' require 'mime/types'
describe API::API do describe API::API, api: true do
include ApiHelpers include ApiHelpers
before(:each) { enable_observers } before(:each) { enable_observers }
after(:each) {disable_observers} after(:each) {disable_observers}
......
require 'spec_helper' require 'spec_helper'
describe API::API do describe API::API, api: true do
include ApiHelpers include ApiHelpers
before(:each) { ActiveRecord::Base.observers.enable(:user_observer) } before(:each) { ActiveRecord::Base.observers.enable(:user_observer) }
after(:each) { ActiveRecord::Base.observers.disable(:user_observer) } after(:each) { ActiveRecord::Base.observers.disable(:user_observer) }
......
require 'spec_helper' require 'spec_helper'
describe API::API do describe API::API, api: true do
include ApiHelpers include ApiHelpers
let(:user1) { create(:user) } let(:user1) { create(:user) }
......
require 'spec_helper' require 'spec_helper'
describe API::API do describe API::API, api: true do
include ApiHelpers include ApiHelpers
before(:each) { ActiveRecord::Base.observers.enable(:user_observer) } before(:each) { ActiveRecord::Base.observers.enable(:user_observer) }
after(:each) { ActiveRecord::Base.observers.disable(:user_observer) } after(:each) { ActiveRecord::Base.observers.disable(:user_observer) }
......
require 'spec_helper' require 'spec_helper'
describe API::API do describe API::API, api: true do
include ApiHelpers include ApiHelpers
before(:each) { ActiveRecord::Base.observers.enable(:user_observer) } before(:each) { ActiveRecord::Base.observers.enable(:user_observer) }
after(:each) { ActiveRecord::Base.observers.disable(:user_observer) } after(:each) { ActiveRecord::Base.observers.disable(:user_observer) }
......
require "spec_helper" require "spec_helper"
describe API::API do describe API::API, api: true do
include ApiHelpers include ApiHelpers
before(:each) { ActiveRecord::Base.observers.enable(:user_observer) } before(:each) { ActiveRecord::Base.observers.enable(:user_observer) }
after(:each) { ActiveRecord::Base.observers.disable(:user_observer) } after(:each) { ActiveRecord::Base.observers.disable(:user_observer) }
......
require 'spec_helper' require 'spec_helper'
describe API::API do describe API::API, api: true do
include ApiHelpers include ApiHelpers
before(:each) { enable_observers } before(:each) { enable_observers }
after(:each) {disable_observers} after(:each) {disable_observers}
......
require 'spec_helper' require 'spec_helper'
describe API::API do describe API::API, api: true do
include ApiHelpers include ApiHelpers
before(:each) { ActiveRecord::Base.observers.enable(:user_observer) } before(:each) { ActiveRecord::Base.observers.enable(:user_observer) }
after(:each) { ActiveRecord::Base.observers.disable(:user_observer) } after(:each) { ActiveRecord::Base.observers.disable(:user_observer) }
......
require 'spec_helper' require 'spec_helper'
describe API::API do describe API::API, api: true do
include ApiHelpers include ApiHelpers
before(:each) { ActiveRecord::Base.observers.enable(:user_observer) } before(:each) { ActiveRecord::Base.observers.enable(:user_observer) }
after(:each) { ActiveRecord::Base.observers.disable(:user_observer) } after(:each) { ActiveRecord::Base.observers.disable(:user_observer) }
......
require 'spec_helper' require 'spec_helper'
describe API::API, 'ProjectHooks' do describe API::API, 'ProjectHooks', api: true do
include ApiHelpers include ApiHelpers
before(:each) { enable_observers } before(:each) { enable_observers }
after(:each) { disable_observers } after(:each) { disable_observers }
......
require 'spec_helper' require 'spec_helper'
describe API::API do describe API::API, api: true do
include ApiHelpers include ApiHelpers
before(:each) { enable_observers } before(:each) { enable_observers }
after(:each) { disable_observers } after(:each) { disable_observers }
......
require 'spec_helper' require 'spec_helper'
describe API::API do describe API::API, api: true do
include ApiHelpers include ApiHelpers
before(:each) { enable_observers } before(:each) { enable_observers }
after(:each) { disable_observers } after(:each) { disable_observers }
......
require 'spec_helper' require 'spec_helper'
require 'mime/types' require 'mime/types'
describe API::API do describe API::API, api: true do
include ApiHelpers include ApiHelpers
before(:each) { enable_observers } before(:each) { enable_observers }
after(:each) {disable_observers} after(:each) {disable_observers}
......
require "spec_helper" require "spec_helper"
describe API::API do describe API::API, api: true do
include ApiHelpers include ApiHelpers
before(:each) { ActiveRecord::Base.observers.enable(:user_observer) } before(:each) { ActiveRecord::Base.observers.enable(:user_observer) }
after(:each) { ActiveRecord::Base.observers.disable(:user_observer) } after(:each) { ActiveRecord::Base.observers.disable(:user_observer) }
......
require 'spec_helper' require 'spec_helper'
describe API::API do describe API::API, api: true do
include ApiHelpers include ApiHelpers
let(:user) { create(:user) } let(:user) { create(:user) }
......
require 'spec_helper' require 'spec_helper'
describe API::API do describe API::API, api: true do
include ApiHelpers include ApiHelpers
let(:user) { create(:user) } let(:user) { create(:user) }
......
require 'spec_helper' require 'spec_helper'
describe API::API do describe API::API, api: true do
include ApiHelpers include ApiHelpers
let(:user) { create(:user) } let(:user) { create(:user) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment