diff options
Diffstat (limited to 'qa/qa/factory')
-rw-r--r-- | qa/qa/factory/README.md | 12 | ||||
-rw-r--r-- | qa/qa/factory/base.rb | 2 | ||||
-rw-r--r-- | qa/qa/factory/repository/push.rb | 12 | ||||
-rw-r--r-- | qa/qa/factory/resource/merge_request.rb | 1 | ||||
-rw-r--r-- | qa/qa/factory/settings/hashed_storage.rb | 2 |
5 files changed, 20 insertions, 9 deletions
diff --git a/qa/qa/factory/README.md b/qa/qa/factory/README.md index c56c7c43129..10140e39510 100644 --- a/qa/qa/factory/README.md +++ b/qa/qa/factory/README.md @@ -254,8 +254,7 @@ module QA project.name = 'project-to-create-a-shirt' end - # Attribute inherited from the Shirt factory if present, - # or from the Browser UI otherwise (using the block) + # Attribute from the Browser UI (using the block) product :brand do Page::Shirt::Show.perform do |shirt_show| shirt_show.fetch_brand_from_page @@ -347,8 +346,7 @@ module QA project.name = 'project-to-create-a-shirt' end - # Attribute fetched from the API response if present if present, - # or from the Shirt factory if present, + # Attribute fetched from the API response if present, # or from the Browser UI otherwise (using the block) product :brand do Page::Shirt::Show.perform do |shirt_show| @@ -356,7 +354,7 @@ module QA end end - # Attribute fetched from the API response if present if present, + # Attribute fetched from the API response if present, # or from the Shirt factory if present, # or a QA::Factory::Product::NoValueError is raised otherwise product :name @@ -414,9 +412,9 @@ end **Notes on attributes precedence:** - attributes from the API response take precedence over attributes from the + Browser UI +- attributes from the Browser UI take precedence over attributes from the factory (i.e inherited) -- attributes from the factory (i.e inherited) take precedence over attributes - from the Browser UI - attributes without a value will raise a `QA::Factory::Product::NoValueError` error ## Creating resources in your tests diff --git a/qa/qa/factory/base.rb b/qa/qa/factory/base.rb index a8ecac2a1e6..e1dc23d350d 100644 --- a/qa/qa/factory/base.rb +++ b/qa/qa/factory/base.rb @@ -63,7 +63,7 @@ module QA private_class_method :do_fabricate! def self.log_fabrication(method, factory, parents, args) - return yield unless Runtime::Env.verbose? + return yield unless Runtime::Env.debug? start = Time.now prefix = "==#{'=' * parents.size}>" diff --git a/qa/qa/factory/repository/push.rb b/qa/qa/factory/repository/push.rb index 6c5088f1da5..703c78daa99 100644 --- a/qa/qa/factory/repository/push.rb +++ b/qa/qa/factory/repository/push.rb @@ -30,6 +30,14 @@ module QA @directory = dir end + def files=(files) + if !files.is_a?(Array) || files.empty? + raise ArgumentError, "Please provide an array of hashes e.g.: [{name: 'file1', content: 'foo'}]" + end + + @files = files + end + def fabricate! Git::Repository.perform do |repository| if ssh_key @@ -63,6 +71,10 @@ module QA @directory.each_child do |f| repository.add_file(f.basename, f.read) if f.file? end + elsif @files + @files.each do |f| + repository.add_file(f[:name], f[:content]) + end else repository.add_file(file_name, file_content) end diff --git a/qa/qa/factory/resource/merge_request.rb b/qa/qa/factory/resource/merge_request.rb index 18046c7a8b2..d30da8a3db0 100644 --- a/qa/qa/factory/resource/merge_request.rb +++ b/qa/qa/factory/resource/merge_request.rb @@ -30,6 +30,7 @@ module QA push.project = factory.project push.branch_name = factory.target_branch push.remote_branch = factory.source_branch + push.new_branch = false push.file_name = "added_file.txt" push.file_content = "File Added" end diff --git a/qa/qa/factory/settings/hashed_storage.rb b/qa/qa/factory/settings/hashed_storage.rb index f2e58a3ea38..5e8f883e25f 100644 --- a/qa/qa/factory/settings/hashed_storage.rb +++ b/qa/qa/factory/settings/hashed_storage.rb @@ -9,7 +9,7 @@ module QA Page::Main::Menu.act { go_to_admin_area } Page::Admin::Menu.act { go_to_repository_settings } - Page::Admin::Settings::Main.perform do |setting| + Page::Admin::Settings::Repository.perform do |setting| setting.expand_repository_storage do |page| page.enable_hashed_storage page.save_settings |