Commit 047a7600 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Remove chosen from tests

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 4434f93a
...@@ -42,14 +42,14 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps ...@@ -42,14 +42,14 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
end end
step 'I fill out a "Merge Request On Forked Project" merge request' do step 'I fill out a "Merge Request On Forked Project" merge request' do
chosen @forked_project.id, from: "#merge_request_source_project_id" select2 @forked_project.id, from: "#merge_request_source_project_id"
chosen @project.id, from: "#merge_request_target_project_id" select2 @project.id, from: "#merge_request_target_project_id"
find(:select, "merge_request_source_project_id", {}).value.should == @forked_project.id.to_s find(:select, "merge_request_source_project_id", {}).value.should == @forked_project.id.to_s
find(:select, "merge_request_target_project_id", {}).value.should == @project.id.to_s find(:select, "merge_request_target_project_id", {}).value.should == @project.id.to_s
chosen "master", from: "#merge_request_source_branch" select2 "master", from: "#merge_request_source_branch"
chosen "stable", from: "#merge_request_target_branch" select2 "stable", from: "#merge_request_target_branch"
find(:select, "merge_request_source_branch", {}).value.should == 'master' find(:select, "merge_request_source_branch", {}).value.should == 'master'
find(:select, "merge_request_target_branch", {}).value.should == 'stable' find(:select, "merge_request_target_branch", {}).value.should == 'stable'
......
...@@ -15,11 +15,11 @@ class ProjectNetworkGraph < Spinach::FeatureSteps ...@@ -15,11 +15,11 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
end end
And 'page should select "master" in select box' do And 'page should select "master" in select box' do
page.should have_selector '.chosen-single span', text: "master" page.should have_selector '.select2-chosen', text: "master"
end end
And 'page should select "v2.1.0" in select box' do And 'page should select "v2.1.0" in select box' do
page.should have_selector '.chosen-single span', text: "v2.1.0" page.should have_selector '.select2-chosen', text: "v2.1.0"
end end
And 'page should have "master" on graph' do And 'page should have "master" on graph' do
...@@ -56,11 +56,11 @@ class ProjectNetworkGraph < Spinach::FeatureSteps ...@@ -56,11 +56,11 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
end end
And 'page should select "stable" in select box' do And 'page should select "stable" in select box' do
page.should have_selector '.chosen-single span', text: "stable" page.should have_selector '.select2-chosen', text: "stable"
end end
And 'page should select "v2.1.0" in select box' do And 'page should select "v2.1.0" in select box' do
page.should have_selector '.chosen-single span', text: "v2.1.0" page.should have_selector '.select2-chosen', text: "v2.1.0"
end end
And 'page should have "stable" on graph' do And 'page should have "stable" on graph' do
......
...@@ -15,7 +15,7 @@ require 'spinach/capybara' ...@@ -15,7 +15,7 @@ require 'spinach/capybara'
require 'sidekiq/testing/inline' require 'sidekiq/testing/inline'
%w(valid_commit big_commits select2_helper chosen_helper test_env).each do |f| %w(valid_commit big_commits select2_helper test_env).each do |f|
require Rails.root.join('spec', 'support', f) require Rails.root.join('spec', 'support', f)
end end
......
# 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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment