Merge pull request #481 from abf/rosa-build:rails-4.2.1

Update rails to 4.2.1
This commit is contained in:
avokhmin 2015-06-18 23:09:34 +04:00
commit 7e3987bc91
35 changed files with 856 additions and 811 deletions

View File

@ -5,6 +5,7 @@ bundler_args: --without development
env: env:
- SPEC_GROUP=controllers - SPEC_GROUP=controllers
- SPEC_GROUP=platform_controllers - SPEC_GROUP=platform_controllers
- SPEC_GROUP=api-slow
- SPEC_GROUP=api - SPEC_GROUP=api
- SPEC_GROUP=models - SPEC_GROUP=models
- SPEC_GROUP=others - SPEC_GROUP=others

View File

@ -1,10 +1,10 @@
source 'https://rubygems.org' source 'https://rubygems.org'
gem 'rails', '4.1.11' gem 'rails'
gem 'activeadmin', github: 'activeadmin' gem 'activeadmin', github: 'activeadmin'
gem 'pg' gem 'pg'
gem 'schema_plus', '~> 1.5' gem 'schema_plus'
######## ########
gem 'devise' gem 'devise'
gem 'omniauth' gem 'omniauth'
@ -50,7 +50,7 @@ gem 'sprockets'
gem 'will_paginate' gem 'will_paginate'
gem 'meta-tags', require: 'meta_tags' gem 'meta-tags', require: 'meta_tags'
gem 'haml-rails' gem 'haml-rails'
gem 'jquery-rails', '3.1.3' gem 'jquery-rails'
gem 'jquery-migrate-rails' gem 'jquery-migrate-rails'
gem 'ruby-haml-js' gem 'ruby-haml-js'
gem 'slim' gem 'slim'
@ -69,7 +69,7 @@ gem 'gemoji'
# AngularJS related stuff # AngularJS related stuff
gem 'underscore-rails' gem 'underscore-rails'
gem 'angularjs-rails' gem 'angularjs-rails', '~> 1.3.14'
gem 'ng-rails-csrf' gem 'ng-rails-csrf'
gem 'momentjs-rails' gem 'momentjs-rails'
gem 'angular-i18n' gem 'angular-i18n'

View File

@ -10,7 +10,7 @@ GIT
GIT GIT
remote: git://github.com/activeadmin/activeadmin.git remote: git://github.com/activeadmin/activeadmin.git
revision: 9c46b14ea0d9b3aaaa3d7520555c9959d06ce7f3 revision: 0ffc65a28847f46af1b707d43562eef1051b7960
specs: specs:
activeadmin (1.0.0.pre1) activeadmin (1.0.0.pre1)
arbre (~> 1.0, >= 1.0.2) arbre (~> 1.0, >= 1.0.2)
@ -47,51 +47,60 @@ GEM
remote: https://rails-assets.org/ remote: https://rails-assets.org/
specs: specs:
RedCloth (4.2.9) RedCloth (4.2.9)
actionmailer (4.1.11) actionmailer (4.2.2)
actionpack (= 4.1.11) actionpack (= 4.2.2)
actionview (= 4.1.11) actionview (= 4.2.2)
activejob (= 4.2.2)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
actionpack (4.1.11) rails-dom-testing (~> 1.0, >= 1.0.5)
actionview (= 4.1.11) actionpack (4.2.2)
activesupport (= 4.1.11) actionview (= 4.2.2)
rack (~> 1.5.2) activesupport (= 4.2.2)
rack (~> 1.6)
rack-test (~> 0.6.2) rack-test (~> 0.6.2)
actionview (4.1.11) rails-dom-testing (~> 1.0, >= 1.0.5)
activesupport (= 4.1.11) rails-html-sanitizer (~> 1.0, >= 1.0.1)
actionview (4.2.2)
activesupport (= 4.2.2)
builder (~> 3.1) builder (~> 3.1)
erubis (~> 2.7.0) erubis (~> 2.7.0)
activemodel (4.1.11) rails-dom-testing (~> 1.0, >= 1.0.5)
activesupport (= 4.1.11) rails-html-sanitizer (~> 1.0, >= 1.0.1)
activejob (4.2.2)
activesupport (= 4.2.2)
globalid (>= 0.3.0)
activemodel (4.2.2)
activesupport (= 4.2.2)
builder (~> 3.1) builder (~> 3.1)
activerecord (4.1.11) activerecord (4.2.2)
activemodel (= 4.1.11) activemodel (= 4.2.2)
activesupport (= 4.1.11) activesupport (= 4.2.2)
arel (~> 5.0.0) arel (~> 6.0)
activesupport (4.1.11) activesupport (4.2.2)
i18n (~> 0.6, >= 0.6.9) i18n (~> 0.7)
json (~> 1.7, >= 1.7.7) json (~> 1.7, >= 1.7.7)
minitest (~> 5.1) minitest (~> 5.1)
thread_safe (~> 0.1) thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1) tzinfo (~> 1.1)
addressable (2.3.7) addressable (2.3.8)
airbrake (4.1.0) airbrake (4.2.1)
builder builder
multi_json multi_json
ancestry (2.1.0) ancestry (2.1.0)
activerecord (>= 3.0.0) activerecord (>= 3.0.0)
angular-i18n (0.1.2) angular-i18n (0.1.2)
angular-rails-templates (0.1.3) angular-rails-templates (0.2.0)
railties (>= 3.1) railties (>= 3.1)
sprockets sprockets (~> 2)
tilt tilt
angular-ui-bootstrap-rails (0.12.0) angular-ui-bootstrap-rails (0.13.0)
angularjs-rails (1.3.14) angularjs-rails (1.3.14)
arbre (1.0.3) arbre (1.0.3)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
arel (5.0.1.20140414130214) arel (6.0.0)
attr_encrypted (1.3.3) attr_encrypted (1.3.4)
encryptor (>= 1.3.0) encryptor (>= 1.3.0)
autoprefixer-rails (5.1.7) autoprefixer-rails (5.2.0)
execjs execjs
json json
bcrypt (3.1.10) bcrypt (3.1.10)
@ -101,7 +110,7 @@ GEM
rack (>= 0.9.0) rack (>= 0.9.0)
binding_of_caller (0.7.2) binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1) debug_inspector (>= 0.0.1)
bootstrap-sass (3.3.3) bootstrap-sass (3.3.4.1)
autoprefixer-rails (>= 5.0.0.1) autoprefixer-rails (>= 5.0.0.1)
sass (>= 3.2.19) sass (>= 3.2.19)
bourbon (4.2.3) bourbon (4.2.3)
@ -153,9 +162,9 @@ GEM
crack (0.4.2) crack (0.4.2)
safe_yaml (~> 1.0.0) safe_yaml (~> 1.0.0)
creole (0.5.0) creole (0.5.0)
daemons (1.1.9) daemons (1.2.2)
debug_inspector (0.0.2) debug_inspector (0.0.2)
devise (3.4.1) devise (3.5.1)
bcrypt (~> 3.0) bcrypt (~> 3.0)
orm_adapter (~> 0.1) orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5) railties (>= 3.2.6, < 5)
@ -179,7 +188,7 @@ GEM
railties (>= 3.0.0) railties (>= 3.0.0)
faraday (0.9.1) faraday (0.9.1)
multipart-post (>= 1.2, < 3) multipart-post (>= 1.2, < 3)
ffi (1.9.6) ffi (1.9.8)
font-awesome-rails (4.3.0.0) font-awesome-rails (4.3.0.0)
railties (>= 3.2, < 5.0) railties (>= 3.2, < 5.0)
formtastic (3.1.3) formtastic (3.1.3)
@ -201,7 +210,9 @@ GEM
diff-lcs (~> 1.1) diff-lcs (~> 1.1)
mime-types (~> 1.15) mime-types (~> 1.15)
posix-spawn (~> 0.3) posix-spawn (~> 0.3)
gli (2.13.0) gli (2.13.1)
globalid (0.3.5)
activesupport (>= 4.1.0)
gollum-lib (3.0.0) gollum-lib (3.0.0)
github-markup (~> 1.1.0) github-markup (~> 1.1.0)
gitlab-grit (~> 2.6.5) gitlab-grit (~> 2.6.5)
@ -211,16 +222,16 @@ GEM
stringex (~> 2.5.1) stringex (~> 2.5.1)
haml (4.0.6) haml (4.0.6)
tilt tilt
haml-rails (0.8.2) haml-rails (0.9.0)
actionpack (>= 4.0.1) actionpack (>= 4.0.1)
activesupport (>= 4.0.1) activesupport (>= 4.0.1)
haml (>= 3.1, < 5.0) haml (>= 4.0.6, < 5.0)
html2haml (>= 1.0.1) html2haml (>= 1.0.1)
railties (>= 4.0.1) railties (>= 4.0.1)
has_scope (0.6.0) has_scope (0.6.0)
actionpack (>= 3.2, < 5) actionpack (>= 3.2, < 5)
activesupport (>= 3.2, < 5) activesupport (>= 3.2, < 5)
hashie (3.4.0) hashie (3.4.2)
highline (1.6.21) highline (1.6.21)
hike (1.2.3) hike (1.2.3)
hirb (0.7.3) hirb (0.7.3)
@ -229,6 +240,7 @@ GEM
haml (~> 4.0.0) haml (~> 4.0.0)
nokogiri (~> 1.6.0) nokogiri (~> 1.6.0)
ruby_parser (~> 3.5) ruby_parser (~> 3.5)
htmlentities (4.3.3)
http-cookie (1.0.2) http-cookie (1.0.2)
domain_name (~> 0.5) domain_name (~> 0.5)
i18n (0.7.0) i18n (0.7.0)
@ -237,31 +249,36 @@ GEM
has_scope (~> 0.6.0.rc) has_scope (~> 0.6.0.rc)
railties (>= 3.2, < 5) railties (>= 3.2, < 5)
responders responders
jbuilder (2.2.9) its-it (1.1.1)
jbuilder (2.2.16)
activesupport (>= 3.0.0, < 5) activesupport (>= 3.0.0, < 5)
multi_json (~> 1.2) multi_json (~> 1.2)
jquery-migrate-rails (1.2.1) jquery-migrate-rails (1.2.1)
jquery-rails (3.1.3) jquery-rails (4.0.4)
railties (>= 3.0, < 5.0) rails-dom-testing (~> 1.0)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0) thor (>= 0.14, < 2.0)
jquery-ui-rails (5.0.5) jquery-ui-rails (5.0.5)
railties (>= 3.2.16) railties (>= 3.2.16)
js-routes (1.0.0) js-routes (1.0.1)
railties (>= 3.2) railties (>= 3.2)
sprockets-rails sprockets-rails
json (1.8.3) json (1.8.3)
jwt (1.3.0) jwt (1.5.0)
kaminari (0.16.3) kaminari (0.16.3)
actionpack (>= 3.0.0) actionpack (>= 3.0.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
key_struct (0.4.2)
libv8 (3.16.14.7) libv8 (3.16.14.7)
localeapp (0.9.0) localeapp (0.9.3)
gli gli
i18n i18n
json json
rack rack
rest-client rest-client
ya2yaml ya2yaml
loofah (2.0.2)
nokogiri (>= 1.5.9)
mail (2.6.3) mail (2.6.3)
mime-types (>= 1.16, < 3) mime-types (>= 1.16, < 3)
mailcatcher (0.6.1) mailcatcher (0.6.1)
@ -281,8 +298,11 @@ GEM
mime-types (1.25.1) mime-types (1.25.1)
mini_portile (0.6.2) mini_portile (0.6.2)
minitest (5.7.0) minitest (5.7.0)
mock_redis (0.14.0) mock_redis (0.14.1)
momentjs-rails (2.9.0) modware (0.1.2)
its-it
key_struct (~> 0.4)
momentjs-rails (2.10.2)
railties (>= 3.1) railties (>= 3.1)
mono_logger (1.1.0) mono_logger (1.1.0)
multi_json (1.11.1) multi_json (1.11.1)
@ -298,7 +318,7 @@ GEM
net-ssh-gateway (1.2.0) net-ssh-gateway (1.2.0)
net-ssh (>= 2.6.5) net-ssh (>= 2.6.5)
netrc (0.10.3) netrc (0.10.3)
newrelic_rpm (3.10.0.279) newrelic_rpm (3.12.0.288)
ng-rails-csrf (0.1.0) ng-rails-csrf (0.1.0)
ngmin-rails (0.4.0) ngmin-rails (0.4.0)
rails (>= 3.1) rails (>= 3.1)
@ -327,9 +347,7 @@ GEM
omniauth-google-oauth2 (0.2.6) omniauth-google-oauth2 (0.2.6)
omniauth (> 1.0) omniauth (> 1.0)
omniauth-oauth2 (~> 1.1) omniauth-oauth2 (~> 1.1)
omniauth-oauth2 (1.2.0) omniauth-oauth2 (1.3.0)
faraday (>= 0.8, < 0.10)
multi_json (~> 1.3)
oauth2 (~> 1.0) oauth2 (~> 1.0)
omniauth (~> 1.2) omniauth (~> 1.2)
orm_adapter (0.5.0) orm_adapter (0.5.0)
@ -338,18 +356,18 @@ GEM
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
cocaine (~> 0.5.3) cocaine (~> 0.5.3)
mime-types mime-types
pg (0.18.1) pg (0.18.2)
polyamorous (1.2.0) polyamorous (1.2.0)
activerecord (>= 3.0) activerecord (>= 3.0)
posix-spawn (0.3.10) posix-spawn (0.3.11)
puma (2.11.1) puma (2.11.3)
rack (>= 1.1, < 2.0) rack (>= 1.1, < 2.0)
pundit (0.3.0) pundit (1.0.1)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
pygments.rb (0.6.2) pygments.rb (0.6.3)
posix-spawn (~> 0.3.6) posix-spawn (~> 0.3.6)
yajl-ruby (~> 1.2.0) yajl-ruby (~> 1.2.0)
rack (1.5.4) rack (1.6.2)
rack-contrib (1.2.0) rack-contrib (1.2.0)
rack (>= 0.9.1) rack (>= 0.9.1)
rack-mini-profiler (0.9.3) rack-mini-profiler (0.9.3)
@ -362,24 +380,33 @@ GEM
rack (>= 1.0.0) rack (>= 1.0.0)
rack-utf8_sanitizer (1.3.0) rack-utf8_sanitizer (1.3.0)
rack (~> 1.0) rack (~> 1.0)
rails (4.1.11) rails (4.2.2)
actionmailer (= 4.1.11) actionmailer (= 4.2.2)
actionpack (= 4.1.11) actionpack (= 4.2.2)
actionview (= 4.1.11) actionview (= 4.2.2)
activemodel (= 4.1.11) activejob (= 4.2.2)
activerecord (= 4.1.11) activemodel (= 4.2.2)
activesupport (= 4.1.11) activerecord (= 4.2.2)
activesupport (= 4.2.2)
bundler (>= 1.3.0, < 2.0) bundler (>= 1.3.0, < 2.0)
railties (= 4.1.11) railties (= 4.2.2)
sprockets-rails (~> 2.0) sprockets-rails
rails-assets-notifyjs (0.3.2) rails-assets-notifyjs (0.3.2)
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.6)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.2)
loofah (~> 2.0)
rails3-generators (1.0.0) rails3-generators (1.0.0)
railties (>= 3.0.0) railties (>= 3.0.0)
rails3-jquery-autocomplete (1.0.15) rails3-jquery-autocomplete (1.0.15)
rails (>= 3.2) rails (>= 3.2)
railties (4.1.11) railties (4.2.2)
actionpack (= 4.1.11) actionpack (= 4.2.2)
activesupport (= 4.1.11) activesupport (= 4.2.2)
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
rake (10.4.2) rake (10.4.2)
@ -389,7 +416,7 @@ GEM
activesupport (>= 3.0) activesupport (>= 3.0)
i18n i18n
polyamorous (~> 1.2) polyamorous (~> 1.2)
rb-fsevent (0.9.4) rb-fsevent (0.9.5)
rb-inotify (0.9.5) rb-inotify (0.9.5)
ffi (>= 0.5.0) ffi (>= 0.5.0)
rdiscount (2.1.8) rdiscount (2.1.8)
@ -402,7 +429,7 @@ GEM
redis-activesupport (4.0.0) redis-activesupport (4.0.0)
activesupport (~> 4) activesupport (~> 4)
redis-store (~> 1.1.0) redis-store (~> 1.1.0)
redis-namespace (1.5.1) redis-namespace (1.5.2)
redis (~> 3.0, >= 3.0.4) redis (~> 3.0, >= 3.0.4)
redis-rack (1.5.0) redis-rack (1.5.0)
rack (~> 1.5) rack (~> 1.5)
@ -414,8 +441,8 @@ GEM
redis-store (1.1.4) redis-store (1.1.4)
redis (>= 2.2) redis (>= 2.2)
ref (1.0.5) ref (1.0.5)
responders (1.1.2) responders (2.1.0)
railties (>= 3.2, < 4.2) railties (>= 4.2.0, < 5)
resque (1.25.2) resque (1.25.2)
mono_logger (~> 1.0) mono_logger (~> 1.0)
multi_json (~> 1.0) multi_json (~> 1.0)
@ -427,7 +454,7 @@ GEM
redis (~> 3.0.4) redis (~> 3.0.4)
resque (~> 1.25.1) resque (~> 1.25.1)
rufus-scheduler (~> 2.0.24) rufus-scheduler (~> 2.0.24)
resque-status (0.4.3) resque-status (0.5.0)
resque (~> 1.19) resque (~> 1.19)
resque_mailer (2.2.7) resque_mailer (2.2.7)
actionmailer (>= 3.0) actionmailer (>= 3.0)
@ -437,15 +464,15 @@ GEM
netrc (~> 0.7) netrc (~> 0.7)
rouge (1.3.4) rouge (1.3.4)
rr (1.1.2) rr (1.1.2)
rspec-core (3.2.1) rspec-core (3.2.3)
rspec-support (~> 3.2.0) rspec-support (~> 3.2.0)
rspec-expectations (3.2.0) rspec-expectations (3.2.1)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0) rspec-support (~> 3.2.0)
rspec-mocks (3.2.1) rspec-mocks (3.2.1)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0) rspec-support (~> 3.2.0)
rspec-rails (3.2.1) rspec-rails (3.2.2)
actionpack (>= 3.0, < 4.3) actionpack (>= 3.0, < 4.3)
activesupport (>= 3.0, < 4.3) activesupport (>= 3.0, < 4.3)
railties (>= 3.0, < 4.3) railties (>= 3.0, < 4.3)
@ -457,7 +484,7 @@ GEM
ruby-haml-js (0.0.5) ruby-haml-js (0.0.5)
execjs execjs
sprockets (>= 2.0.0) sprockets (>= 2.0.0)
ruby_parser (3.6.4) ruby_parser (3.7.0)
sexp_processor (~> 4.1) sexp_processor (~> 4.1)
rufus-scheduler (2.0.24) rufus-scheduler (2.0.24)
tzinfo (>= 0.3.22) tzinfo (>= 0.3.22)
@ -476,11 +503,60 @@ GEM
sprockets (>= 2.8, < 4.0) sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0) sprockets-rails (>= 2.0, < 4.0)
tilt (~> 1.1) tilt (~> 1.1)
schema_plus (1.8.7) schema_auto_foreign_keys (0.1.0)
activerecord (>= 3.2, < 4.3) schema_plus_foreign_keys (~> 0.1)
schema_plus_indexes (~> 0.2)
schema_monkey (2.1.0)
activerecord (~> 4.2)
its-it
modware (~> 0.1)
schema_plus (2.0.0)
activerecord (~> 4.2)
schema_auto_foreign_keys (~> 0.1)
schema_monkey (~> 2.1)
schema_plus_columns (~> 0.1)
schema_plus_core (~> 0.4)
schema_plus_db_default (~> 0.1)
schema_plus_default_expr (~> 0.1)
schema_plus_enums (~> 0.1)
schema_plus_foreign_keys (~> 0.1)
schema_plus_indexes (~> 0.1, >= 0.1.3)
schema_plus_pg_indexes (~> 0.1, >= 0.1.3)
schema_plus_tables (~> 0.1)
schema_plus_views (~> 0.1)
schema_plus_columns (0.1.0)
activerecord (~> 4.2)
schema_plus_indexes (~> 0.1)
schema_plus_core (0.5.0)
activerecord (~> 4.2)
schema_monkey (~> 2.1)
schema_plus_db_default (0.1.0)
activerecord (~> 4.2)
schema_plus_core (~> 0.2, >= 0.2.1)
schema_plus_default_expr (0.1.0)
activerecord (~> 4.2)
schema_plus_core (~> 0.2, >= 0.2.1)
schema_plus_enums (0.1.0)
activerecord (~> 4.2)
schema_plus_core (~> 0.2, >= 0.2.1)
schema_plus_foreign_keys (0.1.2)
activerecord (~> 4.2)
schema_plus_core (~> 0.5)
valuable valuable
schema_plus_indexes (0.2.0)
activerecord (~> 4.2)
schema_plus_core (~> 0.1)
schema_plus_pg_indexes (0.1.4)
activerecord (~> 4.2)
schema_plus_indexes (~> 0.1, >= 0.1.3)
schema_plus_tables (0.1.0)
activerecord (~> 4.2)
schema_plus_core (~> 0.2)
schema_plus_views (0.2.0)
activerecord (~> 4.2)
schema_plus_core (~> 0.1)
scrivener (0.0.3) scrivener (0.0.3)
sexp_processor (4.4.5) sexp_processor (4.6.0)
shotgun (0.9.1) shotgun (0.9.1)
rack (>= 1.0) rack (>= 1.0)
shoulda (3.5.0) shoulda (3.5.0)
@ -492,10 +568,10 @@ GEM
simple_form (3.1.0.rc2) simple_form (3.1.0.rc2)
actionpack (~> 4.0) actionpack (~> 4.0)
activemodel (~> 4.0) activemodel (~> 4.0)
sinatra (1.4.5) sinatra (1.4.6)
rack (~> 1.4) rack (~> 1.4)
rack-protection (~> 1.4) rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4) tilt (>= 1.3, < 3)
sitemap_generator (5.0.5) sitemap_generator (5.0.5)
builder builder
skinny (0.2.3) skinny (0.2.3)
@ -503,7 +579,7 @@ GEM
thin (~> 1.5.0) thin (~> 1.5.0)
skype (0.2.8) skype (0.2.8)
tmp_cache tmp_cache
slim (3.0.2) slim (3.0.6)
temple (~> 0.7.3) temple (~> 0.7.3)
tilt (>= 1.3.3, < 2.1) tilt (>= 1.3.3, < 2.1)
soundmanager-rails (1.0.1) soundmanager-rails (1.0.1)
@ -528,7 +604,7 @@ GEM
temple (0.7.5) temple (0.7.5)
test_after_commit (0.4.1) test_after_commit (0.4.1)
activerecord (>= 3.2) activerecord (>= 3.2)
therubyracer (0.12.1) therubyracer (0.12.2)
libv8 (~> 3.16.14.0) libv8 (~> 3.16.14.0)
ref ref
thin (1.5.1) thin (1.5.1)
@ -541,9 +617,9 @@ GEM
time_diff (0.3.0) time_diff (0.3.0)
activesupport activesupport
i18n i18n
timecop (0.7.3) timecop (0.7.4)
tmp_cache (0.1.1) tmp_cache (0.1.1)
twitter-text (1.11.0) twitter-text (1.12.0)
unf (~> 0.1.0) unf (~> 0.1.0)
tzinfo (1.2.2) tzinfo (1.2.2)
thread_safe (~> 0.1) thread_safe (~> 0.1)
@ -553,20 +629,22 @@ GEM
underscore-rails (1.8.2) underscore-rails (1.8.2)
unf (0.1.4) unf (0.1.4)
unf_ext unf_ext
unf_ext (0.0.6) unf_ext (0.0.7.1)
valuable (0.9.9) valuable (0.9.9)
vegas (0.1.11) vegas (0.1.11)
rack (>= 1.0.0) rack (>= 1.0.0)
warden (1.2.3) warden (1.2.3)
rack (>= 1.0) rack (>= 1.0)
webmock (1.20.4) webmock (1.21.0)
addressable (>= 2.3.6) addressable (>= 2.3.6)
crack (>= 0.3.2) crack (>= 0.3.2)
whenever (0.9.4) whenever (0.9.4)
chronic (>= 0.6.3) chronic (>= 0.6.3)
wikicloth (0.8.2) wikicloth (0.8.3)
builder builder
expression_parser expression_parser
htmlentities
nokogiri
twitter-text twitter-text
will_paginate (3.0.7) will_paginate (3.0.7)
ya2yaml (0.31) ya2yaml (0.31)
@ -585,7 +663,7 @@ DEPENDENCIES
angular-i18n angular-i18n
angular-rails-templates angular-rails-templates
angular-ui-bootstrap-rails angular-ui-bootstrap-rails
angularjs-rails angularjs-rails (~> 1.3.14)
attr_encrypted attr_encrypted
better_errors better_errors
binding_of_caller binding_of_caller
@ -614,7 +692,7 @@ DEPENDENCIES
hirb hirb
jbuilder jbuilder
jquery-migrate-rails jquery-migrate-rails
jquery-rails (= 3.1.3) jquery-rails
js-routes js-routes
localeapp localeapp
mailcatcher mailcatcher
@ -639,7 +717,7 @@ DEPENDENCIES
rack-mini-profiler rack-mini-profiler
rack-throttle (~> 0.3.0) rack-throttle (~> 0.3.0)
rack-utf8_sanitizer rack-utf8_sanitizer
rails (= 4.1.11) rails
rails-assets-notifyjs! rails-assets-notifyjs!
rails3-generators rails3-generators
rails3-jquery-autocomplete rails3-jquery-autocomplete
@ -658,7 +736,7 @@ DEPENDENCIES
russian russian
rvm-capistrano rvm-capistrano
sass-rails sass-rails
schema_plus (~> 1.5) schema_plus
shotgun shotgun
shoulda shoulda
shoulda-matchers shoulda-matchers

