Skip to content

Instantly share code, notes, and snippets.

@hennevogel
Last active May 29, 2019 13:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hennevogel/794006e24f674247bd2f2c1b1ce02d92 to your computer and use it in GitHub Desktop.
Save hennevogel/794006e24f674247bd2f2c1b1ce02d92 to your computer and use it in GitHub Desktop.
frontend@95ef00803962:/obs/src/api> git status|tail
deleted: spec/cassettes/Webui_SearchController/GET_owner/warns_about_short_search_text.yml
deleted: spec/cassettes/Worker_StatusController/GET_/index/1_1_1.yml
deleted: spec/cassettes/Worker_StatusController/GET_/index/1_1_2.yml
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: spec/models/bs_request_action_spec.rb
frontend@95ef00803962:/obs/src/api> git diff spec/models/|cat
diff --git a/src/api/spec/models/bs_request_action_spec.rb b/src/api/spec/models/bs_request_action_spec.rb
index 85086bf712..8c8aab74c3 100644
--- a/src/api/spec/models/bs_request_action_spec.rb
+++ b/src/api/spec/models/bs_request_action_spec.rb
@@ -1,10 +1,6 @@
require 'rails_helper'
-# WARNING: If you change tests make sure you uncomment this line
-# and start a test backend. Some of the BsRequestAction methods
-# require real backend answers for projects/packages.
-# CONFIG['global_write_through'] = true
-RSpec.describe BsRequestAction, vcr: true do
+RSpec.describe BsRequestAction do
let(:user) { create(:confirmed_user, login: 'request_user') }
context 'encoding of sourcediffs' do
frontend@95ef00803962:/obs/src/api> rake db:drop db:create db:setup db:seed
warning: parser/current is loading parser/ruby25, which recognizes
warning: 2.5.5-compliant syntax, but you are running 2.5.3.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
Dropped database 'api_test'
Created database 'api_test'
Seeding architectures table...
Seeding roles table...
Seeding users table...
Seeding roles_users table...
Seeding static_permissions table...
Seeding static permissions for admin role in roles_static_permissions table...
Seeding static permissions for maintainer role in roles_static_permissions table...
Seeding static permissions for reader role in roles_static_permissions table...
Seeding static permissions for downloader role in roles_static_permissions table...
Seeding attrib_namespaces table...
Seeding attrib_types table...
Seeding issue trackers ...
frontend@95ef00803962:/obs/src/api> rspec spec/models/bs_request_action_spec.rb
warning: parser/current is loading parser/ruby25, which recognizes
warning: 2.5.5-compliant syntax, but you are running 2.5.3.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
Randomized with seed 46388
BsRequestAction
should belong to bs_request required:
#find_action_with_same_target
#is_target_maintainer?
without target
is false
works on nil
on home target
works on nil
is true for user
is false for another user
with no matching action
should be nil
with a non existing bs request
should be nil
with matching action
should eq #<BsRequestActionSubmit id: 6, bs_request_id: 6, type: "submit", target_project: "project_6", target_...57:32", target_repository: nil, makeoriginolder: false, target_package_id: 6, target_project_id: 17>
with more than one action
should eq #<BsRequestActionSubmit id: 9, bs_request_id: 8, type: "submit", target_project: "project_9", target_...57:33", target_repository: nil, makeoriginolder: false, target_package_id: 9, target_project_id: 23>
.set_source_and_target_associations
sets target_project_object to project if target_project parameters provided
sets target_package_object to package if target_package and target_project parameters provided
uniqueness validation of type
should be valid
validates uniqueness of type among bs requests, target_project and target_package
it should behave like it skips validation for type
type 'maintenance_incident'
allows multiple bs request actions
it should behave like it skips validation for type
type 'add_role'
allows multiple bs request actions
encoding of sourcediffs
should equal true
should include "-{�:�*�q\u0010�X\\�"
Finished in 13.08 seconds (files took 5.57 seconds to load)
18 examples, 0 failures
Randomized with seed 46388
frontend@95ef00803962:/obs/src/api>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment