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
cmds = [
%W(rake gitlab:setup),
%W(rspec spec --tag @models)
]
run_commands(cmds)
end
namespace :spec do
desc 'GITLAB | Run feature specs' desc 'GITLAB | Run feature specs'
task :features do task :api 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
...@@ -21,15 +14,24 @@ namespace :testing do ...@@ -21,15 +14,24 @@ namespace :testing do
task :other do task :other do
cmds = [ cmds = [
%W(rake gitlab:setup), %W(rake gitlab:setup),
%W(rspec spec --tag ~@models --tag ~@features) %W(rspec spec --tag ~@api)
] ]
run_commands(cmds) run_commands(cmds)
end end
end
desc "GITLAB | Run specs"
task :spec do
cmds = [
%W(rake gitlab:setup),
%W(rspec spec),
]
run_commands(cmds)
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) }
...@@ -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