View File

@ -41,13 +41,13 @@ ActiveAdmin.register User do
f.actions f.actions
end end
action_item only: %i(show edit) do action_item(:reset_token, only: :show) do
link_to 'Reset token', reset_token_admin_user_path(resource), link_to 'Reset token', reset_token_admin_user_path(resource),
'data-method' => :put, 'data-method' => :put,
data: { confirm: 'Are you sure you want to reset token?' } data: { confirm: 'Are you sure you want to reset token?' }
end end
action_item only: :show do action_item(:login_as, only: :show) do
link_to 'Login as user', login_as_admin_user_path(resource) link_to 'Login as user', login_as_admin_user_path(resource)
end end

View File

@ -3,8 +3,8 @@ class AdvisoriesController < ApplicationController
skip_before_action :authenticate_user! if APP_CONFIG['anonymous_access'] skip_before_action :authenticate_user! if APP_CONFIG['anonymous_access']
def index def index
authorize :advisories authorize :advisory
@advisories = Advisory.includes(:platforms).search(params[:q]).uniq @advisories = Advisory.includes(:platforms, :projects).search(params[:q]).uniq
@advisories_count = @advisories.count @advisories_count = @advisories.count
@advisories = @advisories.paginate(page: current_page, per_page: Advisory.per_page) @advisories = @advisories.paginate(page: current_page, per_page: Advisory.per_page)
respond_to do |format| respond_to do |format|
@ -20,7 +20,7 @@ class AdvisoriesController < ApplicationController
end end
def search def search
authorize :advisories authorize :advisory
@advisory = Advisory.by_update_type(params[:bl_type]).search_by_id(params[:query]).first @advisory = Advisory.by_update_type(params[:bl_type]).search_by_id(params[:query]).first
if @advisory.nil? if @advisory.nil?
render nothing: true, status: 404 render nothing: true, status: 404

View File

@ -1,6 +1,4 @@
class Projects::CollaboratorsController < Projects::BaseController class Projects::CollaboratorsController < Projects::BaseController
respond_to :html, :json
before_action :authenticate_user! before_action :authenticate_user!
before_action :authorize_collaborators before_action :authorize_collaborators
@ -9,7 +7,6 @@ class Projects::CollaboratorsController < Projects::BaseController
def index def index
@collaborators = Collaborator.find_by_project(@project) @collaborators = Collaborator.find_by_project(@project)
respond_with @collaborators
end end
def find def find
@ -20,7 +17,6 @@ class Projects::CollaboratorsController < Projects::BaseController
groups = groups.search(params[:term]).first(5) groups = groups.search(params[:term]).first(5)
end end
@collaborators = (users | groups).map{|act| Collaborator.new(actor: act, project: @project)} @collaborators = (users | groups).map{|act| Collaborator.new(actor: act, project: @project)}
respond_with @collaborators
end end
def create def create

View File

