diff options
| author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-08-08 15:14:59 +0300 |
|---|---|---|
| committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-08-08 15:14:59 +0300 |
| commit | ca52f848411efaa5ccfb364c2169b38a8e9644b4 (patch) | |
| tree | f8569d2091ca880ab789a778af9ba334f6603071 /spec/support | |
| parent | f4978bc08ea9fa4468d70eefaa32fd1eeafce5a9 (diff) | |
| download | gitlab-ce-ca52f848411efaa5ccfb364c2169b38a8e9644b4.tar.gz | |
Update chosen, improve ui, fix MR fork tests
Diffstat (limited to 'spec/support')
| -rw-r--r-- | spec/support/chosen_helper.rb | 21 | ||||
| -rw-r--r-- | spec/support/test_env.rb | 10 |
2 files changed, 26 insertions, 5 deletions
diff --git a/spec/support/chosen_helper.rb b/spec/support/chosen_helper.rb new file mode 100644 index 00000000000..42c9342c77a --- /dev/null +++ b/spec/support/chosen_helper.rb @@ -0,0 +1,21 @@ +# Chosen programmatic helper +# It allows you to select value from chosen select +# +# Params +# value - real value of selected item +# opts - options containing css selector +# +# Usage: +# +# chosen(2, from: '#user_ids') +# + +module ChosenHelper + def chosen(value, options={}) + raise "Must pass a hash containing 'from'" if not options.is_a?(Hash) or not options.has_key?(:from) + + selector = options[:from] + + page.execute_script("$('#{selector}').val('#{value}').trigger('chosen:updated');") + end +end diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb index cae7ff88513..203e661f514 100644 --- a/spec/support/test_env.rb +++ b/spec/support/test_env.rb @@ -88,11 +88,11 @@ module TestEnv def clear_repo_dir(namespace, name) setup_stubs - #Clean any .wiki.git that may have been created + # Clean any .wiki.git that may have been created FileUtils.rm_rf File.join(testing_path(), "#{name}.wiki.git") end - #Create a repo and it's satellite + # Create a repo and it's satellite def create_repo(namespace, name) setup_stubs repo = repo(namespace, name) @@ -152,7 +152,7 @@ module TestEnv # Recreate tmp/test-git-base-path FileUtils.mkdir_p Gitlab.config.gitlab_shell.repos_path - #Since much more is happening in satellites + # Since much more is happening in satellites FileUtils.mkdir_p Gitlab.config.satellites.path end @@ -161,8 +161,8 @@ module TestEnv satellite_repo = satellite(namespace, satellite_name) # Symlink tmp/satellite/gitlabhq to tmp/test-git-base-path/satellite/gitlabhq, create the directory if it doesn't exist already satellite_dir = File.dirname(satellite_repo) - FileUtils.mkdir_p satellite_dir unless File.exists?(satellite_dir) - system("ln -s -f #{seed_satellite_path()} #{satellite_repo}") + FileUtils.mkdir_p(satellite_dir) unless File.exists?(satellite_dir) + system("ln -s -f #{seed_satellite_path} #{satellite_repo}") end def create_temp_repo(path) |
