Skip to content

Commit

Permalink
Merge pull request #1501 from hennevogel/rspec_tests_fix
Browse files Browse the repository at this point in the history
Enable the new test suite
  • Loading branch information
mdeniz committed Feb 5, 2016
2 parents f8416ea + 6f35443 commit c3b1877
Show file tree
Hide file tree
Showing 28 changed files with 146 additions and 276 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ env:
- TEST_SUITE=api
- TEST_SUITE=webui
- TEST_SUITE=spider
- TEST_SUITE=rspec
matrix:
fast_finish: true
notifications:
irc:
channels:
- "chat.freenode.net#opensuse-buildservice"
on_success: change
on_failure: change
on_failure: change
services:
- memcached
sudo: required
4 changes: 3 additions & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
fe.vm.box = 'M0ses/openSUSE-Leap-42.1-minimal'
# Provision the box with a simple shell script
fe.vm.provision :shell, inline: '/vagrant/contrib/bootstrap_frontend.sh'

# Execute commands in the frontend directory
fe.exec.commands '*', directory: '/vagrant/src/api'
fe.exec.commands '*', env: {'DATABASE_URL' => 'mysql2://root:opensuse@localhost/api_development'}
fe.vm.network :forwarded_port, guest: 3000, host: 3000

fe.vm.synced_folder "src/api/tmp/capybara/", "/vagrant/src/api/tmp/capybara", create: true
end


Expand Down
10 changes: 8 additions & 2 deletions dist/ci/obs_testsuite_travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if [ -z $1 ]; then
TEST_SUITE="all"
else
TEST_SUITE="$1"
fi
fi


if test -z "$SUBTEST"; then
Expand All @@ -30,12 +30,18 @@ if test -z "$SUBTEST"; then
bundle exec rake test:spider
;;
rubocop)
bundle exec rake rubocop
bundle exec rake rubocop
;;
rspec)
bundle exec rspec
;;
*)
bundle exec rake rubocop
bundle exec rake test:api
bundle exec rake test:webui
bundle exec rspec
unset DO_COVERAGE
bundle exec rake test:spider
;;
esac
fi
2 changes: 1 addition & 1 deletion src/api/app/controllers/webui/project_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def save_distributions
repository = @project.repositories.new(name: distribution['reponame'])
target_repository = Repository.find_by_project_and_name(distribution['project'], distribution['repository'])
unless target_repository
raise Activerecord::RecordNotFound
raise ActiveRecord::RecordNotFound
end
repository.path_elements.new(link: target_repository, position: 1 )
distribution['architectures'].each_with_index do |architecture, index|
Expand Down
3 changes: 3 additions & 0 deletions src/api/app/models/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ def map_value(key, value)
# Simple singleton implementation: Try to respond with the
# the data from the first instance
def method_missing(method_name, *args, &block)
unless first
Configuration.create(name: 'private', title: 'Open Build Service', description: 'Private OBS Instance')
end
if first.respond_to?(method_name)
first.send(method_name, *args, &block)
else
Expand Down
9 changes: 6 additions & 3 deletions src/api/app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,12 @@ def get_default_admin
end

def find_nobody!
Thread.current[:nobody_user] ||= find_by_login(nobody_login)
raise NotFoundError.new("Couldn't find #{nobody_login} user") if Thread.current[:nobody_user].nil?
return Thread.current[:nobody_user]
Thread.current[:nobody_user] ||= User.create_with(email: "nobody@localhost",
realname: "Anonymous User",
state: "3",
password: "123456",
password_confirmation: "123456").find_or_create_by(login: nobody_login)
Thread.current[:nobody_user]
end

def find_by_login!(login)
Expand Down
4 changes: 2 additions & 2 deletions src/api/spec/browser_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
require 'support/capybara'
require 'capybara/poltergeist'

# support log in/log out...
require 'support/functional/authentification'
# helper methods for authentification in features tests
require 'support/features/features_authentification'
82 changes: 6 additions & 76 deletions src/api/spec/cassettes/Repositories/add.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

128 changes: 2 additions & 126 deletions src/api/spec/cassettes/Sign_up/User.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/api/spec/cassettes/Sign_up/User_with_confirmation.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/api/spec/controllers/webui/project_controller_spec.rb

This file was deleted.

11 changes: 11 additions & 0 deletions src/api/spec/factories/distribution.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FactoryGirl.define do
factory :distribution do
vendor Faker::Lorem.word
version "13.2"
name Faker::Lorem.word
project Faker::Lorem.word
reponame Faker::Lorem.word
repository "standard"
link "http://www.opensuse.org/"
end
end
6 changes: 6 additions & 0 deletions src/api/spec/factories/project.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FactoryGirl.define do
factory :project do
name Faker::Internet.domain_word
title Faker::Book.title
end
end
7 changes: 7 additions & 0 deletions src/api/spec/factories/relationship.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FactoryGirl.define do
factory :relationship do
project
user
role { Role.find_by_title('maintainer') }
end
end
6 changes: 6 additions & 0 deletions src/api/spec/factories/repository.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FactoryGirl.define do
factory :repository do
project
name Faker::Lorem.word
end
end

0 comments on commit c3b1877

Please sign in to comment.