@ -23,7 +23,7 @@ class Projects::Git::TreesController < Projects::Git::BaseController
format, @treeish = params[:format], params[:treeish] format, @treeish = params[:format], params[:treeish]
raise Grit::NoSuchPathError unless @treeish =~ /^#{@project.name}-/ && raise Grit::NoSuchPathError unless @treeish =~ /^#{@project.name}-/ &&
@treeish !~ /[\s]+/ && @treeish !~ /[\s]+/ &&
format =~ /^(zip|tar\.gz)$/ format =~ /\A(zip|tar\.gz)\z/
@treeish.gsub!(/^#{@project.name}-/, '') @treeish.gsub!(/^#{@project.name}-/, '')
sha1 = @project.build_scripts.by_active.by_treeish(@treeish).first.try(:sha1) sha1 = @project.build_scripts.by_active.by_treeish(@treeish).first.try(:sha1)
unless sha1 unless sha1

View File

@ -65,7 +65,7 @@ module MarkdownHelper
insert_piece($1) insert_piece($1)
end end
sanitize text.html_safe, attributes: ActionView::Base.sanitized_allowed_attributes + %w(id class) sanitize text.html_safe, attributes: (ActionView::Base.sanitized_allowed_attributes || []) + %w(id class)
end end
private private

View File

@ -8,7 +8,7 @@ module UsersHelper
if subject.try('avatar?') if subject.try('avatar?')
subject.avatar.url(size) subject.avatar.url(size)
elsif subject.kind_of? Group elsif subject.kind_of? Group
image_path('ava-big.png') 'ava-big.png'
else else
gravatar_url(subject.email, User::AVATAR_SIZES[size]) gravatar_url(subject.email, User::AVATAR_SIZES[size])
end end

View File

@ -24,7 +24,6 @@ class BuildList::Package < ActiveRecord::Base
scope :like_name, ->(name) { where("#{table_name}.name ILIKE ?", "%#{name}%") if name.present? } scope :like_name, ->(name) { where("#{table_name}.name ILIKE ?", "%#{name}%") if name.present? }
before_create :set_epoch before_create :set_epoch
before_create :normalize_dependent_packages
def assignee def assignee
project.maintainer project.maintainer
@ -47,12 +46,14 @@ class BuildList::Package < ActiveRecord::Base
end end
end end
protected # Public: Set dependent_packages.
def dependent_packages=(v)
def normalize_dependent_packages v = v.to_s.split(/\s/).select(&:present?) if v.is_a?(String)
self.dependent_packages = dependent_packages.to_s.split(/\s/).select(&:present?) write_attribute :dependent_packages, v
end end
protected
def set_epoch def set_epoch
self.epoch = nil if epoch.blank? || epoch == 0 self.epoch = nil if epoch.blank? || epoch == 0
end end

View File

@ -12,7 +12,7 @@ nav.navbar.navbar-inverse.top_menu role = "navigation"
#top-menu-navbar-collapse.collapse.navbar-collapse #top-menu-navbar-collapse.collapse.navbar-collapse
ul.nav.navbar-nav ul.nav.navbar-nav
- (collection = t 'top_menu').each do |base, title| - (collection = t 'top_menu').each do |base, title|
- if policy(base).index? - if policy(base.to_s.singularize.to_sym).index?
li class=top_menu_class(base) li class=top_menu_class(base)
a href=send("#{base}_path") a href=send("#{base}_path")
i.fa.hidden-sm class=top_menu_icon(base) i.fa.hidden-sm class=top_menu_icon(base)

View File

@ -61,6 +61,9 @@ module Rosa
# Version of your assets, change this if you want to expire all your assets # Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0' config.assets.version = '1.0'
# Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true
config.log_redis = false config.log_redis = false
config.angular_templates.ignore_prefix = 'angularjs/templates/' config.angular_templates.ignore_prefix = 'angularjs/templates/'

View File

@ -1,5 +1,5 @@
# Load the rails application # Load the Rails application.
require File.expand_path('../application', __FILE__) require File.expand_path('../application', __FILE__)
# Initialize the rails application # Initialize the Rails application.
Rosa::Application.initialize! Rails.application.initialize!

View File

@ -14,21 +14,21 @@ class DisableAssetsLogger
end end
end end
Rosa::Application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on # In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development # every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes. # since you don't have to restart the web server when you make code changes.
config.cache_classes = false config.cache_classes = false
config.cache_store = :redis_store, 'redis://localhost:6379/0/cache', { expires_in: 10.minutes } config.cache_store = :redis_store, 'redis://localhost:6379/0/cache', { expires_in: 10.minutes }
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports and disable caching # Show full error reports and disable caching.
config.consider_all_requests_local = true config.consider_all_requests_local = true
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
# Don't care if the mailer can't send # Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false config.action_mailer.raise_delivery_errors = false
#config.action_mailer.raise_delivery_errors = true #config.action_mailer.raise_delivery_errors = true
#config.action_mailer.perform_deliveries = true #config.action_mailer.perform_deliveries = true
@ -36,24 +36,32 @@ Rosa::Application.configure do
config.action_mailer.smtp_settings = { host: "localhost", port: 1025 } config.action_mailer.smtp_settings = { host: "localhost", port: 1025 }
config.action_mailer.default_url_options = { host: 'localhost:3000' } config.action_mailer.default_url_options = { host: 'localhost:3000' }
# Print deprecation notices to the Rails logger # Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log config.active_support.deprecation = :log
#config.active_support.deprecation = false #config.active_support.deprecation = false
# Only use best-standards-support built into browsers # Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin config.action_dispatch.best_standards_support = :builtin
# Raise an error on page load if there are pending migrations # Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load config.active_record.migration_error = :page_load
# Do not compress assets # Debug mode disables concatenation and preprocessing of assets.
config.assets.compress = false config.assets.compress = false
# Expands the lines which load the assets # This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true config.assets.debug = true
# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
config.middleware.insert_before Rails::Rack::Logger, DisableAssetsLogger config.middleware.insert_before Rails::Rack::Logger, DisableAssetsLogger
config.eager_load = false
config.log_redis = true config.log_redis = true
end end

View File

@ -1,77 +1,86 @@
Rosa::Application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb # Settings specified here will take precedence over those in config/application.rb.
# The production environment is meant for finished, "live" apps. # Code is not reloaded between requests.
# Code is not reloaded between requests
config.cache_classes = true config.cache_classes = true
# Full error reports are disabled and caching is turned on # Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false config.consider_all_requests_local = false
config.action_controller.perform_caching = true config.action_controller.perform_caching = true
# Specifies the header that your server uses for sending files # Enable Rack::Cache to put a simple HTTP cache in front of your application
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
# config.action_dispatch.rack_cache = true
# For nginx: # Disable Rails's static asset server (Apache or nginx will already do this).
config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' config.serve_static_files = false
# If you have no front-end server that supports something like X-Sendfile, # Compress JavaScripts and CSS.
# just comment this out and Rails will serve the files config.assets.js_compressor = :uglifier
config.assets.css_compressor = :sass
# See everything in the log (default is :info) # Do not fallback to assets pipeline if a precompiled asset is missed.
# config.log_level = :debug config.assets.compile = false
# Use a different logger for distributed setups # Generate digests for assets URLs.
# config.logger = SyslogLogger.new config.assets.digest = true
# Use a different cache store in production # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Set to :debug to see everything in the log.
config.log_level = :info
# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production.
# config.cache_store = :mem_cache_store # config.cache_store = :mem_cache_store
config.cache_store = :redis_store, 'redis://localhost:6379/0/cache', { expires_in: 10.minutes } config.cache_store = :redis_store, 'redis://localhost:6379/0/cache', { expires_in: 10.minutes }
# Disable Rails's static asset server # Enable serving of images, stylesheets, and JavaScripts from an asset server.
# In production, Apache or nginx will already do this
config.serve_static_assets = false
# Enable serving of images, stylesheets, and javascripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com" # config.action_controller.asset_host = "http://assets.example.com"
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Disable delivery errors, bad email addresses will be ignored # Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false # config.action_mailer.raise_delivery_errors = false
config.action_mailer.default_url_options = { host: 'abf.io' } config.action_mailer.default_url_options = { host: 'abf.io' }
config.delivery_method = :sendmail config.delivery_method = :sendmail
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found) # the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true config.i18n.fallbacks = true
# Send deprecation notices to registered listeners # Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify config.active_support.deprecation = :notify
# Force SSL # Disable automatic flushing of the log to improve performance.
# config.force_ssl = true # config.autoflush_log = false
# Compress JavaScripts and CSS # Use default logging formatter so that PID and timestamp are not suppressed.
config.assets.compress = true config.log_formatter = ::Logger::Formatter.new
# Don't fallback to assets pipeline if a precompiled asset is missed # Do not dump schema after migrations.
config.assets.compile = false config.active_record.dump_schema_after_migration = false
# Generate digests for assets URLs
config.assets.digest = true
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
config.assets.precompile +=
%w(login.css login.js reg_session.css tour.css tour.js gollum/editor/langs/*.js moment/ru.js
codemirror_editor.js codemirror_editor.css new_application.css new_application.js angular-locale_ru-ru.js)
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
config.assets.css_compressor = :sass
config.eager_load = true
config.assets.logger = Logger.new $stdout config.assets.logger = Logger.new $stdout
end end

View File

@ -29,7 +29,7 @@ Rosa::Application.configure do
# Disable Rails's static asset server # Disable Rails's static asset server
# In production, Apache or nginx will already do this # In production, Apache or nginx will already do this
config.serve_static_assets = false config.serve_static_files = false
# Enable serving of images, stylesheets, and javascripts from an asset server # Enable serving of images, stylesheets, and javascripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com" # config.action_controller.asset_host = "http://assets.example.com"

View File

@ -1,21 +1,30 @@
Rosa::Application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb # Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's # The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that # test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped # your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there! # and recreated between test runs. Don't rely on the data there!
config.cache_classes = true config.cache_classes = true
# Show full error reports and disable caching # Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false
# Configure static asset server for tests with Cache-Control for performance.
config.serve_static_files = true
config.static_cache_control = 'public, max-age=3600'
# Show full error reports and disable caching.
config.consider_all_requests_local = true config.consider_all_requests_local = true
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates # Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment # Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false config.action_controller.allow_forgery_protection = false
# Tell Action Mailer not to deliver emails to the real world. # Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the # The :test delivery method accumulates sent emails in the
@ -23,22 +32,15 @@ Rosa::Application.configure do
config.action_mailer.delivery_method = :test config.action_mailer.delivery_method = :test
config.action_mailer.default_url_options = { host: 'localhost:3000' } config.action_mailer.default_url_options = { host: 'localhost:3000' }
# Use SQL instead of Active Record's schema dumper when creating the test database. # Randomize the order test cases are executed.
# This is necessary if your schema can't be completely dumped by the schema dumper, config.active_support.test_order = :random
# like if you have constraints or database-specific column types
# config.active_record.schema_format = :sql
# Print deprecation notices to the stderr # Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr config.active_support.deprecation = :stderr
# Configure static asset server for tests with Cache-Control for performance # Raises error for missing translations
config.serve_static_assets = true # config.action_view.raise_on_missing_translations = true
config.static_cache_control = "public, max-age=3600"
# Allow pass debug_assets=true as a query parameter to load pages with unpackaged assets
config.assets.allow_debugging = true
config.cache_store = :memory_store, { size: 64.megabytes } config.cache_store = :memory_store, { size: 64.megabytes }
config.eager_load = false config.log_redis = true
config.log_redis = true
end end

View File

@ -0,0 +1,12 @@
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
Rails.application.config.assets.precompile += %w(
login.css login.js reg_session.css tour.css tour.js gollum/editor/langs/*.js
moment/ru.js codemirror_editor.js codemirror_editor.css new_application.css
new_application.js angular-locale_ru-ru.js
)

View File

@ -1,3 +1,3 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
Rails.application.config.action_dispatch.cookies_serializer = :hybrid Rails.application.config.action_dispatch.cookies_serializer = :json

View File

@ -1,10 +1,16 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format # Add new inflection rules using the following format. Inflections
# (all these examples are active by default): # are locale specific, and you may define rules for as many different
# ActiveSupport::Inflector.inflections do |inflect| # locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.plural /^(ox)$/i, '\1en' # inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1' # inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people' # inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep ) # inflect.uncountable %w( fish sheep )
# end # end
# These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful'
# end

View File

@ -2,7 +2,6 @@
# Add new mime types for use in respond_to blocks: # Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf # Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
Mime::Type.register "text/plain", 'diff' Mime::Type.register "text/plain", 'diff'
Mime::Type.register "text/plain", 'patch' Mime::Type.register "text/plain", 'patch'

View File

@ -1,3 +1,4 @@
SchemaPlus.setup do |config| SchemaPlus::ForeignKeys.setup do |config|
config.foreign_keys.auto_create = false config.auto_create = false
# config.auto_index = true # default for schema_auto_foreign_keys
end end

View File

@ -1,8 +1,3 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
Rosa::Application.config.session_store :cookie_store, key: '_rosa_session' Rails.application.config.session_store :cookie_store, key: '_rosa_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails generate session_migration")
# Rosa::Application.config.session_store :active_record_store

View File

@ -1,4 +1,4 @@
Rosa::Application.routes.draw do Rails.application.routes.draw do
# ActiveAdmin routes. # ActiveAdmin routes.
ActiveAdmin.routes(self) ActiveAdmin.routes(self)
@ -300,7 +300,7 @@ Rosa::Application.routes.draw do
get :mass_import get :mass_import
end end
end end
scope '*name_with_owner', constraints: { name_with_owner: Project::OWNER_AND_NAME_REGEXP } do # project scope '*name_with_owner', name_with_owner: Project::OWNER_AND_NAME_REGEXP do # project
scope as: 'project' do scope as: 'project' do
resources :wiki do resources :wiki do
collection do collection do

View File

@ -17,107 +17,88 @@ ActiveRecord::Schema.define(version: 20150601043133) do
enable_extension "plpgsql" enable_extension "plpgsql"
enable_extension "hstore" enable_extension "hstore"
create_table "activity_feeds", force: true do |t| create_table "activity_feeds", force: :cascade do |t|
t.integer "user_id", null: false t.integer "user_id", null: false, index: {name: "index_activity_feeds_on_user_id_and_kind", with: ["kind"]}
t.string "kind" t.string "kind"
t.text "data" t.text "data"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.string "project_owner" t.string "project_owner", index: {name: "index_activity_feeds_on_project_owner"}
t.string "project_name" t.string "project_name", index: {name: "index_activity_feeds_on_project_name"}
t.integer "creator_id" t.integer "creator_id", index: {name: "index_activity_feeds_on_creator_id"}
t.index ["creator_id"], :name => "index_activity_feeds_on_creator_id"
t.index ["project_name"], :name => "index_activity_feeds_on_project_name"
t.index ["project_owner"], :name => "index_activity_feeds_on_project_owner"
t.index ["user_id", "kind"], :name => "index_activity_feeds_on_user_id_and_kind"
end end
create_table "advisories", force: true do |t| create_table "advisories", force: :cascade do |t|
t.string "advisory_id" t.string "advisory_id", index: {name: "index_advisories_on_advisory_id", unique: true}
t.text "description", default: "" t.text "description", default: ""
t.text "references", default: "" t.text "references", default: ""
t.text "update_type", default: "" t.text "update_type", default: "", index: {name: "index_advisories_on_update_type"}
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["advisory_id"], :name => "index_advisories_on_advisory_id", :unique => true
t.index ["update_type"], :name => "index_advisories_on_update_type"
end end
create_table "advisories_platforms", id: false, force: true do |t| create_table "advisories_platforms", id: false, force: :cascade do |t|
t.integer "advisory_id" t.integer "advisory_id", index: {name: "index_advisories_platforms_on_advisory_id"}
t.integer "platform_id" t.integer "platform_id", index: {name: "index_advisories_platforms_on_platform_id"}
t.index ["advisory_id", "platform_id"], :name => "advisory_platform_index", :unique => true
t.index ["advisory_id"], :name => "index_advisories_platforms_on_advisory_id"
t.index ["platform_id"], :name => "index_advisories_platforms_on_platform_id"
end end
add_index "advisories_platforms", ["advisory_id", "platform_id"], name: "advisory_platform_index", unique: true
create_table "advisories_projects", id: false, force: true do |t| create_table "advisories_projects", id: false, force: :cascade do |t|
t.integer "advisory_id" t.integer "advisory_id", index: {name: "index_advisories_projects_on_advisory_id"}
t.integer "project_id" t.integer "project_id", index: {name: "index_advisories_projects_on_project_id"}
t.index ["advisory_id", "project_id"], :name => "advisory_project_index", :unique => true
t.index ["advisory_id"], :name => "index_advisories_projects_on_advisory_id"
t.index ["project_id"], :name => "index_advisories_projects_on_project_id"
end end
add_index "advisories_projects", ["advisory_id", "project_id"], name: "advisory_project_index", unique: true
create_table "arches", force: true do |t| create_table "arches", force: :cascade do |t|
t.string "name", null: false t.string "name", null: false, index: {name: "index_arches_on_name", unique: true}
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.index ["name"], :name => "index_arches_on_name", :unique => true
end end
create_table "authentications", force: true do |t| create_table "authentications", force: :cascade do |t|
t.integer "user_id" t.integer "user_id", index: {name: "index_authentications_on_user_id"}
t.string "provider" t.string "provider", index: {name: "index_authentications_on_provider_and_uid", with: ["uid"], unique: true}
t.string "uid" t.string "uid"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.index ["provider", "uid"], :name => "index_authentications_on_provider_and_uid", :unique => true
t.index ["user_id"], :name => "index_authentications_on_user_id"
end end
create_table "build_list_items", force: true do |t| create_table "build_list_items", force: :cascade do |t|
t.string "name" t.string "name"
t.integer "level" t.integer "level"
t.integer "status" t.integer "status"
t.integer "build_list_id" t.integer "build_list_id", index: {name: "index_build_list_items_on_build_list_id"}
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.string "version" t.string "version"
t.index ["build_list_id"], :name => "index_build_list_items_on_build_list_id"
end end
create_table "build_list_packages", force: true do |t| create_table "build_list_packages", force: :cascade do |t|
t.integer "build_list_id" t.integer "build_list_id", index: {name: "index_build_list_packages_on_build_list_id"}
t.integer "project_id" t.integer "project_id", index: {name: "index_build_list_packages_on_project_id"}
t.integer "platform_id" t.integer "platform_id", index: {name: "index_build_list_packages_on_platform_id"}
t.string "fullname" t.string "fullname"
t.string "name" t.string "name", index: {name: "index_build_list_packages_on_name_and_project_id", with: ["project_id"]}
t.string "version" t.string "version"
t.string "release" t.string "release"
t.string "package_type" t.string "package_type"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.boolean "actual", default: false t.boolean "actual", default: false, index: {name: "index_build_list_packages_on_actual_and_platform_id", with: ["platform_id"]}
t.string "sha1" t.string "sha1"
t.integer "epoch" t.integer "epoch"
t.text "dependent_packages" t.text "dependent_packages"
t.index :name => "build_list_packages_ordering", :expression => "lower((name)::text), length((name)::text)" t.index name: "build_list_packages_ordering", expression: "lower((name)::text), length((name)::text)"
t.index ["actual", "platform_id"], :name => "index_build_list_packages_on_actual_and_platform_id"
t.index ["build_list_id"], :name => "index_build_list_packages_on_build_list_id"
t.index ["name", "project_id"], :name => "index_build_list_packages_on_name_and_project_id"
t.index ["platform_id"], :name => "index_build_list_packages_on_platform_id"
t.index ["project_id"], :name => "index_build_list_packages_on_project_id"
end end
create_table "build_lists", force: true do |t| create_table "build_lists", force: :cascade do |t|
t.integer "status" t.integer "status"
t.string "project_version" t.string "project_version"
t.integer "project_id" t.integer "project_id", index: {name: "index_build_lists_on_project_id"}
t.integer "arch_id" t.integer "arch_id", index: {name: "index_build_lists_on_arch_id"}
t.datetime "notified_at" t.datetime "notified_at"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at", index: {name: "index_build_lists_on_updated_at", order: {"updated_at"=>:desc}}
t.boolean "is_circle", default: false t.boolean "is_circle", default: false
t.text "additional_repos" t.text "additional_repos"
t.string "name" t.string "name"
@ -125,14 +106,14 @@ ActiveRecord::Schema.define(version: 20150601043133) do
t.integer "build_for_platform_id" t.integer "build_for_platform_id"
t.integer "save_to_platform_id" t.integer "save_to_platform_id"
t.text "include_repos" t.text "include_repos"
t.integer "user_id" t.integer "user_id", index: {name: "index_build_lists_on_user_id"}
t.string "package_version" t.string "package_version"
t.string "commit_hash" t.string "commit_hash"
t.integer "priority", default: 0, null: false t.integer "priority", default: 0, null: false
t.datetime "started_at" t.datetime "started_at"
t.integer "duration" t.integer "duration"
t.integer "advisory_id" t.integer "advisory_id", index: {name: "index_build_lists_on_advisory_id"}
t.integer "mass_build_id" t.integer "mass_build_id", index: {name: "index_build_lists_on_mass_build_id_and_status", with: ["status"]}
t.integer "save_to_repository_id" t.integer "save_to_repository_id"
t.text "results" t.text "results"
t.boolean "new_core", default: true t.boolean "new_core", default: true
@ -151,17 +132,11 @@ ActiveRecord::Schema.define(version: 20150601043133) do
t.boolean "use_cached_chroot", default: false, null: false t.boolean "use_cached_chroot", default: false, null: false
t.boolean "use_extra_tests", default: true, null: false t.boolean "use_extra_tests", default: true, null: false
t.boolean "save_buildroot", default: false, null: false t.boolean "save_buildroot", default: false, null: false
t.index ["advisory_id"], :name => "index_build_lists_on_advisory_id"
t.index ["arch_id"], :name => "index_build_lists_on_arch_id"
t.index ["mass_build_id", "status"], :name => "index_build_lists_on_mass_build_id_and_status"
t.index ["project_id", "save_to_repository_id", "build_for_platform_id", "arch_id"], :name => "maintainer_search_index"
t.index ["project_id"], :name => "index_build_lists_on_project_id"
t.index ["updated_at"], :name => "index_build_lists_on_updated_at", :order => {"updated_at" => :desc}
t.index ["user_id"], :name => "index_build_lists_on_user_id"
end end
add_index "build_lists", ["project_id", "save_to_repository_id", "build_for_platform_id", "arch_id"], name: "maintainer_search_index"
create_table "projects", force: true do |t| create_table "projects", force: :cascade do |t|
t.string "name" t.string "name", index: {name: "index_projects_on_name_and_owner_id_and_owner_type", with: ["owner_id", "owner_type"], unique: true, case_sensitive: false}
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.integer "owner_id" t.integer "owner_id"
@ -179,47 +154,38 @@ ActiveRecord::Schema.define(version: 20150601043133) do
t.boolean "is_package", default: true, null: false t.boolean "is_package", default: true, null: false
t.integer "maintainer_id" t.integer "maintainer_id"
t.boolean "publish_i686_into_x86_64", default: false t.boolean "publish_i686_into_x86_64", default: false
t.string "owner_uname", null: false t.string "owner_uname", null: false
t.boolean "architecture_dependent", default: false, null: false t.boolean "architecture_dependent", default: false, null: false
t.integer "autostart_status" t.integer "autostart_status"
t.integer "alias_from_id" t.integer "alias_from_id", index: {name: "index_projects_on_alias_from_id"}
t.index ["alias_from_id"], :name => "index_projects_on_alias_from_id"
t.index ["name", "owner_id", "owner_type"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true, :case_sensitive => false
end end
create_table "build_scripts", force: true do |t| create_table "build_scripts", force: :cascade do |t|
t.integer "project_id", null: false t.integer "project_id", null: false, index: {name: "fk__build_scripts_project_id"}, foreign_key: {references: "projects", name: "fk_build_scripts_project_id", on_update: :no_action, on_delete: :no_action}
t.string "treeish", null: false t.string "treeish", null: false
t.string "commit" t.string "commit"
t.string "sha1" t.string "sha1"
t.string "status" t.string "status"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.index ["project_id", "treeish"], :name => "index_build_scripts_on_project_id_and_treeish", :unique => true
t.index ["project_id"], :name => "fk__build_scripts_project_id"
t.foreign_key ["project_id"], "projects", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_build_scripts_project_id"
end end
add_index "build_scripts", ["project_id", "treeish"], name: "index_build_scripts_on_project_id_and_treeish", unique: true
create_table "comments", force: true do |t| create_table "comments", force: :cascade do |t|
t.string "commentable_type" t.string "commentable_type", index: {name: "index_comments_on_commentable_type"}
t.integer "user_id" t.integer "user_id"
t.text "body" t.text "body"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.decimal "commentable_id", precision: 50, scale: 0 t.decimal "commentable_id", precision: 50, index: {name: "index_comments_on_commentable_id"}
t.integer "project_id" t.integer "project_id"
t.text "data" t.text "data"
t.boolean "automatic", default: false t.boolean "automatic", default: false, index: {name: "index_comments_on_automatic"}
t.decimal "created_from_commit_hash", precision: 50, scale: 0 t.decimal "created_from_commit_hash", precision: 50, index: {name: "index_comments_on_created_from_commit_hash"}
t.integer "created_from_issue_id" t.integer "created_from_issue_id", index: {name: "index_comments_on_created_from_issue_id"}
t.index ["automatic"], :name => "index_comments_on_automatic"
t.index ["commentable_id"], :name => "index_comments_on_commentable_id"
t.index ["commentable_type"], :name => "index_comments_on_commentable_type"
t.index ["created_from_commit_hash"], :name => "index_comments_on_created_from_commit_hash"
t.index ["created_from_issue_id"], :name => "index_comments_on_created_from_issue_id"
end end
create_table "event_logs", force: true do |t| create_table "event_logs", force: :cascade do |t|
t.integer "user_id" t.integer "user_id"
t.string "user_name" t.string "user_name"
t.integer "eventable_id" t.integer "eventable_id"
@ -235,16 +201,16 @@ ActiveRecord::Schema.define(version: 20150601043133) do
t.datetime "updated_at" t.datetime "updated_at"
end end
create_table "flash_notifies", force: true do |t| create_table "flash_notifies", force: :cascade do |t|
t.text "body_ru", null: false t.text "body_ru", null: false
t.text "body_en", null: false t.text "body_en", null: false
t.string "status", null: false t.string "status", null: false
t.boolean "published", default: true, null: false t.boolean "published", default: true, null: false
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
end end
create_table "groups", force: true do |t| create_table "groups", force: :cascade do |t|
t.integer "owner_id" t.integer "owner_id"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
@ -258,7 +224,7 @@ ActiveRecord::Schema.define(version: 20150601043133) do
t.string "default_branch" t.string "default_branch"
end end
create_table "hooks", force: true do |t| create_table "hooks", force: :cascade do |t|
t.text "data" t.text "data"
t.integer "project_id" t.integer "project_id"
t.string "name" t.string "name"
@ -266,65 +232,59 @@ ActiveRecord::Schema.define(version: 20150601043133) do
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
end end
create_table "issues", force: true do |t| create_table "issues", force: :cascade do |t|
t.integer "serial_id" t.integer "serial_id"
t.integer "project_id" t.integer "project_id", index: {name: "index_issues_on_project_id_and_serial_id", with: ["serial_id"], unique: true}
t.integer "assignee_id" t.integer "assignee_id"
t.string "title" t.string "title"
t.text "body" t.text "body"
t.string "status", default: "open" t.string "status", default: "open"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.integer "user_id" t.integer "user_id", index: {name: "index_issues_on_user_id"}
t.datetime "closed_at" t.datetime "closed_at"
t.integer "closed_by" t.integer "closed_by"
t.index ["project_id", "serial_id"], :name => "index_issues_on_project_id_and_serial_id", :unique => true
t.index ["user_id"], :name => "index_issues_on_user_id"
end end
create_table "key_pairs", force: true do |t| create_table "key_pairs", force: :cascade do |t|
t.text "public", null: false t.text "public", null: false
t.text "encrypted_secret", null: false t.text "encrypted_secret", null: false
t.string "key_id", null: false t.string "key_id", null: false
t.integer "user_id", null: false t.integer "user_id", null: false
t.integer "repository_id", null: false t.integer "repository_id", null: false, index: {name: "index_key_pairs_on_repository_id", unique: true}
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["repository_id"], :name => "index_key_pairs_on_repository_id", :unique => true
end end
create_table "key_pairs_backup", force: true do |t| create_table "key_pairs_backup", force: :cascade do |t|
t.integer "repository_id", null: false t.integer "repository_id", null: false, index: {name: "index_key_pairs_backup_on_repository_id", unique: true}
t.integer "user_id", null: false t.integer "user_id", null: false
t.string "key_id", null: false t.string "key_id", null: false
t.text "public", null: false t.text "public", null: false
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["repository_id"], :name => "index_key_pairs_backup_on_repository_id", :unique => true
end end
create_table "labelings", force: true do |t| create_table "labelings", force: :cascade do |t|
t.integer "label_id", null: false t.integer "label_id", null: false
t.integer "issue_id" t.integer "issue_id", index: {name: "index_labelings_on_issue_id"}
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["issue_id"], :name => "index_labelings_on_issue_id"
end end
create_table "labels", force: true do |t| create_table "labels", force: :cascade do |t|
t.string "name", null: false t.string "name", null: false
t.string "color", null: false t.string "color", null: false
t.integer "project_id" t.integer "project_id", index: {name: "index_labels_on_project_id"}
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["project_id"], :name => "index_labels_on_project_id"
end end
create_table "mass_builds", force: true do |t| create_table "mass_builds", force: :cascade do |t|
t.integer "build_for_platform_id", null: false t.integer "build_for_platform_id", null: false
t.string "name" t.string "name"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.string "arch_names" t.string "arch_names"
t.integer "user_id" t.integer "user_id"
t.integer "build_lists_count", default: 0, null: false t.integer "build_lists_count", default: 0, null: false
@ -333,7 +293,7 @@ ActiveRecord::Schema.define(version: 20150601043133) do
t.integer "missed_projects_count", default: 0, null: false t.integer "missed_projects_count", default: 0, null: false
t.text "missed_projects_list" t.text "missed_projects_list"
t.boolean "new_core", default: true t.boolean "new_core", default: true
t.integer "save_to_platform_id", null: false t.integer "save_to_platform_id", null: false
t.text "extra_repositories" t.text "extra_repositories"
t.text "extra_build_lists" t.text "extra_build_lists"
t.boolean "increase_release_tag", default: false, null: false t.boolean "increase_release_tag", default: false, null: false
@ -348,20 +308,20 @@ ActiveRecord::Schema.define(version: 20150601043133) do
t.string "external_nodes" t.string "external_nodes"
end end
create_table "users", force: true do |t| create_table "users", force: :cascade do |t|
t.string "name" t.string "name"
t.string "email", default: "", null: false t.string "email", default: "", null: false, index: {name: "index_users_on_email", unique: true}
t.string "encrypted_password", limit: 128, default: "", null: false t.string "encrypted_password", limit: 128, default: "", null: false
t.string "reset_password_token" t.string "reset_password_token", index: {name: "index_users_on_reset_password_token", unique: true}
t.datetime "reset_password_sent_at" t.datetime "reset_password_sent_at"
t.datetime "remember_created_at" t.datetime "remember_created_at"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.text "ssh_key" t.text "ssh_key"
t.string "uname" t.string "uname", index: {name: "index_users_on_uname", unique: true}
t.string "role" t.string "role"
t.string "language", default: "en" t.string "language", default: "en"
t.integer "own_projects_count", default: 0, null: false t.integer "own_projects_count", default: 0, null: false
t.text "professional_experience" t.text "professional_experience"
t.string "site" t.string "site"
t.string "company" t.string "company"
@ -370,48 +330,39 @@ ActiveRecord::Schema.define(version: 20150601043133) do
t.string "avatar_content_type" t.string "avatar_content_type"
t.integer "avatar_file_size" t.integer "avatar_file_size"
t.datetime "avatar_updated_at" t.datetime "avatar_updated_at"
t.integer "failed_attempts", default: 0 t.integer "failed_attempts", default: 0
t.string "unlock_token" t.string "unlock_token", index: {name: "index_users_on_unlock_token", unique: true}
t.datetime "locked_at" t.datetime "locked_at"
t.string "confirmation_token" t.string "confirmation_token", index: {name: "index_users_on_confirmation_token", unique: true}
t.datetime "confirmed_at" t.datetime "confirmed_at"
t.datetime "confirmation_sent_at" t.datetime "confirmation_sent_at"
t.string "authentication_token" t.string "authentication_token", index: {name: "index_users_on_authentication_token"}
t.integer "build_priority", default: 50 t.integer "build_priority", default: 50
t.boolean "sound_notifications", default: true t.boolean "sound_notifications", default: true
t.boolean "hide_email", default: true, null: false t.boolean "hide_email", default: true, null: false
t.index ["authentication_token"], :name => "index_users_on_authentication_token"
t.index ["confirmation_token"], :name => "index_users_on_confirmation_token", :unique => true
t.index ["email"], :name => "index_users_on_email", :unique => true
t.index ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
t.index ["uname"], :name => "index_users_on_uname", :unique => true
t.index ["unlock_token"], :name => "index_users_on_unlock_token", :unique => true
end end
create_table "node_instructions", force: true do |t| create_table "node_instructions", force: :cascade do |t|
t.integer "user_id", null: false t.integer "user_id", null: false, index: {name: "fk__node_instructions_user_id"}, foreign_key: {references: "users", name: "fk_node_instructions_user_id", on_update: :no_action, on_delete: :no_action}
t.text "encrypted_instruction", null: false t.text "encrypted_instruction", null: false
t.text "output" t.text "output"
t.string "status" t.string "status"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.index ["user_id"], :name => "fk__node_instructions_user_id"
t.foreign_key ["user_id"], "users", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_node_instructions_user_id"
end end
create_table "platform_arch_settings", force: true do |t| create_table "platform_arch_settings", force: :cascade do |t|
t.integer "platform_id", null: false t.integer "platform_id", null: false, index: {name: "index_platform_arch_settings_on_platform_id_and_arch_id", with: ["arch_id"], unique: true}
t.integer "arch_id", null: false t.integer "arch_id", null: false
t.integer "time_living", null: false t.integer "time_living", null: false
t.boolean "default" t.boolean "default"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["platform_id", "arch_id"], :name => "index_platform_arch_settings_on_platform_id_and_arch_id", :unique => true
end end
create_table "platforms", force: true do |t| create_table "platforms", force: :cascade do |t|
t.string "description" t.string "description"
t.string "name", null: false t.string "name", null: false, index: {name: "index_platforms_on_name", unique: true, case_sensitive: false}
t.integer "parent_platform_id" t.integer "parent_platform_id"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
@ -420,19 +371,18 @@ ActiveRecord::Schema.define(version: 20150601043133) do
t.string "owner_type" t.string "owner_type"
t.string "visibility", default: "open", null: false t.string "visibility", default: "open", null: false
t.string "platform_type", default: "main", null: false t.string "platform_type", default: "main", null: false
t.string "distrib_type", null: false t.string "distrib_type", null: false
t.integer "status" t.integer "status"
t.datetime "last_regenerated_at" t.datetime "last_regenerated_at"
t.integer "last_regenerated_status" t.integer "last_regenerated_status"
t.string "last_regenerated_log_sha1" t.string "last_regenerated_log_sha1"
t.string "automatic_metadata_regeneration" t.string "automatic_metadata_regeneration"
t.string "default_branch", null: false t.string "default_branch", null: false
t.index ["name"], :name => "index_platforms_on_name", :unique => true, :case_sensitive => false
end end
create_table "product_build_lists", force: true do |t| create_table "product_build_lists", force: :cascade do |t|
t.integer "product_id" t.integer "product_id", index: {name: "index_product_build_lists_on_product_id"}
t.integer "status", null: false t.integer "status", null: false
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.integer "project_id" t.integer "project_id"
@ -446,10 +396,9 @@ ActiveRecord::Schema.define(version: 20150601043133) do
t.integer "user_id" t.integer "user_id"
t.boolean "not_delete", default: false t.boolean "not_delete", default: false
t.boolean "autostarted", default: false t.boolean "autostarted", default: false
t.index ["product_id"], :name => "index_product_build_lists_on_product_id"
end end
create_table "products", force: true do |t| create_table "products", force: :cascade do |t|
t.string "name", null: false t.string "name", null: false
t.integer "platform_id", null: false t.integer "platform_id", null: false
t.datetime "created_at" t.datetime "created_at"
@ -463,28 +412,26 @@ ActiveRecord::Schema.define(version: 20150601043133) do
t.string "project_version" t.string "project_version"
end end
create_table "project_imports", force: true do |t| create_table "project_imports", force: :cascade do |t|
t.integer "project_id" t.integer "project_id"
t.string "name" t.string "name", index: {name: "index_project_imports_on_name_and_platform_id", with: ["platform_id"], unique: true, case_sensitive: false}
t.string "version" t.string "version"
t.datetime "file_mtime" t.datetime "file_mtime"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.integer "platform_id" t.integer "platform_id"
t.index ["name", "platform_id"], :name => "index_project_imports_on_name_and_platform_id", :unique => true, :case_sensitive => false
end end
create_table "project_statistics", force: true do |t| create_table "project_statistics", force: :cascade do |t|
t.integer "average_build_time", default: 0, null: false t.integer "average_build_time", default: 0, null: false
t.integer "build_count", default: 0, null: false t.integer "build_count", default: 0, null: false
t.integer "arch_id", null: false t.integer "arch_id", null: false
t.integer "project_id", null: false t.integer "project_id", null: false, index: {name: "index_project_statistics_on_project_id_and_arch_id", with: ["arch_id"], unique: true}
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["project_id", "arch_id"], :name => "index_project_statistics_on_project_id_and_arch_id", :unique => true
end end
create_table "project_tags", force: true do |t| create_table "project_tags", force: :cascade do |t|
t.integer "project_id" t.integer "project_id"
t.string "commit_id" t.string "commit_id"
t.string "sha1" t.string "sha1"
@ -494,32 +441,28 @@ ActiveRecord::Schema.define(version: 20150601043133) do
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
end end
create_table "project_to_repositories", force: true do |t| create_table "project_to_repositories", force: :cascade do |t|
t.integer "project_id" t.integer "project_id"
t.integer "repository_id" t.integer "repository_id", index: {name: "index_project_to_repositories_on_repository_id_and_project_id", with: ["project_id"], unique: true}
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.hstore "autostart_options" t.hstore "autostart_options"
t.index ["repository_id", "project_id"], :name => "index_project_to_repositories_on_repository_id_and_project_id", :unique => true
end end
create_table "pull_requests", force: true do |t| create_table "pull_requests", force: :cascade do |t|
t.integer "issue_id", null: false t.integer "issue_id", null: false, index: {name: "index_pull_requests_on_issue_id"}
t.integer "to_project_id", null: false t.integer "to_project_id", null: false, index: {name: "index_pull_requests_on_base_project_id"}
t.integer "from_project_id", null: false t.integer "from_project_id", null: false, index: {name: "index_pull_requests_on_head_project_id"}
t.string "to_ref", null: false t.string "to_ref", null: false
t.string "from_ref", null: false t.string "from_ref", null: false
t.string "from_project_owner_uname" t.string "from_project_owner_uname"
t.string "from_project_name" t.string "from_project_name"
t.index ["from_project_id"], :name => "index_pull_requests_on_head_project_id"
t.index ["issue_id"], :name => "index_pull_requests_on_issue_id"
t.index ["to_project_id"], :name => "index_pull_requests_on_base_project_id"
end end
create_table "register_requests", force: true do |t| create_table "register_requests", force: :cascade do |t|
t.string "name" t.string "name"
t.string "email" t.string "email", index: {name: "index_register_requests_on_email", unique: true, case_sensitive: false}
t.string "token" t.string "token", index: {name: "index_register_requests_on_token", unique: true, case_sensitive: false}
t.boolean "approved", default: false t.boolean "approved", default: false
t.boolean "rejected", default: false t.boolean "rejected", default: false
t.datetime "created_at" t.datetime "created_at"
@ -527,48 +470,42 @@ ActiveRecord::Schema.define(version: 20150601043133) do
t.string "interest" t.string "interest"
t.text "more" t.text "more"
t.string "language" t.string "language"
t.index ["email"], :name => "index_register_requests_on_email", :unique => true, :case_sensitive => false
t.index ["token"], :name => "index_register_requests_on_token", :unique => true, :case_sensitive => false
end end
create_table "relations", force: true do |t| create_table "relations", force: :cascade do |t|
t.integer "actor_id" t.integer "actor_id"
t.string "actor_type" t.string "actor_type", index: {name: "index_relations_on_actor_type_and_actor_id", with: ["actor_id"]}
t.integer "target_id" t.integer "target_id"
t.string "target_type" t.string "target_type", index: {name: "index_relations_on_target_type_and_target_id", with: ["target_id"]}
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.string "role" t.string "role"
t.index ["actor_type", "actor_id"], :name => "index_relations_on_actor_type_and_actor_id"
t.index ["target_type", "target_id"], :name => "index_relations_on_target_type_and_target_id"
end end
create_table "repositories", force: true do |t| create_table "repositories", force: :cascade do |t|
t.string "description", null: false t.string "description", null: false
t.integer "platform_id", null: false t.integer "platform_id", null: false, index: {name: "index_repositories_on_platform_id"}
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.string "name", null: false t.string "name", null: false
t.boolean "publish_without_qa", default: true t.boolean "publish_without_qa", default: true
t.boolean "synchronizing_publications", default: false, null: false t.boolean "synchronizing_publications", default: false, null: false
t.string "publish_builds_only_from_branch" t.string "publish_builds_only_from_branch"
t.index ["platform_id"], :name => "index_repositories_on_platform_id"
end end
create_table "repository_statuses", force: true do |t| create_table "repository_statuses", force: :cascade do |t|
t.integer "repository_id", null: false t.integer "repository_id", null: false, index: {name: "index_repository_statuses_on_repository_id_and_platform_id", with: ["platform_id"], unique: true}
t.integer "platform_id", null: false t.integer "platform_id", null: false
t.integer "status", default: 0 t.integer "status", default: 0
t.datetime "last_regenerated_at" t.datetime "last_regenerated_at"
t.integer "last_regenerated_status" t.integer "last_regenerated_status"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.string "last_regenerated_log_sha1" t.string "last_regenerated_log_sha1"
t.index ["repository_id", "platform_id"], :name => "index_repository_statuses_on_repository_id_and_platform_id", :unique => true
end end
create_table "settings_notifiers", force: true do |t| create_table "settings_notifiers", force: :cascade do |t|
t.integer "user_id", null: false t.integer "user_id", null: false
t.boolean "can_notify", default: true t.boolean "can_notify", default: true
t.boolean "new_comment", default: true t.boolean "new_comment", default: true
t.boolean "new_comment_reply", default: true t.boolean "new_comment_reply", default: true
@ -584,66 +521,57 @@ ActiveRecord::Schema.define(version: 20150601043133) do
t.boolean "update_code", default: false t.boolean "update_code", default: false
end end
create_table "ssh_keys", force: true do |t| create_table "ssh_keys", force: :cascade do |t|
t.string "name" t.string "name"
t.text "key", null: false t.text "key", null: false
t.string "fingerprint", null: false t.string "fingerprint", null: false, index: {name: "index_ssh_keys_on_fingerprint", unique: true}
t.integer "user_id", null: false t.integer "user_id", null: false, index: {name: "index_ssh_keys_on_user_id"}
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["fingerprint"], :name => "index_ssh_keys_on_fingerprint", :unique => true
t.index ["user_id"], :name => "index_ssh_keys_on_user_id"
end end
create_table "statistics", force: true do |t| create_table "statistics", force: :cascade do |t|
t.integer "user_id", null: false t.integer "user_id", null: false, index: {name: "index_statistics_on_user_id"}
t.string "email", null: false t.string "email", null: false
t.integer "project_id", null: false t.integer "project_id", null: false, index: {name: "index_statistics_on_project_id"}
t.string "project_name_with_owner", null: false t.string "project_name_with_owner", null: false
t.string "key", null: false t.string "key", null: false, index: {name: "index_statistics_on_key"}
t.integer "counter", default: 0, null: false t.integer "counter", default: 0, null: false
t.datetime "activity_at", null: false t.datetime "activity_at", null: false, index: {name: "index_statistics_on_activity_at"}
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.index ["activity_at"], :name => "index_statistics_on_activity_at"
t.index ["key", "activity_at"], :name => "index_statistics_on_key_and_activity_at"
t.index ["key"], :name => "index_statistics_on_key"
t.index ["project_id", "key", "activity_at"], :name => "index_statistics_on_project_id_and_key_and_activity_at"
t.index ["project_id"], :name => "index_statistics_on_project_id"
t.index ["user_id", "key", "activity_at"], :name => "index_statistics_on_user_id_and_key_and_activity_at"
t.index ["user_id", "project_id", "key", "activity_at"], :name => "index_statistics_on_all_keys", :unique => true
t.index ["user_id"], :name => "index_statistics_on_user_id"
end end
add_index "statistics", ["key", "activity_at"], name: "index_statistics_on_key_and_activity_at"
add_index "statistics", ["project_id", "key", "activity_at"], name: "index_statistics_on_project_id_and_key_and_activity_at"
add_index "statistics", ["user_id", "key", "activity_at"], name: "index_statistics_on_user_id_and_key_and_activity_at"
add_index "statistics", ["user_id", "project_id", "key", "activity_at"], name: "index_statistics_on_all_keys", unique: true
create_table "subscribes", force: true do |t| create_table "subscribes", force: :cascade do |t|
t.string "subscribeable_type" t.string "subscribeable_type"
t.integer "user_id" t.integer "user_id"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.boolean "status", default: true t.boolean "status", default: true
t.integer "project_id" t.integer "project_id"
t.decimal "subscribeable_id", precision: 50, scale: 0 t.decimal "subscribeable_id", precision: 50
end end
create_table "tokens", force: true do |t| create_table "tokens", force: :cascade do |t|
t.integer "subject_id", null: false t.integer "subject_id", null: false, index: {name: "index_tokens_on_subject_id_and_subject_type", with: ["subject_type"]}
t.string "subject_type", null: false t.string "subject_type", null: false
t.integer "creator_id", null: false t.integer "creator_id", null: false
t.integer "updater_id" t.integer "updater_id"
t.string "status", default: "active" t.string "status", default: "active"
t.text "description" t.text "description"
t.string "authentication_token", null: false t.string "authentication_token", null: false, index: {name: "index_tokens_on_authentication_token", unique: true}
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["authentication_token"], :name => "index_tokens_on_authentication_token", :unique => true
t.index ["subject_id", "subject_type"], :name => "index_tokens_on_subject_id_and_subject_type"
end end
create_table "user_builds_settings", force: true do |t| create_table "user_builds_settings", force: :cascade do |t|
t.integer "user_id", null: false t.integer "user_id", null: false, index: {name: "index_user_builds_settings_on_user_id", unique: true}
t.text "platforms", default: [], null: false, array: true t.text "platforms", default: [], null: false, array: true
t.string "external_nodes" t.string "external_nodes"
t.index ["user_id"], :name => "index_user_builds_settings_on_user_id", :unique => true
end end
end end

View File

@ -6,5 +6,10 @@ describe AdvisoriesController, type: :controller do
get :search get :search
expect(response).to_not redirect_to(forbidden_path) expect(response).to_not redirect_to(forbidden_path)
end end
it "should be able to perform index action" do
get :index
expect(response).to be_success
end
end end
end end

View File

@ -1,74 +1,64 @@
require 'spec_helper' require 'spec_helper'
describe Api::V1::IssuesController, type: :controller do describe Api::V1::IssuesController, type: :controller do
let(:user) { FactoryGirl.create(:user) }
let(:project) { FactoryGirl.create(:project_with_commit) }
let(:issue) { FactoryGirl.create(:issue, project: project, user: user) }
let(:open_project) { FactoryGirl.create(:project) }
let(:open_issue) { FactoryGirl.create(:issue, project: open_project) }
let(:own_hidden_project) { FactoryGirl.create(:project, owner: user, visibility: 'hidden') }
let(:own_hidden_issue) { FactoryGirl.create(:issue, project: own_hidden_project, assignee: user) }
let(:hidden_project) { FactoryGirl.create(:project, visibility: 'hidden') }
let(:hidden_issue) { FactoryGirl.create(:issue, project: hidden_project) }
let(:create_params) { {issue: {title: 'title', body: 'body'}, project_id: project.id, format: :json} }
let(:update_params) { {issue: {title: 'new title'}, project_id: project.id, id: issue.serial_id, format: :json} }
before do before do
stub_symlink_methods stub_symlink_methods
allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0)) allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0))
@project = FactoryGirl.create(:project_with_commit)
@issue = FactoryGirl.create(:issue, project: @project)
@membered_issue = FactoryGirl.create(:issue)
@membered_project = @membered_issue.project
create_relation(@membered_project, @issue.user, 'reader')
@open_issue = FactoryGirl.create(:issue)
@open_project = @open_issue.project
@own_hidden_project = FactoryGirl.create(:project, owner: @issue.user)
@own_hidden_project.update_column :visibility, 'hidden'
@own_hidden_issue = FactoryGirl.create(:issue, project: @own_hidden_project, assignee: @issue.user)
@hidden_issue = FactoryGirl.create(:issue)
@hidden_project = @hidden_issue.project
@hidden_project.update_column :visibility, 'hidden'
@create_params = {issue: {title: 'title', body: 'body'}, project_id: @project.id, format: :json}
@update_params = {issue: {title: 'new title'}, project_id: @project.id, id: @issue.serial_id, format: :json}
@pull = @project.pull_requests.new issue_attributes: {title: 'test', body: 'testing'}
@pull.issue.user, @pull.issue.project = @project.owner, @pull.to_project
@pull.to_ref = 'master'
@pull.from_project, @pull.from_ref = @project, 'non_conflicts'
@pull.save
end end
context 'read and accessible abilities' do context 'read and accessible abilities' do
context 'for user' do context 'for user' do
before do before do
http_login(@issue.user) http_login(user)
end end
it 'can show issue in own project' do it 'can show issue in own project' do
get :show, project_id: @project.id, id: @issue.serial_id, format: :json get :show, project_id: project.id, id: issue.serial_id, format: :json
expect(response).to be_success expect(response).to be_success
end end
it 'should render right template for show action' do it 'should render right template for show action' do
get :show, project_id: @project.id, id: @issue.serial_id, format: :json get :show, project_id: project.id, id: issue.serial_id, format: :json
expect(response).to render_template('api/v1/issues/show') expect(response).to render_template('api/v1/issues/show')
end end
it 'can show issue in open project' do it 'can show issue in open project' do
get :show, project_id: @open_project.id, id: @open_issue.serial_id, format: :json get :show, project_id: open_project.id, id: open_issue.serial_id, format: :json
expect(response).to be_success expect(response).to be_success
end end
it 'can show issue in own hidden project' do it 'can show issue in own hidden project' do
get :show, project_id: @own_hidden_project.id, id: @own_hidden_issue.serial_id, format: :json get :show, project_id: own_hidden_project.id, id: own_hidden_issue.serial_id, format: :json
expect(response).to be_success expect(response).to be_success
end end
it "can't show issue in hidden project" do it "can't show issue in hidden project" do
get :show, project_id: @hidden_project.id, id: @hidden_issue.serial_id, format: :json get :show, project_id: hidden_project.id, id: hidden_issue.serial_id, format: :json
expect(response.code).to eq '403' expect(response.code).to eq '403'
end end
it 'should return three issues' do it 'should return three issues' do
membered_issue = FactoryGirl.create(:issue)
membered_project = membered_issue.project
create_relation(membered_project, issue.user, 'reader')
issue && own_hidden_issue # init
get :all_index, filter: 'all', format: :json get :all_index, filter: 'all', format: :json
expect(assigns[:issues]).to include(@issue) expect(assigns[:issues]).to include(issue)
expect(assigns[:issues]).to include(@own_hidden_issue) expect(assigns[:issues]).to include(own_hidden_issue)
expect(assigns[:issues]).to include(@membered_issue) expect(assigns[:issues]).to include(membered_issue)
end end
it 'should render right template for all index action' do it 'should render right template for all index action' do
@ -77,8 +67,9 @@ describe Api::V1::IssuesController, type: :controller do
end end
it 'should return only assigned issue' do it 'should return only assigned issue' do
own_hidden_issue # init
get :user_index, format: :json get :user_index, format: :json
expect(assigns[:issues]).to include(@own_hidden_issue) expect(assigns[:issues]).to include(own_hidden_issue)
expect(assigns[:issues].count).to eq 1 expect(assigns[:issues].count).to eq 1
end end
@ -88,24 +79,30 @@ describe Api::V1::IssuesController, type: :controller do
end end
it 'should return 404' do it 'should return 404' do
get :show, project_id: @project.id, id: 999999, format: :json get :show, project_id: project.id, id: 999999, format: :json
expect(response.code).to eq '404' expect(response.code).to eq '404'
end end
it 'should redirect to pull request page' do it 'should redirect to pull request page' do
get :show, project_id: @project.id, id: @pull.reload.serial_id, format: :json pull = project.pull_requests.new issue_attributes: {title: 'test', body: 'testing'}
expect(response).to redirect_to(api_v1_project_pull_request_path(@project.id, @pull.serial_id)) pull.issue.user, pull.issue.project = project.owner, pull.to_project
pull.to_ref = 'master'
pull.from_project, pull.from_ref = project, 'non_conflicts'
pull.save
get :show, project_id: project.id, id: pull.reload.serial_id, format: :json
expect(response).to redirect_to(api_v1_project_pull_request_path(project.id, pull.serial_id))
end end
end end
context 'for anonymous user' do context 'for anonymous user' do
it 'can show issue in open project', anonymous_access: true do it 'can show issue in open project', anonymous_access: true do
get :show, project_id: @project.id, id: @issue.serial_id, format: :json get :show, project_id: project.id, id: issue.serial_id, format: :json
expect(response).to be_success expect(response).to be_success
end end
it "can't show issue in hidden project", anonymous_access: true do it "can't show issue in hidden project", anonymous_access: true do
get :show, project_id: @hidden_project.id, id: @hidden_issue.serial_id, format: :json get :show, project_id: hidden_project.id, id: hidden_issue.serial_id, format: :json
expect(response.code).to eq '403' expect(response.code).to eq '403'
end end
@ -119,54 +116,54 @@ describe Api::V1::IssuesController, type: :controller do
context 'create accessibility' do context 'create accessibility' do
context 'for user' do context 'for user' do
before do before do
http_login(@issue.user) http_login(user)
end end
it 'can create issue in own project' do it 'can create issue in own project' do
expect do expect do
post :create, @create_params post :create, create_params
end.to change(Issue, :count).by(1) end.to change(Issue, :count).by(1)
end end
it 'can create issue in own hidden project' do it 'can create issue in own hidden project' do
expect do expect do
post :create, @create_params.merge(project_id: @own_hidden_project.id) post :create, create_params.merge(project_id: own_hidden_project.id)
end.to change(Issue, :count).by(1) end.to change(Issue, :count).by(1)
end end
it 'can create issue in open project' do it 'can create issue in open project' do
expect do expect do
post :create, @create_params.merge(project_id: @open_project.id) post :create, create_params.merge(project_id: open_project.id)
end.to change(Issue, :count).by(1) end.to change(Issue, :count).by(1)
end end
it "can't create issue in hidden project" do it "can't create issue in hidden project" do
expect do expect do
post :create, @create_params.merge(project_id: @hidden_project.id) post :create, create_params.merge(project_id: hidden_project.id)
end.to change(Issue, :count).by(0) end.to change(Issue, :count).by(0)
end end
it 'can assignee issue in own project' do it 'can assignee issue in own project' do
post :create, @create_params.deep_merge(project_id: @own_hidden_project.id, issue: {assignee_id: @issue.user.id}) post :create, create_params.deep_merge(project_id: own_hidden_project.id, issue: {assignee_id: user.id})
expect(@own_hidden_project.issues.order(:id).last.assignee.id).to eq @issue.user.id expect(own_hidden_project.issues.order(:id).last.assignee.id).to eq user.id
end end
it "can't assignee issue in open project" do it "can't assignee issue in open project" do
post :create, @create_params.deep_merge(project_id: @open_project.id, issue: {assignee_id: @issue.user.id}) post :create, create_params.deep_merge(project_id: open_project.id, issue: {assignee_id: user.id})
expect(@open_project.issues.order(:id).last.assignee).to be_nil expect(open_project.issues.order(:id).last.assignee).to be_nil
end end
end end
context 'for anonymous user' do context 'for anonymous user' do
it "can't create issue in project", anonymous_access: true do it "can't create issue in project", anonymous_access: true do
expect do expect do
post :create, @create_params post :create, create_params
end.to change(Issue, :count).by(0) end.to change(Issue, :count).by(0)
end end
it "can't create issue in hidden project", anonymous_access: true do it "can't create issue in hidden project", anonymous_access: true do
expect do expect do
post :create, @create_params.merge(project_id: @hidden_project.id) post :create, create_params.merge(project_id: hidden_project.id)
end.to change(Issue, :count).by(0) end.to change(Issue, :count).by(0)
end end
end end
@ -175,48 +172,48 @@ describe Api::V1::IssuesController, type: :controller do
context 'update accessibility' do context 'update accessibility' do
context 'for user' do context 'for user' do
before(:each) do before(:each) do
http_login(@issue.user) http_login(user)
end end
it 'can update issue in own project' do it 'can update issue in own project' do
put :update, @update_params put :update, update_params
expect(@issue.reload.title).to eq 'new title' expect(issue.reload.title).to eq 'new title'
end end
it 'can update issue in own hidden project' do it 'can update issue in own hidden project' do
put :update, @update_params.merge(project_id: @own_hidden_project.id, id: @own_hidden_issue.serial_id) put :update, update_params.merge(project_id: own_hidden_project.id, id: own_hidden_issue.serial_id)
expect(@own_hidden_issue.reload.title).to eq 'new title' expect(own_hidden_issue.reload.title).to eq 'new title'
end end
it "can't update issue in open project" do it "can't update issue in open project" do
put :update, @update_params.merge(project_id: @open_project.id, id: @open_issue.serial_id) put :update, update_params.merge(project_id: open_project.id, id: open_issue.serial_id)
expect(@open_issue.reload.title).to_not eq 'new title' expect(open_issue.reload.title).to_not eq 'new title'
end end
it "can't update issue in hidden project" do it "can't update issue in hidden project" do
put :update, @update_params.merge(project_id: @hidden_project.id, id: @hidden_issue.serial_id) put :update, update_params.merge(project_id: hidden_project.id, id: hidden_issue.serial_id)
expect(@hidden_issue.reload.title).to_not eq 'title' expect(hidden_issue.reload.title).to_not eq 'title'
end end
it "can't assignee issue in open project" do it "can't assignee issue in open project" do
post :create, @update_params.deep_merge(project_id: @open_project.id, issue: {assignee_id: @issue.user.id}) post :create, update_params.deep_merge(project_id: open_project.id, issue: {assignee_id: user.id})
expect(@open_issue.reload.assignee.id).to_not eq @issue.user.id expect(open_issue.reload.assignee.id).to_not eq issue.user.id
end end
it 'can assignee issue in own project' do it 'can assignee issue in own project' do
post :create, @update_params.deep_merge(issue: {assignee_id: @issue.user.id}) post :create, update_params.deep_merge(issue: {assignee_id: issue.user.id})
expect(@issue.reload.assignee.id).to_not eq @issue.user.id expect(issue.reload.assignee.id).to_not eq issue.user.id
end end
end end
context 'for anonymous user' do context 'for anonymous user' do
it "can't update issue in project", anonymous_access: true do it "can't update issue in project", anonymous_access: true do
put :update, @update_params put :update, update_params
expect(response.code).to eq '401' expect(response.code).to eq '401'
end end
it "can't update issue in hidden project", anonymous_access: true do it "can't update issue in hidden project", anonymous_access: true do
put :update, @update_params.merge(project_id: @hidden_project.id, id: @hidden_issue.serial_id) put :update, update_params.merge(project_id: hidden_project.id, id: hidden_issue.serial_id)
expect(response.code).to eq '401' expect(response.code).to eq '401'
end end
end end

View File

@ -5,16 +5,16 @@ shared_examples_for "api projects user with reader rights" do
end end
shared_examples_for "api projects user with reader rights for hidden project" do shared_examples_for "api projects user with reader rights for hidden project" do
before(:each) do before do
@project.update_column(:visibility, 'hidden') project.update_column(:visibility, 'hidden')
end end
it_should_behave_like 'api projects user with show rights' it_should_behave_like 'api projects user with show rights'
end end
shared_examples_for "api projects user without reader rights for hidden project" do shared_examples_for "api projects user without reader rights for hidden project" do
before(:each) do before do
@project.update_column(:visibility, 'hidden') project.update_column(:visibility, 'hidden')
end end
it_should_behave_like 'api projects user without show rights' it_should_behave_like 'api projects user without show rights'
@ -22,98 +22,92 @@ end
shared_examples_for "api projects user without show rights" do shared_examples_for "api projects user without show rights" do
it "to show access violation instead of project data" do it "to show access violation instead of project data" do
get :show, id: @project.id, format: :json get :show, id: project.id, format: :json
expect(response).to_not be_success expect(response).to_not be_success
end end
it "to show access violation instead of project refs_list" do it "to show access violation instead of project refs_list" do
get :refs_list, id: @project.id, format: :json get :refs_list, id: project.id, format: :json
expect(response).to_not be_success expect(response).to_not be_success
end end
it "to access violation instead of project data by get_id" do it "to access violation instead of project data by get_id" do
get :get_id, name: @project.name, owner: @project.owner_uname, format: :json get :get_id, name: project.name, owner: project.owner_uname, format: :json
expect(response).to_not be_success expect(response).to_not be_success
end end
it "to show access violation instead of project members data" do it "to show access violation instead of project members data" do
get :members, id: @project.id, format: :json get :members, id: project.id, format: :json
expect(response).to_not be_success expect(response).to_not be_success
end end
end end
shared_examples_for 'api projects user without fork rights' do shared_examples_for 'api projects user without fork rights' do
before { project } # init
it 'to not be able to perform fork action' do it 'to not be able to perform fork action' do
post :fork, id: @project.id, format: :json
expect(response).to_not be_success
end
it 'ensures that project has not been forked' do
expect do expect do
post :fork, id: @project.id, format: :json post :fork, id: project.id, format: :json
end.to_not change(Project, :count) end.to_not change(Project, :count)
expect(response).to_not be_success
end end
end end
shared_examples_for 'api projects user with fork rights' do shared_examples_for 'api projects user with fork rights' do
before { project } # init
it 'to be able to perform fork action' do it 'to be able to perform fork action' do
post :fork, id: @project.id, format: :json
expect(response).to be_success
end
it 'ensures that project has been forked' do
expect do expect do
post :fork, id: @project.id, format: :json post :fork, id: project.id, format: :json
end.to change(Project, :count).by(1) end.to change(Project, :count).by(1)
expect(response).to be_success
end end
it 'to be able to perform fork action with different name' do it 'to be able to perform fork action with different name' do
post :fork, id: @project.id, fork_name: (@project.name + '_forked'), format: :json new_name = project.name + '_forked'
expect(response).to be_success
end
it 'ensures that project has been forked' do
new_name = @project.name + '_forked'
expect do expect do
post :fork, id: @project.id, fork_name: new_name, format: :json post :fork, id: project.id, fork_name: new_name, format: :json
end.to change{ Project.where(name: new_name).count }.by(1) end.to change{ Project.where(name: new_name).count }.by(1)
expect(response).to be_success
end end
end end
shared_examples_for 'api projects user with fork rights for hidden project' do shared_examples_for 'api projects user with fork rights for hidden project' do
before { @project.update_column(:visibility, 'hidden') } before { project.update_column(:visibility, 'hidden') }
it_should_behave_like 'api projects user with fork rights' it_should_behave_like 'api projects user with fork rights'
end end
shared_examples_for 'api projects user without fork rights for hidden project' do shared_examples_for 'api projects user without fork rights for hidden project' do
before { @project.update_column(:visibility, 'hidden') } before { project.update_column(:visibility, 'hidden') }
it_should_behave_like 'api projects user without fork rights' it_should_behave_like 'api projects user without fork rights'
end end
shared_examples_for "api projects user with show rights" do shared_examples_for "api projects user with show rights" do
it "to show project data" do it "to show project data" do
get :show, id: @project.id, format: :json get :show, id: project.id, format: :json
expect(response).to render_template(:show) expect(response).to render_template(:show)
end end
it "to show refs_list of project" do it "to show refs_list of project" do
get :refs_list, id: @project.id, format: :json get :refs_list, id: project.id, format: :json
expect(response).to render_template(:refs_list) expect(response).to render_template(:refs_list)
end end
context 'project find by get_id' do context 'project find by get_id' do
it "to find project by name and owner name" do it "to find project by name and owner name" do
@project.reload project.reload
get :get_id, name: @project.name, owner: @project.owner_uname, format: :json get :get_id, name: project.name, owner: project.owner_uname, format: :json
expect(assigns[:project].id).to eq @project.id expect(assigns[:project].id).to eq project.id
end end
it "to not find project by non existing name and owner name" do it "to not find project by non existing name and owner name" do
get :get_id, name: 'NONE_EXISTING_NAME', owner: @project.owner_uname, format: :json get :get_id, name: 'NONE_EXISTING_NAME', owner: project.owner_uname, format: :json
expect(assigns :project).to be_blank expect(assigns :project).to be_blank
end end
it "to render 404 for non existing name and owner name" do it "to render 404 for non existing name and owner name" do
get :get_id, name: 'NONE_EXISTING_NAME', owner: @project.owner_uname, format: :json get :get_id, name: 'NONE_EXISTING_NAME', owner: project.owner_uname, format: :json
expect(response.body).to eq({status: 404, message: I18n.t("flash.404_message")}.to_json) expect(response.body).to eq({status: 404, message: I18n.t("flash.404_message")}.to_json)
end end
end end
@ -122,68 +116,60 @@ end
shared_examples_for 'api projects user with admin rights' do shared_examples_for 'api projects user with admin rights' do
it "to be able to perform members action" do it "to be able to perform members action" do
get :members, id: @project.id, format: :json get :members, id: project.id, format: :json
expect(response).to be_success expect(response).to be_success
end end
it 'to not set a wrong maintainer_id' do it 'to not set a wrong maintainer_id' do
put :update, project: { maintainer_id: -1 }, id: @project.id, format: :json put :update, project: { maintainer_id: -1 }, id: project.id, format: :json
expect(response).to_not be_success expect(response).to_not be_success
end end
context 'api project user with update rights' do context 'api project user with update rights' do
before do before do
put :update, project: { description: 'new description' }, id: @project.id, format: :json put :update, project: { description: 'new description' }, id: project.id, format: :json
end end
it 'to be able to perform update action' do it 'to be able to perform update action' do
expect(response).to be_success expect(response).to be_success
end expect(project.reload.description).to eq 'new description'
it 'ensures that description has been updated' do
expect(@project.reload.description).to eq 'new description'
end end
end end
context 'api project user with add_member rights' do context 'api project user with add_member rights' do
let(:member) { FactoryGirl.create(:user) } let(:member) { FactoryGirl.create(:user) }
before do before do
put :add_member, member_id: member.id, type: 'User', role: 'admin', id: @project.id, format: :json put :add_member, member_id: member.id, type: 'User', role: 'admin', id: project.id, format: :json
end end
it 'to be able to perform add_member action' do it 'to be able to perform add_member action' do
expect(response).to be_success expect(response).to be_success
end expect(project.members).to include(member)
it 'ensures that new member has been added to project' do
expect(@project.members).to include(member)
end end
end end
context 'api project user with remove_member rights' do context 'api project user with remove_member rights' do
let(:member) { FactoryGirl.create(:user) } let(:member) { FactoryGirl.create(:user) }
before do before do
@project.add_member(member) project.add_member(member)
delete :remove_member, member_id: member.id, type: 'User', id: @project.id, format: :json delete :remove_member, member_id: member.id, type: 'User', id: project.id, format: :json
end end
it 'to be able to perform remove_member action' do it 'to be able to perform remove_member action' do
expect(response).to be_success expect(response).to be_success
end expect(project.members).to_not include(member)
it 'ensures that member has been removed from project' do
expect(@project.members).to_not include(member)
end end
end end
context 'api group user with update_member rights' do context 'api group user with update_member rights' do
let(:member) { FactoryGirl.create(:user) } let(:member) { FactoryGirl.create(:user) }
before do before do
@project.add_member(member) project.add_member(member)
put :update_member, member_id: member.id, type: 'User', role: 'reader', id: @project.id, format: :json put :update_member, member_id: member.id, type: 'User', role: 'reader', id: project.id, format: :json
end end
it 'to be able to perform update_member action' do it 'to be able to perform update_member action' do
expect(response).to be_success expect(response).to be_success
end role = project.relations.by_actor(member).first.role
it 'ensures that member role has been updated in project' do
role = @project.relations.by_actor(member).first.role
expect(role).to eq 'reader' expect(role).to eq 'reader'
end end
end end
@ -192,112 +178,106 @@ end
shared_examples_for 'api projects user without admin rights' do shared_examples_for 'api projects user without admin rights' do
it "to not be able to perform members action" do it "to not be able to perform members action" do
get :members, id: @project.id, format: :json get :members, id: project.id, format: :json
expect(response).to_not be_success expect(response).to_not be_success
end end
context 'api project user without update_member rights' do context 'api project user without update_member rights' do
let(:member) { FactoryGirl.create(:user) } let(:member) { FactoryGirl.create(:user) }
before do before do
@project.add_member(member) project.add_member(member)
put :update_member, member_id: member.id, type: 'User', role: 'reader', id: @project.id, format: :json put :update_member, member_id: member.id, type: 'User', role: 'reader', id: project.id, format: :json
end end
it 'to not be able to perform update_member action' do it 'to not be able to perform update_member action' do
expect(response).to_not be_success expect(response).to_not be_success
end role = project.relations.by_actor(member).first.role
it 'ensures that member role has not been updated in project' do
role = @project.relations.by_actor(member).first.role
expect(role).to_not eq 'reader' expect(role).to_not eq 'reader'
end end
end end
context 'api project user without update rights' do context 'api project user without update rights' do
before do before do
put :update, project: {description: 'new description'}, id: @project.id, format: :json put :update, project: {description: 'new description'}, id: project.id, format: :json
end end
it 'to not be able to perform update action' do it 'to not be able to perform update action' do
expect(response).to_not be_success expect(response).to_not be_success
end expect(project.reload.description).to_not eq 'new description'
it 'ensures that project has not been updated' do
expect(@project.reload.description).to_not eq 'new description'
end end
end end
context 'api project user without add_member rights' do context 'api project user without add_member rights' do
let(:member) { FactoryGirl.create(:user) } let(:member) { FactoryGirl.create(:user) }
before do before do
put :add_member, member_id: member.id, type: 'User', role: 'admin', id: @project.id, format: :json put :add_member, member_id: member.id, type: 'User', role: 'admin', id: project.id, format: :json
end end
it 'to not be able to perform add_member action' do it 'to not be able to perform add_member action' do
expect(response).to_not be_success expect(response).to_not be_success
end expect(project.members).to_not include(member)
it 'ensures that new member has not been added to project' do
expect(@project.members).to_not include(member)
end end
end end
context 'api project user without remove_member rights' do context 'api project user without remove_member rights' do
let(:member) { FactoryGirl.create(:user) } let(:member) { FactoryGirl.create(:user) }
before do before do
@project.add_member(member) project.add_member(member)
delete :remove_member, member_id: member.id, type: 'User', id: @project.id, format: :json delete :remove_member, member_id: member.id, type: 'User', id: project.id, format: :json
end end
it 'to be able to perform update action' do it 'to be able to perform update action' do
expect(response).to_not be_success expect(response).to_not be_success
end expect(project.members).to include(member)
it 'ensures that member has not been removed from project' do
expect(@project.members).to include(member)
end end
end end
end end
shared_examples_for 'api projects user with owner rights' do shared_examples_for 'api projects user with owner rights' do
before { project } # init
context 'api project user with destroy rights' do context 'api project user with destroy rights' do
it 'to be able to perform destroy action' do it 'to be able to perform destroy action' do
delete :destroy, id: @project.id, format: :json
expect(response).to be_success
end
it 'ensures that project has been destroyed' do
expect do expect do
delete :destroy, id: @project.id, format: :json delete :destroy, id: project.id, format: :json
end.to change(Project, :count).by(-1) end.to change(Project, :count).by(-1)
expect(response).to be_success
end end
end end
end end
shared_examples_for 'api projects user without owner rights' do shared_examples_for 'api projects user without owner rights' do
before { project } # init
context 'api project user with destroy rights' do context 'api project user with destroy rights' do
it 'to not be able to perform destroy action' do it 'to not be able to perform destroy action' do
delete :destroy, id: @project.id, format: :json
expect(response).to_not be_success
end
it 'ensures that project has not been destroyed' do
expect do expect do
delete :destroy, id: @project.id, format: :json delete :destroy, id: project.id, format: :json
end.to_not change(Project, :count) end.to_not change(Project, :count)
expect(response).to_not be_success
end end
end end
end end
describe Api::V1::ProjectsController, type: :controller do describe Api::V1::ProjectsController, type: :controller do
before(:each) do let(:project) { FactoryGirl.create(:project) }
let(:hidden_project) { FactoryGirl.create(:project) }
let(:another_user) { FactoryGirl.create(:user) }
before do
stub_symlink_methods stub_symlink_methods
@project = FactoryGirl.create(:project) # project = FactoryGirl.create(:project)
@hidden_project = FactoryGirl.create(:project) # hidden_project = FactoryGirl.create(:project)
@another_user = FactoryGirl.create(:user) # another_user = FactoryGirl.create(:user)
end end
context 'for guest' do context 'for guest' do
[:index, :members].each do |action| [:index, :members].each do |action|
it "to not be able to perform #{action} action" do it "to not be able to perform #{action} action" do
get action, id: @project.id, format: :json get action, id: project.id, format: :json
expect(response).to_not be_success expect(response).to_not be_success
end end
end end
@ -315,9 +295,10 @@ describe Api::V1::ProjectsController, type: :controller do
end end
context 'for simple user' do context 'for simple user' do
before(:each) do let(:user) { FactoryGirl.create(:user) }
@user = FactoryGirl.create(:user)
http_login(@user) before do
http_login(user)
end end
it 'to be able to perform index action' do it 'to be able to perform index action' do
@ -326,7 +307,7 @@ describe Api::V1::ProjectsController, type: :controller do
end end
context 'api project user with create rights' do context 'api project user with create rights' do
let(:params) { {project: {name: 'test_name', owner_id: @user.id, owner_type: 'User', visibility: 'open'}, format: :json} } let(:params) { {project: {name: 'test_name', owner_id: user.id, owner_type: 'User', visibility: 'open'}, format: :json} }
it 'to be able to perform create action' do it 'to be able to perform create action' do
post :create, params, format: :json post :create, params, format: :json
expect(response).to be_success expect(response).to be_success
@ -339,7 +320,7 @@ describe Api::V1::ProjectsController, type: :controller do
it 'writer group to be able to create project for their group' do it 'writer group to be able to create project for their group' do
group = FactoryGirl.create(:group) group = FactoryGirl.create(:group)
create_actor_relation(group, @user, 'writer') create_actor_relation(group, user, 'writer')
expect do expect do
post :create, params.deep_merge({project: {owner_type: 'Group', owner_id: group.id}}) post :create, params.deep_merge({project: {owner_type: 'Group', owner_id: group.id}})
end.to change(Project, :count).by(1) end.to change(Project, :count).by(1)
@ -347,7 +328,7 @@ describe Api::V1::ProjectsController, type: :controller do
it 'reader group to not be able to create project for their group' do it 'reader group to not be able to create project for their group' do
group = FactoryGirl.create(:group) group = FactoryGirl.create(:group)
create_actor_relation(group, @user, 'reader') create_actor_relation(group, user, 'reader')
expect do expect do
post :create, params.deep_merge({project: {owner_type: 'Group', owner_id: group.id}}) post :create, params.deep_merge({project: {owner_type: 'Group', owner_id: group.id}})
end.to_not change(Project, :count) end.to_not change(Project, :count)
@ -362,48 +343,53 @@ describe Api::V1::ProjectsController, type: :controller do
it_should_behave_like 'api projects user without owner rights' it_should_behave_like 'api projects user without owner rights'
context 'group writer' do context 'group writer' do
before { project } # init
it 'to be able to fork project to their group' do it 'to be able to fork project to their group' do
group = FactoryGirl.create(:group) group = FactoryGirl.create(:group)
create_actor_relation(group, @user, 'writer') create_actor_relation(group, user, 'writer')
expect do expect do
post :fork, id: @project.id, group_id: group.id, format: :json post :fork, id: project.id, group_id: group.id, format: :json
end.to change(Project, :count).by(1) end.to change(Project, :count).by(1)
end end
it 'to be able to fork project with different name to their group' do it 'to be able to fork project with different name to their group' do
group = FactoryGirl.create(:group) group = FactoryGirl.create(:group)
create_actor_relation(group, @user, 'writer') create_actor_relation(group, user, 'writer')
new_name = @project.name + '_forked' new_name = project.name + '_forked'
expect do expect do
post :fork, id: @project.id, group_id: group.id, fork_name: new_name, format: :json post :fork, id: project.id, group_id: group.id, fork_name: new_name, format: :json
end.to change { Project.where(name: new_name).count }.by(1) end.to change { Project.where(name: new_name).count }.by(1)
end end
end end
context 'group reader' do context 'group reader' do
before { project } # init
it 'to not be able to fork project to their group' do it 'to not be able to fork project to their group' do
group = FactoryGirl.create(:group) group = FactoryGirl.create(:group)
create_actor_relation(group, @user, 'reader') create_actor_relation(group, user, 'reader')
expect do expect do
post :fork, id: @project.id, group_id: group.id, format: :json post :fork, id: project.id, group_id: group.id, format: :json
end.to_not change(Project, :count) end.to_not change(Project, :count)
end end
it 'to not be able to fork project with different name to their group' do it 'to not be able to fork project with different name to their group' do
group = FactoryGirl.create(:group) group = FactoryGirl.create(:group)
new_name = @project.name + '_forked' new_name = project.name + '_forked'
create_actor_relation(group, @user, 'reader') create_actor_relation(group, user, 'reader')
expect do expect do
post :fork, id: @project.id, group_id: group.id, fork_name: new_name, format: :json post :fork, id: project.id, group_id: group.id, fork_name: new_name, format: :json
end.to_not change{ Project.where(name: new_name).count } end.to_not change{ Project.where(name: new_name).count }
end end
end end
end end
context 'for admin' do context 'for admin' do
before(:each) do let(:admin) { FactoryGirl.create(:admin) }
@admin = FactoryGirl.create(:admin)
http_login(@admin) before do
http_login(admin)
end end
it_should_behave_like 'api projects user with reader rights' it_should_behave_like 'api projects user with reader rights'
@ -415,10 +401,11 @@ describe Api::V1::ProjectsController, type: :controller do
end end
context 'for owner user' do context 'for owner user' do
before(:each) do let(:user) { FactoryGirl.create(:user) }
@user = FactoryGirl.create(:user) let(:project) { FactoryGirl.create(:project, owner: user) }
http_login(@user)
@project = FactoryGirl.create(:project, owner: @user) before do
http_login(user)
end end
it_should_behave_like 'api projects user with reader rights' it_should_behave_like 'api projects user with reader rights'
@ -430,10 +417,11 @@ describe Api::V1::ProjectsController, type: :controller do
end end
context 'for reader user' do context 'for reader user' do
before(:each) do let(:user) { FactoryGirl.create(:user) }
@user = FactoryGirl.create(:user)
http_login(@user) before do
create_relation(@project, @user, 'reader') http_login(user)
create_relation(project, user, 'reader')
end end
it_should_behave_like 'api projects user with reader rights' it_should_behave_like 'api projects user with reader rights'
@ -445,10 +433,11 @@ describe Api::V1::ProjectsController, type: :controller do
end end
context 'for writer user' do context 'for writer user' do
before(:each) do let(:user) { FactoryGirl.create(:user) }
@user = FactoryGirl.create(:user)
http_login(@user) before do
create_relation(@project, @user, 'writer') http_login(user)
create_relation(project, user, 'writer')
end end
it_should_behave_like 'api projects user with reader rights' it_should_behave_like 'api projects user with reader rights'
@ -460,11 +449,12 @@ describe Api::V1::ProjectsController, type: :controller do
end end
context 'for group' do context 'for group' do
before(:each) do let(:group) { FactoryGirl.create(:group) }
@group = FactoryGirl.create(:group) let(:group_user) { FactoryGirl.create(:user) }
@group_user = FactoryGirl.create(:user)
# @project.relations.destroy_all before do
http_login(@group_user) # project.relations.destroy_all
http_login(group_user)
end end
context 'with no relations to project' do context 'with no relations to project' do
@ -477,12 +467,10 @@ describe Api::V1::ProjectsController, type: :controller do
end end
context 'owner of the project' do context 'owner of the project' do
before(:each) do let(:project) { FactoryGirl.create(:project, owner: group) }
@project = FactoryGirl.create(:project, owner: @group)
end
context 'reader user' do context 'reader user' do
before(:each) { create_actor_relation(@group, @group_user, 'reader') } before { create_actor_relation(group, group_user, 'reader') }
it_should_behave_like 'api projects user with reader rights' it_should_behave_like 'api projects user with reader rights'
it_should_behave_like 'api projects user with reader rights for hidden project' it_should_behave_like 'api projects user with reader rights for hidden project'
@ -493,7 +481,7 @@ describe Api::V1::ProjectsController, type: :controller do
end end
context 'admin user' do context 'admin user' do
before(:each) { create_actor_relation(@group, @group_user, 'admin') } before { create_actor_relation(group, group_user, 'admin') }
it_should_behave_like 'api projects user with reader rights' it_should_behave_like 'api projects user with reader rights'
it_should_behave_like 'api projects user with reader rights for hidden project' it_should_behave_like 'api projects user with reader rights for hidden project'
@ -506,12 +494,12 @@ describe Api::V1::ProjectsController, type: :controller do
context 'member of the project' do context 'member of the project' do
context 'with admin rights' do context 'with admin rights' do
before(:each) do before do
create_relation(@project, @group, 'admin') create_relation(project, group, 'admin')
end end
context 'reader user' do context 'reader user' do
before(:each) { create_actor_relation(@group, @group_user, 'reader') } before { create_actor_relation(group, group_user, 'reader') }
it_should_behave_like 'api projects user with reader rights' it_should_behave_like 'api projects user with reader rights'
it_should_behave_like 'api projects user with reader rights for hidden project' it_should_behave_like 'api projects user with reader rights for hidden project'
@ -522,7 +510,7 @@ describe Api::V1::ProjectsController, type: :controller do
end end
context 'admin user' do context 'admin user' do
before(:each) { create_actor_relation(@group, @group_user, 'admin') } before { create_actor_relation(group, group_user, 'admin') }
it_should_behave_like 'api projects user with reader rights' it_should_behave_like 'api projects user with reader rights'
it_should_behave_like 'api projects user with reader rights for hidden project' it_should_behave_like 'api projects user with reader rights for hidden project'
@ -534,10 +522,10 @@ describe Api::V1::ProjectsController, type: :controller do
end end
context 'with reader rights' do context 'with reader rights' do
before(:each) { create_relation(@project, @group, 'reader') } before { create_relation(project, group, 'reader') }
context 'reader user' do context 'reader user' do
before(:each) { create_actor_relation(@group, @group_user, 'reader') } before { create_actor_relation(group, group_user, 'reader') }
it_should_behave_like 'api projects user with reader rights' it_should_behave_like 'api projects user with reader rights'
it_should_behave_like 'api projects user with reader rights for hidden project' it_should_behave_like 'api projects user with reader rights for hidden project'
@ -547,7 +535,7 @@ describe Api::V1::ProjectsController, type: :controller do
it_should_behave_like 'api projects user without owner rights' it_should_behave_like 'api projects user without owner rights'
context 'user should has best role' do context 'user should has best role' do
before(:each) { create_relation(@project, @group_user, 'admin') } before { create_relation(project, group_user, 'admin') }
it_should_behave_like 'api projects user with reader rights' it_should_behave_like 'api projects user with reader rights'
it_should_behave_like 'api projects user with fork rights' it_should_behave_like 'api projects user with fork rights'
@ -557,8 +545,9 @@ describe Api::V1::ProjectsController, type: :controller do
end end
end end
context 'admin user' do context 'admin user' do
before(:each) { create_actor_relation(@group, @group_user, 'admin') } before { create_actor_relation(group, group_user, 'admin') }
it_should_behave_like 'api projects user with reader rights' it_should_behave_like 'api projects user with reader rights'
it_should_behave_like 'api projects user with reader rights for hidden project' it_should_behave_like 'api projects user with reader rights for hidden project'

View File

@ -1,6 +1,6 @@
require 'spec_helper' require 'spec_helper'
def create_pull to_ref, from_ref, owner, project = @project def create_pull to_ref, from_ref, owner, project
pull = project.pull_requests.build issue_attributes: {title: 'test', body: 'testing'} pull = project.pull_requests.build issue_attributes: {title: 'test', body: 'testing'}
pull.issue.user, pull.issue.project = owner, pull.to_project pull.issue.user, pull.issue.project = owner, pull.to_project
pull.to_ref, pull.from_ref, pull.from_project = to_ref, from_ref, project pull.to_ref, pull.from_ref, pull.from_project = to_ref, from_ref, project
@ -9,74 +9,81 @@ def create_pull to_ref, from_ref, owner, project = @project
end end
describe Api::V1::PullRequestsController, type: :controller do describe Api::V1::PullRequestsController, type: :controller do
let(:user) { FactoryGirl.create(:user) }
let(:project) { FactoryGirl.create(:project_with_commit, owner: user) }
let(:issue) { FactoryGirl.create(:issue, project: project) }
let(:pull) { create_pull 'master', 'non_conflicts', user, project }
let(:another_project) { FactoryGirl.create(:project_with_commit) }
let(:another_pull) { create_pull 'master', 'non_conflicts', another_project.owner, another_project }
let(:hidden_project) { FactoryGirl.create(:project_with_commit, visibility: 'hidden') }
let(:hidden_pull) { create_pull 'master', 'non_conflicts', hidden_project.owner, hidden_project }
let(:own_hidden_project) { FactoryGirl.create(:project_with_commit, owner: user, visibility: 'hidden') }
let(:own_hidden_pull) { create_pull 'master', 'non_conflicts', user, own_hidden_project }
let(:membered_project) { FactoryGirl.create(:project_with_commit) }
let(:membered_pull) { create_pull 'master', 'non_conflicts', membered_project.owner, membered_project }
let(:create_params) { {
pull_request: {
title: 'title',
body: 'body',
from_ref: 'conflicts',
to_ref: 'master'
},
project_id: project.id,
format: :json
} }
let(:update_params) { {
pull_request: {
title: 'new title'
},
project_id: project.id,
id: pull.serial_id,
format: :json
} }
before do before do
stub_symlink_methods stub_symlink_methods
@project = FactoryGirl.create(:project_with_commit) own_hidden_pull.issue.update_column :assignee_id, user.id
@pull = create_pull 'master', 'non_conflicts', @project.owner create_relation(membered_project, user, 'reader')
@another_project = FactoryGirl.create(:project_with_commit)
@another_pull = create_pull 'master', 'non_conflicts', @another_project.owner, @another_project
@hidden_project = FactoryGirl.create(:project_with_commit)
@hidden_project.update_column :visibility, 'hidden'
@hidden_pull = create_pull 'master', 'non_conflicts', @hidden_project.owner, @hidden_project
@own_hidden_project = FactoryGirl.create(:project_with_commit, owner: @project.owner)
@own_hidden_project.update_column :visibility, 'hidden'
@own_hidden_pull = create_pull 'master', 'non_conflicts', @own_hidden_project.owner, @own_hidden_project
@own_hidden_pull.issue.update_column :assignee_id, @project.owner.id
@membered_project = FactoryGirl.create(:project_with_commit)
@membered_pull = create_pull 'master', 'non_conflicts', @membered_project.owner, @membered_project
create_relation(@membered_project, @pull.user, 'reader')
@create_params = {pull_request: {title: 'title', body: 'body',
from_ref: 'conflicts', to_ref: 'master'},
project_id: @project.id, format: :json}
@update_params = {pull_request: {title: 'new title'},
project_id: @project.id, id: @pull.serial_id, format: :json}
@issue = FactoryGirl.create(:issue, project: @project)
end end
context 'read and accessible abilities' do context 'read and accessible abilities' do
context 'for user' do context 'for user' do
before do before do
http_login(@project.owner) http_login(user)
end end
it 'can show pull request in own project' do it 'can show pull request in own project' do
get :show, project_id: @project.id, id: @pull.serial_id, format: :json get :show, project_id: project.id, id: pull.serial_id, format: :json
expect(response).to be_success expect(response).to be_success
end end
it 'should render right template for show action' do it 'should render right template for show action' do
get :show, project_id: @project.id, id: @pull.serial_id, format: :json get :show, project_id: project.id, id: pull.serial_id, format: :json
expect(response).to render_template('api/v1/pull_requests/show') expect(response).to render_template('api/v1/pull_requests/show')
end end
it 'can show pull request in open project' do it 'can show pull request in open project' do
get :show, project_id: @another_project.id, id: @another_pull.serial_id, format: :json get :show, project_id: another_project.id, id: another_pull.serial_id, format: :json
expect(response).to be_success expect(response).to be_success
end end
it 'can show pull request in own hidden project' do it 'can show pull request in own hidden project' do
get :show, project_id: @own_hidden_project.id, id: @own_hidden_pull.serial_id, format: :json get :show, project_id: own_hidden_project.id, id: own_hidden_pull.serial_id, format: :json
expect(response).to be_success expect(response).to be_success
end end
it 'cant show pull request in hidden project' do it 'cant show pull request in hidden project' do
get :show, project_id: @hidden_project.id, id: @hidden_pull.serial_id, format: :json get :show, project_id: hidden_project.id, id: hidden_pull.serial_id, format: :json
expect(response.status).to eq 403 expect(response.status).to eq 403
end end
it 'should return three pull requests' do it 'should return three pull requests' do
pull && own_hidden_pull && membered_pull # init
get :all_index, filter: 'all', format: :json get :all_index, filter: 'all', format: :json
expect(assigns[:pulls]).to include(@pull) expect(assigns[:pulls]).to include(pull)
expect(assigns[:pulls]).to include(@own_hidden_pull) expect(assigns[:pulls]).to include(own_hidden_pull)
expect(assigns[:pulls]).to include(@membered_pull) expect(assigns[:pulls]).to include(membered_pull)
end end
it 'should render right template for all index action' do it 'should render right template for all index action' do
@ -85,8 +92,9 @@ describe Api::V1::PullRequestsController, type: :controller do
end end
it 'should return only assigned pull request' do it 'should return only assigned pull request' do
own_hidden_pull # init
get :user_index, format: :json get :user_index, format: :json
expect(assigns[:pulls]).to include(@own_hidden_pull) expect(assigns[:pulls]).to include(own_hidden_pull)
expect(assigns[:pulls].count).to eq 1 expect(assigns[:pulls].count).to eq 1
end end
@ -97,41 +105,41 @@ describe Api::V1::PullRequestsController, type: :controller do
%w(commits files).each do |action| %w(commits files).each do |action|
it "can show pull request #{action} in own project" do it "can show pull request #{action} in own project" do
get action, project_id: @project.id, id: @pull.serial_id, format: :json get action, project_id: project.id, id: pull.serial_id, format: :json
expect(response).to be_success expect(response).to be_success
end end
it "should render right template for commits action" do it "should render right template for commits action" do
get action, project_id: @project.id, id: @pull.serial_id, format: :json get action, project_id: project.id, id: pull.serial_id, format: :json
expect(response).to render_template("api/v1/pull_requests/#{action}") expect(response).to render_template("api/v1/pull_requests/#{action}")
end end
it "can't show pull request #{action} in hidden project" do it "can't show pull request #{action} in hidden project" do
get action, project_id: @hidden_project.id, id: @hidden_pull.serial_id, format: :json get action, project_id: hidden_project.id, id: hidden_pull.serial_id, format: :json
expect(response).to_not be_success expect(response).to_not be_success
end end
end end
it 'should return 404' do it 'should return 404' do
get :show, project_id: @project.id, id: 999999, format: :json get :show, project_id: project.id, id: 999999, format: :json
expect(response.status).to eq 404 expect(response.status).to eq 404
end end
it 'should redirect to issue page' do it 'should redirect to issue page' do
get :show, project_id: @project.id, id: @issue.serial_id, format: :json get :show, project_id: project.id, id: issue.serial_id, format: :json
expect(response).to redirect_to(api_v1_project_issue_path(@project.id, @issue.serial_id)) expect(response).to redirect_to(api_v1_project_issue_path(project.id, issue.serial_id))
end end
end end
context 'for anonymous user' do context 'for anonymous user' do
it 'can show pull request in open project', anonymous_access: true do it 'can show pull request in open project', anonymous_access: true do
get :show, project_id: @project.id, id: @pull.serial_id, format: :json get :show, project_id: project.id, id: pull.serial_id, format: :json
expect(response).to be_success expect(response).to be_success
end end
it 'cant show pull request in hidden project', anonymous_access: true do it 'cant show pull request in hidden project', anonymous_access: true do
@project.update_column :visibility, 'hidden' # project.update_column :visibility, 'hidden'
get :show, project_id: @project.id, id: @pull.serial_id, format: :json get :show, project_id: hidden_project.id, id: hidden_pull.serial_id, format: :json
expect(response.status).to eq 403 expect(response.status).to eq 403
end end
@ -142,17 +150,17 @@ describe Api::V1::PullRequestsController, type: :controller do
%w(commits files).each do |action| %w(commits files).each do |action|
it "can show pull request #{action} in project", anonymous_access: true do it "can show pull request #{action} in project", anonymous_access: true do
get action, project_id: @project.id, id: @pull.serial_id, format: :json get action, project_id: project.id, id: pull.serial_id, format: :json
expect(response).to be_success expect(response).to be_success
end end
it "should render right template for commits action", anonymous_access: true do it "should render right template for commits action", anonymous_access: true do
get action, project_id: @project.id, id: @pull.serial_id, format: :json get action, project_id: project.id, id: pull.serial_id, format: :json
expect(response).to render_template("api/v1/pull_requests/#{action}") expect(response).to render_template("api/v1/pull_requests/#{action}")
end end
it "can't show pull request #{action} in hidden project", anonymous_access: true do it "can't show pull request #{action} in hidden project", anonymous_access: true do
get action, project_id: @hidden_project.id, id: @hidden_pull.serial_id, format: :json get action, project_id: hidden_project.id, id: hidden_pull.serial_id, format: :json
expect(response).to_not be_success expect(response).to_not be_success
end end
end end
@ -162,30 +170,30 @@ describe Api::V1::PullRequestsController, type: :controller do
context 'create accessibility' do context 'create accessibility' do
context 'for user' do context 'for user' do
before(:each) do before(:each) do
http_login(@pull.user) http_login(user)
end end
it 'can create pull request in own project' do it 'can create pull request in own project' do
expect do expect do
post :create, @create_params post :create, create_params
end.to change(PullRequest, :count).by(1) end.to change(PullRequest, :count).by(1)
end end
it 'can create pull request in own hidden project' do it 'can create pull request in own hidden project' do
expect do expect do
post :create, @create_params.merge(project_id: @own_hidden_project.id) post :create, create_params.merge(project_id: own_hidden_project.id)
end.to change(PullRequest, :count).by(1) end.to change(PullRequest, :count).by(1)
end end
it 'can create pull request in open project' do it 'can create pull request in open project' do
expect do expect do
post :create, @create_params.merge(project_id: @another_project.id) post :create, create_params.merge(project_id: another_project.id)
end.to change(PullRequest, :count).by(1) end.to change(PullRequest, :count).by(1)
end end
it 'cant create pull request in hidden project' do it 'cant create pull request in hidden project' do
expect do expect do
post :create, @create_params.merge(project_id: @hidden_project.id) post :create, create_params.merge(project_id: hidden_project.id)
end.to_not change(PullRequest, :count) end.to_not change(PullRequest, :count)
end end
end end
@ -193,13 +201,13 @@ describe Api::V1::PullRequestsController, type: :controller do
context 'for anonymous user' do context 'for anonymous user' do
it 'cant create pull request in project', anonymous_access: true do it 'cant create pull request in project', anonymous_access: true do
expect do expect do
post :create, @create_params post :create, create_params
end.to_not change(PullRequest, :count) end.to_not change(PullRequest, :count)
end end
it 'cant create pull request in hidden project', anonymous_access: true do it 'cant create pull request in hidden project', anonymous_access: true do
expect do expect do
post :create, @create_params.merge(project_id: @hidden_project.id) post :create, create_params.merge(project_id: hidden_project.id)
end.to_not change(PullRequest, :count) end.to_not change(PullRequest, :count)
end end
end end
@ -208,110 +216,112 @@ describe Api::V1::PullRequestsController, type: :controller do
context 'update accessibility' do context 'update accessibility' do
context 'for user' do context 'for user' do
before(:each) do before(:each) do
http_login(@project.owner) http_login(project.owner)
end end
it 'can update pull request in own project' do it 'can update pull request in own project' do
put :update, @update_params put :update, update_params
expect(@pull.reload.title).to eq 'new title' expect(pull.reload.title).to eq 'new title'
end end
it 'can update pull request in own hidden project' do it 'can update pull request in own hidden project' do
put :update, @update_params.merge(project_id: @own_hidden_project.id, id: @own_hidden_pull.serial_id) put :update, update_params.merge(project_id: own_hidden_project.id, id: own_hidden_pull.serial_id)
expect(@own_hidden_pull.reload.title).to eq 'new title' expect(own_hidden_pull.reload.title).to eq 'new title'
end end
it 'cant update pull request in open project' do it 'cant update pull request in open project' do
put :update, @update_params.merge(project_id: @another_project.id, id: @another_pull.serial_id) put :update, update_params.merge(project_id: another_project.id, id: another_pull.serial_id)
expect(@another_pull.reload.title).to_not eq 'new title' expect(another_pull.reload.title).to_not eq 'new title'
end end
it 'cant update pull request in hidden project' do it 'cant update pull request in hidden project' do
put :update, @update_params.merge(project_id: @hidden_project.id, id: @hidden_pull.serial_id) put :update, update_params.merge(project_id: hidden_project.id, id: hidden_pull.serial_id)
expect(@hidden_pull.reload.title).to_not eq 'title' expect(hidden_pull.reload.title).to_not eq 'title'
end end
it 'can merge pull request in own project' do it 'can merge pull request in own project' do
put :merge, project_id: @project.id, id: @pull.serial_id, format: :json put :merge, project_id: project.id, id: pull.serial_id, format: :json
expect(@pull.reload.status).to eq 'merged' expect(pull.reload.status).to eq 'merged'
expect(response).to be_success expect(response).to be_success
end end
it 'can merge pull request in own hidden project' do it 'can merge pull request in own hidden project' do
put :merge, project_id: @own_hidden_project.id, id: @own_hidden_pull.serial_id, format: :json put :merge, project_id: own_hidden_project.id, id: own_hidden_pull.serial_id, format: :json
expect(@own_hidden_pull.reload.status).to eq 'merged' expect(own_hidden_pull.reload.status).to eq 'merged'
expect(response).to be_success expect(response).to be_success
end end
it 'cant merge pull request in open project' do it 'cant merge pull request in open project' do
put :merge, project_id: @another_project.id, id: @another_pull.serial_id, format: :json put :merge, project_id: another_project.id, id: another_pull.serial_id, format: :json
expect(@another_pull.reload.status).to eq 'ready' expect(another_pull.reload.status).to eq 'ready'
expect(response.status).to eq 403 expect(response.status).to eq 403
end end
it 'cant merge pull request in hidden project' do it 'cant merge pull request in hidden project' do
put :merge, project_id: @hidden_project.id, id: @hidden_pull.serial_id, format: :json put :merge, project_id: hidden_project.id, id: hidden_pull.serial_id, format: :json
expect(@hidden_pull.reload.status).to eq 'ready' expect(hidden_pull.reload.status).to eq 'ready'
expect(response.status).to eq 403 expect(response.status).to eq 403
end end
end end
context 'for anonymous user' do context 'for anonymous user' do
it 'cant update pull request in project', anonymous_access: true do it 'cant update pull request in project', anonymous_access: true do
put :update, @update_params put :update, update_params
expect(response.status).to eq 401 expect(response.status).to eq 401
end end
it 'cant update pull request in hidden project', anonymous_access: true do it 'cant update pull request in hidden project', anonymous_access: true do
put :update, @update_params.merge(project_id: @hidden_project.id, id: @hidden_pull.serial_id) put :update, update_params.merge(project_id: hidden_project.id, id: hidden_pull.serial_id)
expect(response.status).to eq 401 expect(response.status).to eq 401
end end
it 'cant merge pull request in open project' do it 'cant merge pull request in open project' do
put :merge, project_id: @another_project.id, id: @another_pull.serial_id, format: :json put :merge, project_id: another_project.id, id: another_pull.serial_id, format: :json
expect(@another_pull.reload.status).to eq 'ready' expect(another_pull.reload.status).to eq 'ready'
expect(response.status).to eq 401 expect(response.status).to eq 401
end end
it 'cant merge pull request in hidden project' do it 'cant merge pull request in hidden project' do
put :merge, project_id: @hidden_project.id, id: @hidden_pull.serial_id, format: :json put :merge, project_id: hidden_project.id, id: hidden_pull.serial_id, format: :json
expect(@hidden_pull.reload.status).to eq 'ready' expect(hidden_pull.reload.status).to eq 'ready'
expect(response.status).to eq 401 expect(response.status).to eq 401
end end
end end
end end
context 'send email messages' do context 'send email messages' do
before do let(:project_reader) { FactoryGirl.create :user }
@project_reader = FactoryGirl.create :user let(:project_writer) { FactoryGirl.create :user }
create_relation(@project, @project_reader, 'reader') let(:project_admin) { FactoryGirl.create :user }
@project_admin = FactoryGirl.create :user
create_relation(@project, @project_admin, 'admin')
@project_writer = FactoryGirl.create :user
create_relation(@project, @project_writer, 'writer')
http_login(@project_writer) before do
create_relation(project, project_reader, 'reader')
create_relation(project, project_admin, 'admin')
create_relation(project, project_writer, 'writer')
http_login(project_writer)
pull # init
ActionMailer::Base.deliveries = [] ActionMailer::Base.deliveries = []
end end
it 'should send two email messages to all project members' do it 'should send two email messages to all project members' do
post :create, @create_params post :create, create_params
expect(ActionMailer::Base.deliveries.count).to eq 3 # project owner + reader + admin expect(ActionMailer::Base.deliveries.count).to eq 3 # project owner + reader + admin
end end
it 'should send two email messages to admins and one to assignee' do it 'should send two email messages to admins and one to assignee' do
post :create, @create_params.deep_merge(pull_request: {assignee_id: @project_reader.id}) post :create, create_params.deep_merge(pull_request: {assignee_id: project_reader.id})
expect(ActionMailer::Base.deliveries.count).to eq 3 expect(ActionMailer::Base.deliveries.count).to eq 3
end end
it 'should send email message to new assignee' do it 'should send email message to new assignee' do
http_login(@project_admin) http_login(project_admin)
put :update, @update_params.deep_merge(pull_request: {assignee_id: @project_reader.id}) put :update, update_params.deep_merge(pull_request: {assignee_id: project_reader.id})
expect(ActionMailer::Base.deliveries.count).to eq 1 expect(ActionMailer::Base.deliveries.count).to eq 1
end end
it 'should not duplicate email message' do it 'should not duplicate email message' do
post :create, @create_params.deep_merge(pull_request: {assignee_id: @project_admin.id}) post :create, create_params.deep_merge(pull_request: {assignee_id: project_admin.id})
expect(ActionMailer::Base.deliveries.count).to eq 3 # send to all project members expect(ActionMailer::Base.deliveries.count).to eq 3 # send to all project members
expect(ActionMailer::Base.deliveries.map(&:to).uniq).to match_array(ActionMailer::Base.deliveries.map(&:to)) expect(ActionMailer::Base.deliveries.map(&:to).uniq).to match_array(ActionMailer::Base.deliveries.map(&:to))
end end

View File

@ -57,12 +57,10 @@ describe Projects::Git::TreesController, type: :controller do
expect { get :archive, @params.merge(format: 'tar.gz') }.to raise_error(ActionController::RoutingError) expect { get :archive, @params.merge(format: 'tar.gz') }.to raise_error(ActionController::RoutingError)
end end
it 'should not be able to injection code with format' do
expect { get :archive, @params.merge(format: "tar.gz master > /dev/null; echo 'I am hacker!';\#") }.to raise_error(ActionController::RoutingError)
end
it 'should not be able to injection code with treeish' do it 'should not be able to injection code with treeish' do
expect { get :archive, @params.merge(treeish: "master > /dev/null; echo 'I am hacker!';\#") }.to raise_error(ActionController::RoutingError) expect do
get :archive, @params.merge(format: 'tar.gz', treeish: "master > /dev/null; echo 'I am hacker!';\#")
end.to raise_error(ActionController::RoutingError)
end end
it 'should be able to perform archive action' do it 'should be able to perform archive action' do

View File

@ -40,83 +40,83 @@ describe ApiDefender, type: :request do
context 'for anonymous user' do context 'for anonymous user' do
it "should return the total limit" do it "should return the total limit" do
get_request get_request
response.headers['X-RateLimit-Limit'].should == @rate_limit.to_s expect(response.headers['X-RateLimit-Limit']).to eq @rate_limit.to_s
end end
it "should return the correct limit usage for anonymous user" do it "should return the correct limit usage for anonymous user" do
get_request get_request
response.headers['X-RateLimit-Remaining'].should == (@rate_limit-1).to_s expect(response.headers['X-RateLimit-Remaining']).to eq (@rate_limit-1).to_s
end end
it "should return the correct limit usage for anonymous user after authenticated access" do it "should return the correct limit usage for anonymous user after authenticated access" do
get_request @user get_request @user
get_request get_request
response.headers['X-RateLimit-Remaining'].should == (@rate_limit-2).to_s expect(response.headers['X-RateLimit-Remaining']).to eq (@rate_limit-2).to_s
end end
it "should forbidden anonymous user after exceeding limit rate" do it "should forbidden anonymous user after exceeding limit rate" do
(@rate_limit+1).times {get_request} (@rate_limit+1).times {get_request}
response.status.should == 403 expect(response.status).to eq 403
end end
end end
else else
it "should forbidden anonymous access" do it "should forbidden anonymous access" do
get_request get_request
response.status.should == 401 expect(response.status).to eq 401
end end
end end
context 'for user' do context 'for user' do
it "should return the correct limit usage for auth user" do it "should return the correct limit usage for auth user" do
get_request @user get_request @user
response.headers['X-RateLimit-Remaining'].should == (@rate_limit-1).to_s expect(response.headers['X-RateLimit-Remaining']).to eq (@rate_limit-1).to_s
end end
it "should allow auth by uname and password" do it "should allow auth by uname and password" do
(@rate_limit+1).times {get_request2} (@rate_limit+1).times {get_request2}
get_request @user get_request @user
response.headers['X-RateLimit-Remaining'].should == (@rate_limit-1).to_s expect(response.headers['X-RateLimit-Remaining']).to eq (@rate_limit-1).to_s
end end
it "should allow auth by email and password" do it "should allow auth by email and password" do
(@rate_limit+1).times {get_request2} (@rate_limit+1).times {get_request2}
get_request @user, false, true get_request @user, false, true
response.headers['X-RateLimit-Remaining'].should == (@rate_limit-1).to_s expect(response.headers['X-RateLimit-Remaining']).to eq (@rate_limit-1).to_s
end end
it "should allow auth by token" do it "should allow auth by token" do
(@rate_limit+1).times {get_request2} (@rate_limit+1).times {get_request2}
get_request @user, true get_request @user, true
response.headers['X-RateLimit-Remaining'].should == (@rate_limit-1).to_s expect(response.headers['X-RateLimit-Remaining']).to eq (@rate_limit-1).to_s
end end
it "should return the correct limit usage for auth user after other user" do it "should return the correct limit usage for auth user after other user" do
get_request2 get_request2
get_request @user get_request @user
response.headers['X-RateLimit-Remaining'].should == (@rate_limit-1).to_s expect(response.headers['X-RateLimit-Remaining']).to eq (@rate_limit-1).to_s
end end
it "should forbidden user after exceeding limit rate" do it "should forbidden user after exceeding limit rate" do
(@rate_limit+1).times {get_request @user} (@rate_limit+1).times {get_request @user}
response.status.should == 403 expect(response.status).to eq 403
end end
it "should not forbidden user after exceeding limit rate of the other user" do it "should not forbidden user after exceeding limit rate of the other user" do
(@rate_limit+1).times {get_request2} (@rate_limit+1).times {get_request2}
get_request @user get_request @user
response.status.should == 200 expect(response.status).to eq 200
end end
end end
context 'for system user' do context 'for system user' do
it "should not return the limit usage for system user" do it "should not return the limit usage for system user" do
get_request @system_user, true get_request @system_user, true
response.headers['X-RateLimit-Limit'].should_not == @rate_limit.to_s expect(response.headers['X-RateLimit-Limit']).to_not eq @rate_limit.to_s
end end
it "should not forbidden system user" do it "should not forbidden system user" do
(@rate_limit+1).times {get_request @system_user, true} (@rate_limit+1).times {get_request @system_user, true}
response.status.should == 200 expect(response.status).to eq 200
end end
end end
@ -124,12 +124,12 @@ describe ApiDefender, type: :request do
let(:remote_addr) { APP_CONFIG['allowed_addresses'].first } let(:remote_addr) { APP_CONFIG['allowed_addresses'].first }
it 'should not return the limit usage for allowed address' do it 'should not return the limit usage for allowed address' do
get "/api/v1/users/#{@user.id}.json", {}, {'REMOTE_ADDR' => remote_addr } get "/api/v1/users/#{@user.id}.json", {}, {'REMOTE_ADDR' => remote_addr }
response.headers['X-RateLimit-Limit'].should_not == @rate_limit.to_s expect(response.headers['X-RateLimit-Limit']).to_not eq @rate_limit.to_s
end end
it 'should not forbidden allowed address' do it 'should not forbidden allowed address' do
(@rate_limit+1).times { get "/api/v1/users/#{@user.id}.json", {}, {'REMOTE_ADDR' => remote_addr } } (@rate_limit+1).times { get "/api/v1/users/#{@user.id}.json", {}, {'REMOTE_ADDR' => remote_addr } }
response.status.should == 200 expect(response.status).to eq 200
end end
end end

View File

@ -20,6 +20,7 @@ describe BuildLists::DependentPackagesJob do
allow(Project).to receive_message_chain(:where, :to_a).and_return([project]) allow(Project).to receive_message_chain(:where, :to_a).and_return([project])
allow(Arch).to receive_message_chain(:where, :to_a).and_return([build_list.arch]) allow(Arch).to receive_message_chain(:where, :to_a).and_return([build_list.arch])
allow_any_instance_of(BuildList).to receive(:update_statistic)
allow_any_instance_of(BuildListPolicy).to receive(:show?).and_return(true) allow_any_instance_of(BuildListPolicy).to receive(:show?).and_return(true)
allow_any_instance_of(ProjectPolicy).to receive(:write?).and_return(true) allow_any_instance_of(ProjectPolicy).to receive(:write?).and_return(true)
allow_any_instance_of(BuildListPolicy).to receive(:create?).and_return(true) allow_any_instance_of(BuildListPolicy).to receive(:create?).and_return(true)

View File

@ -3,100 +3,95 @@ require "spec_helper"
describe UserMailer do describe UserMailer do
context 'On Issue create' do context 'On Issue create' do
let(:project) { FactoryGirl.build(:project) }
let(:issue_user) { FactoryGirl.build(:user) }
let(:issue) { FactoryGirl.build(:issue, project: project, assignee: issue_user, user: issue_user) }
let(:email) { UserMailer.new_issue_notification(issue.id, issue_user.id).deliver! }
before do before do
stub_symlink_methods stub_symlink_methods
@project = FactoryGirl.create(:project) allow(User).to receive(:find) { issue_user }
@issue_user = FactoryGirl.create(:user) allow(Issue).to receive(:find) { issue }
allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0))
@issue = FactoryGirl.create(:issue, project: @project, assignee: @issue_user, user: @issue_user)
@email = UserMailer.new_issue_notification(@issue, @issue_user).deliver!
end end
it 'should have correct subject' do it 'should have correct subject' do
@email.subject.should == "[#{@issue.project.name}] #{@issue.title} (##{@issue.serial_id})" expect(email.subject).to eq "[#{issue.project.name}] #{issue.title} (##{issue.serial_id})"
end end
it 'should render receiver email' do it 'should render receiver email' do
@email.to.should == [@issue_user.email] expect(email.to).to eq [issue_user.email]
end end
it 'should render the sender email' do it 'should render the sender email' do
@email.from.should == [APP_CONFIG['do-not-reply-email']] expect(email.from).to eq [APP_CONFIG['do-not-reply-email']]
end end
it 'should assign issue project name' do it 'should assign issue project name' do
@email.body.encoded.should match(@issue.project.name) expect(email.body.encoded).to match(issue.project.name)
end end
it 'should assign issue body' do it 'should assign issue body' do
@email.body.encoded.should match(@issue.body) expect(email.body.encoded).to match(issue.body)
end end
end end
context 'On Issue assign' do context 'On Issue assign' do
before(:each) do let(:project) { FactoryGirl.build(:project) }
let(:issue_user) { FactoryGirl.build(:user) }
let(:user) { FactoryGirl.build(:user) }
let(:issue) { FactoryGirl.build(:issue, project: project, assignee: issue_user, user: issue_user) }
let(:email) { UserMailer.issue_assign_notification(issue, user).deliver! }
before do
stub_symlink_methods stub_symlink_methods
@project = FactoryGirl.create(:project)
@issue_user = FactoryGirl.create(:user)
@user = FactoryGirl.create(:user)
allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0))
@issue = FactoryGirl.create(:issue, project_id: @project.id, assignee_id: @issue_user.id, user: @issue_user)
@email = UserMailer.issue_assign_notification(@issue, @user).deliver!
end end
it 'should have correct subject' do it 'should have correct subject' do
@email.subject.should == "Re: [#{@issue.project.name}] #{@issue.title} (##{@issue.serial_id})" expect(email.subject).to eq "Re: [#{issue.project.name}] #{issue.title} (##{issue.serial_id})"
end end
it 'should render receiver email' do it 'should render receiver email' do
@email.to.should == [@user.email] expect(email.to).to eq [user.email]
end end
it 'should render the sender email' do it 'should render the sender email' do
@email.from.should == [APP_CONFIG['do-not-reply-email']] expect(email.from).to eq [APP_CONFIG['do-not-reply-email']]
end end
it 'should assign issue title' do it 'should assign issue title' do
@email.body.encoded.should match(@issue.title) expect(email.body.encoded).to match(issue.title)
end end
end end
context 'On Comment create' do context 'On Comment create' do
let(:project) { FactoryGirl.build(:project) }
let(:issue_user) { FactoryGirl.build(:user) }
let(:user) { FactoryGirl.build(:user) }
let(:issue) { FactoryGirl.build(:issue, project: project, assignee: issue_user, user: issue_user) }
let(:comment) { FactoryGirl.build(:comment, commentable: issue, user: user, project: project) }
let(:email) { UserMailer.new_comment_notification(comment, issue_user.id).deliver! }
before do before do
stub_symlink_methods stub_symlink_methods
@project = FactoryGirl.create(:project) allow(User).to receive(:find) { issue_user }
@issue_user = FactoryGirl.create(:user)
@user = FactoryGirl.create(:user)
allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0))
@issue = FactoryGirl.create(:issue, project: @project, assignee: @issue_user, user: @issue_user)
@comment = FactoryGirl.create(:comment, commentable: @issue, user: @user, project: @project)
@email = UserMailer.new_comment_notification(@comment, @issue_user.id).deliver!
end end
it 'should have correct subject' do it 'should have correct subject' do
@email.subject.should == "Re: [#{@issue.project.name}] #{@issue.title} (##{@issue.serial_id})" expect(email.subject).to eq "Re: [#{issue.project.name}] #{issue.title} (##{issue.serial_id})"
end end
it 'should render receiver email' do it 'should render receiver email' do
@email.to.should == [@issue_user.email] expect(email.to).to eq [issue_user.email]
end end
it 'should render the sender email' do it 'should render the sender email' do
@email.from.should == [APP_CONFIG['do-not-reply-email']] expect(email.from).to eq [APP_CONFIG['do-not-reply-email']]
end end
it 'should assign comment body' do it 'should assign comment body' do
@email.body.encoded.should match(@comment.body) expect(email.body.encoded).to match(comment.body)
end end
end end
end end

View File

@ -4,17 +4,18 @@ describe BuildList::Package do
before { stub_symlink_methods } before { stub_symlink_methods }
it 'is valid' do it 'is valid' do
FactoryGirl.create(:build_list_package).should be_persisted expect(FactoryGirl.create(:build_list_package)).to be_persisted
end end
context '#set_epoch' do
describe '#set_epoch' do
let(:package) { FactoryGirl.build(:build_list_package) } let(:package) { FactoryGirl.build(:build_list_package) }
['', '(none)'].each do |epoch| ['', '(none)'].each do |epoch|
it "ensures that epoch is set to nil when epoch is '#{epoch}'" do it "ensures that epoch is set to nil when epoch is '#{epoch}'" do
package.epoch = epoch package.epoch = epoch
package.save package.save
package.epoch.should be_nil expect(package.epoch).to be_nil
end end
end end
@ -22,9 +23,16 @@ describe BuildList::Package do
it "ensures that valid epoch has been setted" do it "ensures that valid epoch has been setted" do
package.epoch = '55' package.epoch = '55'
package.save package.save
package.epoch.should == 55 expect(package.epoch).to eq 55
end end
end end
describe '#dependent_packages=' do
it 'sets a packages' do
package = FactoryGirl.build(:build_list_package, dependent_packages: 'x y z')
expect(package).to be_valid
expect(package.dependent_packages).to eq %w(x y z)
end
end
end end

View File

@ -8,9 +8,12 @@ then
elif [ $SPEC_GROUP = 'platform_controllers' ] elif [ $SPEC_GROUP = 'platform_controllers' ]
then then
$rspec spec/controllers/platforms/ $rspec spec/controllers/platforms/
elif [ $SPEC_GROUP = 'api-slow' ]
then
$rspec spec/controllers/api/v1/ --pattern build_lists*
elif [ $SPEC_GROUP = 'api' ] elif [ $SPEC_GROUP = 'api' ]
then then
$rspec spec/controllers/api/ $rspec spec/controllers/api/v1/ --exclude-pattern build_lists*
elif [ $SPEC_GROUP = 'models' ] elif [ $SPEC_GROUP = 'models' ]
then then
$rspec spec/models/ spec/jobs/ $rspec spec/models/ spec/jobs/