From cb169f015989c21944d9613d95df2dc78f9defab Mon Sep 17 00:00:00 2001 From: Tomas Korcak Date: Tue, 8 Jul 2014 14:29:48 -0700 Subject: [PATCH 1/5] Not so strict versionning --- gooddata.gemspec | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/gooddata.gemspec b/gooddata.gemspec index a3a31404b..a1adf5437 100644 --- a/gooddata.gemspec +++ b/gooddata.gemspec @@ -27,31 +27,31 @@ Gem::Specification.new do |s| s.homepage = %q{http://github.com/gooddata/gooddata-ruby} s.require_paths = ["lib"] - s.add_development_dependency "rake", "~> 10.3.1" - s.add_development_dependency "rake-notes", "~> 0.2.0" + s.add_development_dependency "rake", "~> 10.3", '>= 10.3.1' + s.add_development_dependency "rake-notes", "~> 0.2", '>= 0.2.0' s.add_development_dependency "redcarpet", "~> 3.1.1" if RUBY_PLATFORM != 'java' - s.add_development_dependency "rspec", "~> 2.14.1" - s.add_development_dependency "rubocop", "~> 0.20.1" - s.add_development_dependency "simplecov", "~> 0.8.2" + s.add_development_dependency "rspec", "~> 2.14", '>= 2.14.1' + s.add_development_dependency "rubocop", "~> 0.20", '>= 0.20' + s.add_development_dependency "simplecov", "~> 0.8", '>= 0.8.2' s.add_development_dependency "yard", "~> 0.8.7.3" s.add_development_dependency "yard-rspec", "~> 0.1" - s.add_development_dependency "ZenTest", "~> 4.10.0" - s.add_development_dependency "coveralls", "~> 0.7.0" + s.add_development_dependency "ZenTest", "~> 4.10", '>= 4.10.0' + s.add_development_dependency "coveralls", "~> 0.7", '>= 0.7.0' - s.add_dependency "activesupport", "~> 4.1.0" - s.add_dependency "bundler", ">= 1.6.1" - s.add_dependency 'docile', '~> 1.1.3' - s.add_dependency "erubis", "~> 2.7.0" - s.add_dependency "gli", "~> 2.10.0" - s.add_dependency "highline", "~> 1.6.21" - s.add_dependency "i18n", "~> 0.6.9" - s.add_dependency "json_pure", "~> 1.8.1" - s.add_dependency "multi_json", "~> 1.10.0" - s.add_dependency "parseconfig", "~> 1.0.4" + s.add_dependency "activesupport", "~> 4.1", '>= 4.1.0' + s.add_dependency "bundler", ">= 1.6", '>= 1.6.1' + s.add_dependency 'docile', '~> 1.1', '>= 1.1.3' + s.add_dependency "erubis", "~> 2.7", '>= 2.7.0' + s.add_dependency "gli", "~> 2.10", '>= 2.10.0' + s.add_dependency "highline", "~> 1.6", '>= 1.6.21' + s.add_dependency "i18n", "~> 0.6", '>= 0.6.9' + s.add_dependency "json_pure", "~> 1.8", '>= 1.8.1' + s.add_dependency "multi_json", "~> 1.10", '>= 1.10.0' + s.add_dependency "parseconfig", "~> 1.0.4", '>= 1.0.4' s.add_dependency "pry", "~> 0.9.12.6" - s.add_dependency "restforce", "~> 1.4.3" - s.add_dependency "rest-client", "~> 1.6.7" - s.add_dependency "rubyzip", "~> 1.1.0" + s.add_dependency "restforce", "~> 1.4", '>= 1.4.3' + s.add_dependency "rest-client", "~> 1.6", '>= 1.6.7' + s.add_dependency "rubyzip", "~> 1.1", '>= 1.1.0' s.add_dependency "salesforce_bulk_query", "~> 0.0" s.add_dependency "aws-sdk", "~> 1.45" end From 1f6fdc4c01b3d650f4a8e01ea58c03635df8879b Mon Sep 17 00:00:00 2001 From: Tomas Korcak Date: Tue, 8 Jul 2014 14:37:54 -0700 Subject: [PATCH 2/5] Do not be so strict with versions --- gooddata.gemspec | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/gooddata.gemspec b/gooddata.gemspec index a1adf5437..840f4d53b 100644 --- a/gooddata.gemspec +++ b/gooddata.gemspec @@ -27,31 +27,31 @@ Gem::Specification.new do |s| s.homepage = %q{http://github.com/gooddata/gooddata-ruby} s.require_paths = ["lib"] - s.add_development_dependency "rake", "~> 10.3", '>= 10.3.1' - s.add_development_dependency "rake-notes", "~> 0.2", '>= 0.2.0' - s.add_development_dependency "redcarpet", "~> 3.1.1" if RUBY_PLATFORM != 'java' - s.add_development_dependency "rspec", "~> 2.14", '>= 2.14.1' - s.add_development_dependency "rubocop", "~> 0.20", '>= 0.20' - s.add_development_dependency "simplecov", "~> 0.8", '>= 0.8.2' - s.add_development_dependency "yard", "~> 0.8.7.3" - s.add_development_dependency "yard-rspec", "~> 0.1" - s.add_development_dependency "ZenTest", "~> 4.10", '>= 4.10.0' - s.add_development_dependency "coveralls", "~> 0.7", '>= 0.7.0' + s.add_development_dependency 'rake', "~> 10.3", '>= 10.3.1' + s.add_development_dependency 'rake-notes', "~> 0.2", '>= 0.2.0' + s.add_development_dependency 'redcarpet', '~> 3.1', '>= 3.1.1' if RUBY_PLATFORM != 'java' + s.add_development_dependency 'rspec', "~> 2.14", '>= 2.14.1' + s.add_development_dependency 'rubocop', "~> 0.20", '>= 0.20' + s.add_development_dependency 'simplecov', "~> 0.8", '>= 0.8.2' + s.add_development_dependency 'yard', '~> 0.8', '>= 0.8.7.3' + s.add_development_dependency 'yard-rspec', "~> 0.1" + s.add_development_dependency 'ZenTest', "~> 4.10", '>= 4.10.0' + s.add_development_dependency 'coveralls', "~> 0.7", '>= 0.7.0' - s.add_dependency "activesupport", "~> 4.1", '>= 4.1.0' - s.add_dependency "bundler", ">= 1.6", '>= 1.6.1' + s.add_dependency 'activesupport', "~> 4.1", '>= 4.1.0' + s.add_dependency 'bundler', "~> 1.6", '>= 1.6.1' s.add_dependency 'docile', '~> 1.1', '>= 1.1.3' - s.add_dependency "erubis", "~> 2.7", '>= 2.7.0' - s.add_dependency "gli", "~> 2.10", '>= 2.10.0' - s.add_dependency "highline", "~> 1.6", '>= 1.6.21' - s.add_dependency "i18n", "~> 0.6", '>= 0.6.9' - s.add_dependency "json_pure", "~> 1.8", '>= 1.8.1' + s.add_dependency 'erubis', "~> 2.7", '>= 2.7.0' + s.add_dependency 'gli', "~> 2.10", '>= 2.10.0' + s.add_dependency 'highline', "~> 1.6", '>= 1.6.21' + s.add_dependency 'i18n', "~> 0.6", '>= 0.6.9' + s.add_dependency 'json_pure', "~> 1.8", '>= 1.8.1' s.add_dependency "multi_json", "~> 1.10", '>= 1.10.0' - s.add_dependency "parseconfig", "~> 1.0.4", '>= 1.0.4' - s.add_dependency "pry", "~> 0.9.12.6" - s.add_dependency "restforce", "~> 1.4", '>= 1.4.3' - s.add_dependency "rest-client", "~> 1.6", '>= 1.6.7' - s.add_dependency "rubyzip", "~> 1.1", '>= 1.1.0' - s.add_dependency "salesforce_bulk_query", "~> 0.0" - s.add_dependency "aws-sdk", "~> 1.45" + s.add_dependency 'parseconfig', "~> 1.0.4", '>= 1.0.4' + s.add_dependency 'pry', '~> 0.9', '>= 0.9.12.6' + s.add_dependency 'restforce', "~> 1.4", '>= 1.4.3' + s.add_dependency 'rest-client', "~> 1.6", '>= 1.6.7' + s.add_dependency 'rubyzip', "~> 1.1", '>= 1.1.0' + s.add_dependency 'salesforce_bulk_query', "~> 0.0" + s.add_dependency 'aws-sdk', "~> 1.45" end From 5c040d75cab5e60590e2671494c02f1c2d7a6031 Mon Sep 17 00:00:00 2001 From: Tomas Korcak Date: Thu, 31 Jul 2014 02:10:14 -0700 Subject: [PATCH 3/5] CryptoHelper --- spec/helpers/crypto_helper.rb | 7 +++++++ spec/spec_helper.rb | 1 + spec/unit/models/domain_spec.rb | 4 ++-- spec/unit/models/project_spec.rb | 3 ++- 4 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 spec/helpers/crypto_helper.rb diff --git a/spec/helpers/crypto_helper.rb b/spec/helpers/crypto_helper.rb new file mode 100644 index 000000000..03063e6d5 --- /dev/null +++ b/spec/helpers/crypto_helper.rb @@ -0,0 +1,7 @@ +module CryptoHelper + class << self + def generate_password + 'password' # '123.tajny.456' + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2c189f1e0..2ebc7e4d6 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -18,6 +18,7 @@ config.include BlueprintHelper config.include CliHelper config.include ConnectionHelper + config.include CryptoHelper config.include CsvHelper config.include ProjectHelper config.include SchemaHelper diff --git a/spec/unit/models/domain_spec.rb b/spec/unit/models/domain_spec.rb index 8bea369c4..522f70875 100644 --- a/spec/unit/models/domain_spec.rb +++ b/spec/unit/models/domain_spec.rb @@ -13,7 +13,7 @@ describe '#add_user' do it 'Should add user' do - user = GoodData::Domain.add_user(:domain => ConnectionHelper::DEFAULT_DOMAIN, :login => "gemtest#{rand(1e6)}@gooddata.com", :password => 'password') + user = GoodData::Domain.add_user(:domain => ConnectionHelper::DEFAULT_DOMAIN, :login => "gemtest#{rand(1e6)}@gooddata.com", :password => CryptoHelper.generate_password) expect(user).to be_an_instance_of(GoodData::Profile) user.delete end @@ -62,7 +62,7 @@ # Following lines are ugly hack 'role' => 'admin', - 'password' => 'password', + 'password' => CryptoHelper.generate_password, 'domain' => ConnectionHelper::DEFAULT_DOMAIN, # And following lines are even much more ugly hack diff --git a/spec/unit/models/project_spec.rb b/spec/unit/models/project_spec.rb index db7a01db0..ad68da139 100644 --- a/spec/unit/models/project_spec.rb +++ b/spec/unit/models/project_spec.rb @@ -190,6 +190,7 @@ def load_users_from_csv describe '#users' do it 'Returns array of GoodData::Users' do + pending 'Disable as it is TOOOO SLOOOW' project = GoodData::Project[ProjectHelper::PROJECT_ID] @@ -250,7 +251,7 @@ def load_users_from_csv # Following lines are ugly hack 'role' => 'admin', - 'password' => 'password', + 'password' => CryptoHelper.generate_password, 'domain' => ConnectionHelper::DEFAULT_DOMAIN, # And following lines are even much more ugly hack From 44e6aaee241002fe417edc68a20b6a5d9f402114 Mon Sep 17 00:00:00 2001 From: Tomas Korcak Date: Wed, 24 Sep 2014 11:10:54 -0700 Subject: [PATCH 4/5] Fixed tests --- lib/gooddata/cli/hooks.rb | 4 ++-- spec/helpers/cli_helper.rb | 7 +++++-- spec/unit/cli/commands/cmd_api_spec.rb | 2 +- spec/unit/cli/commands/cmd_auth_spec.rb | 2 +- spec/unit/cli/commands/cmd_domain_spec.rb | 2 +- spec/unit/cli/commands/cmd_process_spec.rb | 2 +- spec/unit/cli/commands/cmd_project_spec.rb | 2 +- spec/unit/cli/commands/cmd_role_spec.rb | 2 +- spec/unit/cli/commands/cmd_run_ruby_spec.rb | 2 +- spec/unit/cli/commands/cmd_scaffold_spec.rb | 2 +- spec/unit/cli/commands/cmd_user_spec.rb | 2 +- 11 files changed, 16 insertions(+), 13 deletions(-) diff --git a/lib/gooddata/cli/hooks.rb b/lib/gooddata/cli/hooks.rb index 65cd75157..4fc4a8c23 100644 --- a/lib/gooddata/cli/hooks.rb +++ b/lib/gooddata/cli/hooks.rb @@ -40,8 +40,8 @@ # Error logic here # return false to skip default error handling # binding.pry - # pp exception.backtrace - # pp exception + pp exception.backtrace + pp exception true end end diff --git a/spec/helpers/cli_helper.rb b/spec/helpers/cli_helper.rb index 078665225..247ef96bc 100644 --- a/spec/helpers/cli_helper.rb +++ b/spec/helpers/cli_helper.rb @@ -8,13 +8,16 @@ module CliHelper # @returns Captured output as string def capture_stdout(&block) original_stdout = $stdout - $stdout = fake = StringIO.new + original_stderr = $stderr + $stdout = $stderr = StringIO.new + begin yield + $stdout.string ensure $stdout = original_stdout + $stderr = original_stderr end - fake.string end # Run CLI with arguments and return captured stdout diff --git a/spec/unit/cli/commands/cmd_api_spec.rb b/spec/unit/cli/commands/cmd_api_spec.rb index bae301b9f..85be1b3ff 100644 --- a/spec/unit/cli/commands/cmd_api_spec.rb +++ b/spec/unit/cli/commands/cmd_api_spec.rb @@ -2,7 +2,7 @@ require 'gooddata/cli/cli' -describe 'GoodData::CLI - api', :broken => true do +describe 'GoodData::CLI - api' do describe 'api' do it 'Complains when no subcommand specified' do args = %w(api) diff --git a/spec/unit/cli/commands/cmd_auth_spec.rb b/spec/unit/cli/commands/cmd_auth_spec.rb index 602957def..7fd940397 100644 --- a/spec/unit/cli/commands/cmd_auth_spec.rb +++ b/spec/unit/cli/commands/cmd_auth_spec.rb @@ -2,7 +2,7 @@ require 'gooddata/cli/cli' -describe 'GoodData::CLI - auth', :broken => true do +describe 'GoodData::CLI - auth' do describe 'auth' do it 'Can be called without arguments' do args = %w(auth) diff --git a/spec/unit/cli/commands/cmd_domain_spec.rb b/spec/unit/cli/commands/cmd_domain_spec.rb index fff8eb806..bce188ce2 100644 --- a/spec/unit/cli/commands/cmd_domain_spec.rb +++ b/spec/unit/cli/commands/cmd_domain_spec.rb @@ -2,7 +2,7 @@ require 'gooddata/cli/cli' -describe 'GoodData::CLI - domain', :broken => true do +describe 'GoodData::CLI - domain' do describe 'domain' do it 'Complains when no subcommand specified' do args = %w(domain) diff --git a/spec/unit/cli/commands/cmd_process_spec.rb b/spec/unit/cli/commands/cmd_process_spec.rb index 4827db0a6..142500dcf 100644 --- a/spec/unit/cli/commands/cmd_process_spec.rb +++ b/spec/unit/cli/commands/cmd_process_spec.rb @@ -2,7 +2,7 @@ require 'gooddata/cli/cli' -describe 'GoodData::CLI - process', :broken => true do +describe 'GoodData::CLI - process' do describe 'process' do it 'Complains when no subcommand specified' do args = %w(process) diff --git a/spec/unit/cli/commands/cmd_project_spec.rb b/spec/unit/cli/commands/cmd_project_spec.rb index 406dfff6c..a60955900 100644 --- a/spec/unit/cli/commands/cmd_project_spec.rb +++ b/spec/unit/cli/commands/cmd_project_spec.rb @@ -2,7 +2,7 @@ require 'gooddata/cli/cli' -describe 'GoodData::CLI - project', :broken => true do +describe 'GoodData::CLI - project' do describe 'project' do it 'Complains when no subcommand specified' do args = %w(project) diff --git a/spec/unit/cli/commands/cmd_role_spec.rb b/spec/unit/cli/commands/cmd_role_spec.rb index 05ba9b828..b5bd26c1c 100644 --- a/spec/unit/cli/commands/cmd_role_spec.rb +++ b/spec/unit/cli/commands/cmd_role_spec.rb @@ -2,7 +2,7 @@ require 'gooddata/cli/cli' -describe GoodData::CLI, :broken => true do +describe GoodData::CLI do describe 'role' do it 'Complains when no parameters specified' do args = %w(role) diff --git a/spec/unit/cli/commands/cmd_run_ruby_spec.rb b/spec/unit/cli/commands/cmd_run_ruby_spec.rb index 248b6be0c..92b6f338a 100644 --- a/spec/unit/cli/commands/cmd_run_ruby_spec.rb +++ b/spec/unit/cli/commands/cmd_run_ruby_spec.rb @@ -2,7 +2,7 @@ require 'gooddata/cli/cli' -describe 'GoodData::CLI - run_ruby', :broken => true do +describe 'GoodData::CLI - run_ruby' do describe 'run_ruby' do it 'Can be called without arguments' do args = %w(run_ruby) diff --git a/spec/unit/cli/commands/cmd_scaffold_spec.rb b/spec/unit/cli/commands/cmd_scaffold_spec.rb index b486ed5c1..7bf314f88 100644 --- a/spec/unit/cli/commands/cmd_scaffold_spec.rb +++ b/spec/unit/cli/commands/cmd_scaffold_spec.rb @@ -2,7 +2,7 @@ require 'gooddata/cli/cli' -describe 'GoodData::CLI - scaffold', :broken => true do +describe 'GoodData::CLI - scaffold' do TEST_PROJECT_NAME = 'test-project' TEST_BRICK_NAME = 'test-brick' diff --git a/spec/unit/cli/commands/cmd_user_spec.rb b/spec/unit/cli/commands/cmd_user_spec.rb index 3f6581c2d..fdd3b5d9b 100644 --- a/spec/unit/cli/commands/cmd_user_spec.rb +++ b/spec/unit/cli/commands/cmd_user_spec.rb @@ -1,6 +1,6 @@ require 'gooddata/cli/cli' -describe 'GoodData::CLI - user', :broken => true do +describe 'GoodData::CLI - user' do describe 'user' do it 'Complains when no subcommand specified' do args = %w(user) From c5b3623bb94ab55f9a719555562b652ed2564df6 Mon Sep 17 00:00:00 2001 From: Tomas Korcak Date: Wed, 24 Sep 2014 11:15:18 -0700 Subject: [PATCH 5/5] Remove old test --- spec/unit/cli/commands/cmd_role_spec.rb | 55 ------------------------- 1 file changed, 55 deletions(-) delete mode 100644 spec/unit/cli/commands/cmd_role_spec.rb diff --git a/spec/unit/cli/commands/cmd_role_spec.rb b/spec/unit/cli/commands/cmd_role_spec.rb deleted file mode 100644 index b5bd26c1c..000000000 --- a/spec/unit/cli/commands/cmd_role_spec.rb +++ /dev/null @@ -1,55 +0,0 @@ -# encoding: UTF-8 - -require 'gooddata/cli/cli' - -describe GoodData::CLI do - describe 'role' do - it 'Complains when no parameters specified' do - args = %w(role) - - out = run_cli(args) - out.should include "Command 'role' requires a subcommand list" - end - - describe 'role list' do - it 'Complains when no project ID specified' do - args = [ - '-U', - ConnectionHelper::DEFAULT_USERNAME, - '-P', - ConnectionHelper::DEFAULT_PASSWORD, - 'role', - 'list' - ] - - out = run_cli(args) - out.should include 'Project ID has to be provided' - end - - it 'List roles when passing project ID' do - pending 'Investignate which project to use' - - args = [ - '-U', - ConnectionHelper::DEFAULT_USERNAME, - '-P', - ConnectionHelper::DEFAULT_PASSWORD, - '-p', - ProjectHelper::PROJECT_ID, - 'role', - 'list', - ] - - out = run_cli(args) - - expected_roles = [ - 'adminRole,/gdc/projects/tk6192gsnav58crp6o1ahsmtuniq8khb/roles/2' - ] - - expected_roles.each do |expected_role| - out.should include expected_role - end - end - end - end -end \ No newline at end of file