From 709a346062748ef6f89111f82c53ebb05938f652 Mon Sep 17 00:00:00 2001 From: Jens Ulferts Date: Mon, 5 Sep 2016 14:20:17 +0200 Subject: [PATCH 1/3] bump testing gems --- Gemfile | 24 ++++++------- Gemfile.lock | 99 ++++++++++++++++++++++++++-------------------------- 2 files changed, 62 insertions(+), 61 deletions(-) diff --git a/Gemfile b/Gemfile index 0ed66eb88c..f3f8441836 100644 --- a/Gemfile +++ b/Gemfile @@ -146,7 +146,7 @@ gem 'fog-aws' gem 'carrierwave', git: 'https://github.com/carrierwaveuploader/carrierwave', branch: 'master' group :test do - gem 'rack-test', '~> 0.6.2' + gem 'rack-test', '~> 0.6.3' gem 'shoulda-context', '~> 1.2' gem 'launchy' @@ -155,25 +155,25 @@ group :test do # definitions from core are not available in the plugin thus specs break gem 'factory_girl', '~> 4.5' # require factory_girl_rails for convenience in core development - gem 'factory_girl_rails', '~> 4.6', require: false + gem 'factory_girl_rails', '~> 4.7', require: false - gem 'cucumber', '~> 1.3.19' - gem 'cucumber-rails', '~> 1.4.2', require: false + gem 'cucumber', '~> 2.4.0' + gem 'cucumber-rails', '~> 1.4.4', require: false gem 'rack_session_access' - gem 'database_cleaner', '~> 1.5.1' - gem 'rspec', '~> 3.4.0' + gem 'database_cleaner', '~> 1.5.3' + gem 'rspec', '~> 3.5.0' # also add to development group, so "spec" rake task gets loaded - gem 'rspec-rails', '~> 3.4.2', group: :development + gem 'rspec-rails', '~> 3.5.2', group: :development gem 'rspec-activemodel-mocks', '~> 1.0.3', git: 'https://github.com/rspec/rspec-activemodel-mocks' gem 'rspec-example_disabler', git: 'https://github.com/finnlabs/rspec-example_disabler.git' gem 'rspec-legacy_formatters', require: false - gem 'capybara', '~> 2.6.2' - gem 'capybara-screenshot', '~> 1.0.12' + gem 'capybara', '~> 2.8.1' + gem 'capybara-screenshot', '~> 1.0.13' gem 'fuubar' gem 'capybara-select2', github: 'goodwill/capybara-select2' - gem 'capybara-ng', '~> 0.2.2' + gem 'capybara-ng', '~> 0.2.7' gem 'selenium-webdriver', '~> 2.53.4' - gem 'poltergeist' + gem 'poltergeist', '~> 1.10.0' gem 'timecop', '~> 0.8' gem 'webmock', '~> 1.24.2', require: false @@ -183,7 +183,7 @@ group :test do gem 'shoulda-matchers', '~> 3.1', require: nil gem 'json_spec' gem 'activerecord-tableless', '~> 1.0' - gem 'codecov', require: nil + gem 'codecov', '~> 0.1.5', require: nil gem 'equivalent-xml', '~> 0.6' end diff --git a/Gemfile.lock b/Gemfile.lock index 68639c8e8b..5b96d9bb0b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -147,7 +147,6 @@ GEM ast (2.2.0) autoprefixer-rails (6.3.3.1) execjs - awesome_print (1.6.1) axiom-types (0.1.1) descendants_tracker (~> 0.0.4) ice_nine (~> 0.11.0) @@ -159,15 +158,14 @@ GEM thor (~> 0.19) builder (3.2.2) byebug (8.2.2) - capybara (2.6.2) + capybara (2.8.1) addressable mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (~> 2.0) - capybara-ng (0.2.2) - awesome_print (>= 1.2.0) + capybara-ng (0.2.7) capybara-screenshot (1.0.13) capybara (>= 1.0, < 3) launchy @@ -187,7 +185,7 @@ GEM cliver (0.3.2) cocaine (0.5.8) climate_control (>= 0.0.3, < 1.0) - codecov (0.1.4) + codecov (0.1.5) json simplecov url @@ -200,21 +198,26 @@ GEM safe_yaml (~> 1.0.0) crowdin-api (0.4.1) rest-client (~> 1.8) - cucumber (1.3.20) + cucumber (2.4.0) builder (>= 2.1.2) + cucumber-core (~> 1.5.0) + cucumber-wire (~> 0.0.1) diff-lcs (>= 1.1.3) - gherkin (~> 2.12) + gherkin (~> 4.0) multi_json (>= 1.7.5, < 2.0) multi_test (>= 0.1.2) - cucumber-rails (1.4.3) + cucumber-core (1.5.0) + gherkin (~> 4.0) + cucumber-rails (1.4.4) capybara (>= 1.1.2, < 3) cucumber (>= 1.3.8, < 3) mime-types (>= 1.16, < 4) nokogiri (~> 1.5) - railties (>= 3, < 5) + railties (>= 3, < 5.1) + cucumber-wire (0.0.1) daemons (1.2.3) dalli (2.7.6) - database_cleaner (1.5.1) + database_cleaner (1.5.3) date_validator (0.9.0) activemodel activesupport @@ -242,10 +245,10 @@ GEM eventmachine (1.2.0.1) excon (0.48.0) execjs (2.6.0) - factory_girl (4.5.0) + factory_girl (4.7.0) activesupport (>= 3.0.0) - factory_girl_rails (4.6.0) - factory_girl (~> 4.5.0) + factory_girl_rails (4.7.0) + factory_girl (~> 4.7.0) railties (>= 3.0.0) faker (1.6.3) i18n (~> 0.5) @@ -271,8 +274,7 @@ GEM fuubar (2.0.0) rspec (~> 3.0) ruby-progressbar (~> 1.4) - gherkin (2.12.2) - multi_json (~> 1.3) + gherkin (4.0.0) globalid (0.3.7) activesupport (>= 4.1.0) globalize (5.0.1) @@ -355,10 +357,9 @@ GEM pdf-core (0.6.1) pg (0.18.4) pkg-config (1.1.7) - poltergeist (1.9.0) + poltergeist (1.10.0) capybara (~> 2.1) cliver (~> 0.3.1) - multi_json (~> 1.0) websocket-driver (>= 0.2.0) powerpack (0.1.1) prawn (2.1.0) @@ -457,29 +458,29 @@ GEM netrc (~> 0.7) roar (1.0.1) representable (>= 2.0.1, <= 3.0.0) - rspec (3.4.0) - rspec-core (~> 3.4.0) - rspec-expectations (~> 3.4.0) - rspec-mocks (~> 3.4.0) - rspec-core (3.4.4) - rspec-support (~> 3.4.0) - rspec-expectations (3.4.0) + rspec (3.5.0) + rspec-core (~> 3.5.0) + rspec-expectations (~> 3.5.0) + rspec-mocks (~> 3.5.0) + rspec-core (3.5.3) + rspec-support (~> 3.5.0) + rspec-expectations (3.5.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.4.0) + rspec-support (~> 3.5.0) rspec-legacy_formatters (1.0.1) rspec (~> 3.0) - rspec-mocks (3.4.1) + rspec-mocks (3.5.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.4.0) - rspec-rails (3.4.2) - actionpack (>= 3.0, < 4.3) - activesupport (>= 3.0, < 4.3) - railties (>= 3.0, < 4.3) - rspec-core (~> 3.4.0) - rspec-expectations (~> 3.4.0) - rspec-mocks (~> 3.4.0) - rspec-support (~> 3.4.0) - rspec-support (3.4.1) + rspec-support (~> 3.5.0) + rspec-rails (3.5.2) + actionpack (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec-core (~> 3.5.0) + rspec-expectations (~> 3.5.0) + rspec-mocks (~> 3.5.0) + rspec-support (~> 3.5.0) + rspec-support (3.5.0) rubocop (0.38.0) parser (>= 2.3.0.6, < 3.0) powerpack (~> 0.1) @@ -567,7 +568,7 @@ GEM crack (>= 0.3.2) hashdiff websocket (1.2.3) - websocket-driver (0.6.3) + websocket-driver (0.6.4) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.2) will_paginate (3.1.0) @@ -590,27 +591,27 @@ DEPENDENCIES autoprefixer-rails awesome_nested_set! bourbon (~> 4.2.0) - capybara (~> 2.6.2) - capybara-ng (~> 0.2.2) - capybara-screenshot (~> 1.0.12) + capybara (~> 2.8.1) + capybara-ng (~> 0.2.7) + capybara-screenshot (~> 1.0.13) capybara-select2! carrierwave! cells-erb (~> 0.0.8) cells-rails (~> 0.0.6) cocaine - codecov + codecov (~> 0.1.5) coderay (~> 1.1.0) color-tools (~> 1.3.0) - cucumber (~> 1.3.19) - cucumber-rails (~> 1.4.2) + cucumber (~> 2.4.0) + cucumber-rails (~> 1.4.4) daemons dalli (~> 2.7.6) - database_cleaner (~> 1.5.1) + database_cleaner (~> 1.5.3) date_validator (~> 0.9.0) delayed_job_active_record (~> 4.1.0) equivalent-xml (~> 0.6) factory_girl (~> 4.5) - factory_girl_rails (~> 4.6) + factory_girl_rails (~> 4.7) faker fog-aws friendly_id (~> 5.1.0) @@ -639,7 +640,7 @@ DEPENDENCIES parallel_tests (~> 2.4.1) passenger pg (~> 0.18.4) - poltergeist + poltergeist (~> 1.10.0) prawn (~> 2.1) prawn-table (~> 0.2.2) pry-byebug @@ -651,7 +652,7 @@ DEPENDENCIES rabl (= 0.9.3) rack-attack rack-protection! - rack-test (~> 0.6.2) + rack-test (~> 0.6.3) rack_session_access rails (~> 4.2.7, >= 4.2.7.1) rails-angular-xss! @@ -663,11 +664,11 @@ DEPENDENCIES request_store (~> 1.3.0) responders (~> 2.0) roar (~> 1.0.0) - rspec (~> 3.4.0) + rspec (~> 3.5.0) rspec-activemodel-mocks (~> 1.0.3)! rspec-example_disabler! rspec-legacy_formatters - rspec-rails (~> 3.4.2) + rspec-rails (~> 3.5.2) rubocop ruby-duration (~> 3.2.0) ruby-prof From 4f17dfd99dacf13a827494a5c694e10becb45620 Mon Sep 17 00:00:00 2001 From: Jens Ulferts Date: Mon, 5 Sep 2016 14:20:40 +0200 Subject: [PATCH 2/3] adapt cuke definitions after update --- features/step_definitions/issue_steps.rb | 5 +++-- features/step_definitions/role_steps.rb | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/features/step_definitions/issue_steps.rb b/features/step_definitions/issue_steps.rb index 7c0c90fdb4..b7f496b2a6 100644 --- a/features/step_definitions/issue_steps.rb +++ b/features/step_definitions/issue_steps.rb @@ -90,8 +90,9 @@ end Given (/^there are the following issues(?: in project "([^"]*)")?:$/) do |project_name, table| table.hashes.map do |h| h['project'] = project_name end - table = Cucumber::Ast::Table.new table.hashes - step %{there are the following issues with attributes:}, table + modified_table = Cucumber::Core::Ast::DataTable.new(table.hashes, table.location) + argument_table = Cucumber::MultilineArgument::DataTable.new modified_table + step %{there are the following issues with attributes:}, argument_table end Given (/^there are the following issues with attributes:$/) do |table| diff --git a/features/step_definitions/role_steps.rb b/features/step_definitions/role_steps.rb index aa2735c852..25a2173f66 100644 --- a/features/step_definitions/role_steps.rb +++ b/features/step_definitions/role_steps.rb @@ -40,7 +40,7 @@ Given /^the [Uu]ser "([^\"]*)" is a "([^\"]*)" (?:in|of) the [Pp]roject "([^\"]* end end -Given /^there is a [rR]ole "([^\"]*)"$/ do |name, _table = Cucumber::Ast::Table.new([])| +Given /^there is a [rR]ole "([^\"]*)"$/ do |name, _table = nil| FactoryGirl.create(:role, name: name) unless Role.find_by(name: name) end From bafee7a5ab478f41c446ac718b0e941a39e29c61 Mon Sep 17 00:00:00 2001 From: Jens Ulferts Date: Mon, 5 Sep 2016 16:03:13 +0200 Subject: [PATCH 3/3] adapt specs after gem bump --- .../add_work_package_note_service_spec.rb | 29 +++++++------------ .../work_packages/work_package_field.rb | 1 - 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/spec/services/add_work_package_note_service_spec.rb b/spec/services/add_work_package_note_service_spec.rb index 223db9a679..4e34a73677 100644 --- a/spec/services/add_work_package_note_service_spec.rb +++ b/spec/services/add_work_package_note_service_spec.rb @@ -51,10 +51,7 @@ describe AddWorkPackageNoteService, type: :model do let(:mock_contract_instance) do mock_model(WorkPackages::CreateNoteContract) end - - before do - allow(described_class).to receive(:contract).and_return(mock_contract) - end + let(:valid_contract) { true } let(:send_notifications) { false } @@ -64,20 +61,15 @@ describe AddWorkPackageNoteService, type: :model do .with(send_notifications) .and_yield + allow(described_class).to receive(:contract).and_return(mock_contract) allow(work_package).to receive(:save_journals).and_return true - allow(mock_contract_instance).to receive(:validate).and_return true + allow(mock_contract_instance).to receive(:validate).and_return valid_contract end subject { instance.call('blubs', send_notifications: send_notifications) } it 'is successful' do - expect(subject.success?).to be_truthy - end - - it 'sets the value' do - subject - - expect(work_package.journal_notes).to eql 'blubs' + expect(subject).to be_success end it 'persists the value' do @@ -91,18 +83,16 @@ describe AddWorkPackageNoteService, type: :model do end context 'when the contract does not validate' do - before do - expect(mock_contract_instance).to receive(:validate).and_return false - end + let(:valid_contract) { false } it 'is unsuccessful' do expect(subject.success?).to be_falsey end it 'does not persist the changes' do - subject + expect(work_package).to_not receive(:save_journals) - expect(work_package.changed?).to be_truthy + subject end it "exposes the contract's errors" do @@ -121,13 +111,14 @@ describe AddWorkPackageNoteService, type: :model do end it 'is unsuccessful' do - expect(subject.success?).to be_falsey + expect(subject).to_not be_success end it 'leaves the value unchanged' do subject - expect(work_package.changed?).to be_truthy + expect(work_package.journal_notes).to eql 'blubs' + expect(work_package.journal_user).to eql user end it "exposes the work_packages's errors" do diff --git a/spec/support/work_packages/work_package_field.rb b/spec/support/work_packages/work_package_field.rb index c76727deed..0900f60590 100644 --- a/spec/support/work_packages/work_package_field.rb +++ b/spec/support/work_packages/work_package_field.rb @@ -139,7 +139,6 @@ class WorkPackageField def ensure_page_loaded if Capybara.current_driver == Capybara.javascript_driver extend ::Angular::DSL unless singleton_class.included_modules.include?(::Angular::DSL) - ng_wait expect(page).to have_selector('#work-packages-list-view-button.-active, .work-packages--details--title,