Commit 5dd2f36a authored by Jeroen van Baarsen's avatar Jeroen van Baarsen

Added API testing group

parent 25eadf0c
namespace :testing do Rake::Task["spec"].clear if Rake::Task.task_defined?('spec')
desc 'GITLAB | Run model specs'
task :models do namespace :spec do
desc 'GITLAB | Run feature specs'
task :api do
cmds = [ cmds = [
%W(rake gitlab:setup), %W(rake gitlab:setup),
%W(rspec spec --tag @models) %W(rspec spec --tag @api)
] ]
run_commands(cmds) run_commands(cmds)
end end
desc 'GITLAB | Run feature specs' desc 'GITLAB | Run other specs'
task :features do task :other do
cmds = [ cmds = [
%W(rake gitlab:setup), %W(rake gitlab:setup),
%W(rspec spec --tag @features) %W(rspec spec --tag ~@api)
] ]
run_commands(cmds) run_commands(cmds)
end end
end
desc 'GITLAB | Run other specs' desc "GITLAB | Run specs"
task :other do task :spec do
cmds = [ cmds = [
%W(rake gitlab:setup), %W(rake gitlab:setup),
%W(rspec spec --tag ~@models --tag ~@features) %W(rspec spec),
] ]
run_commands(cmds) run_commands(cmds)
end end
def run_commands(cmds) 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?
end end
end
end end
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) }
......
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