diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-09-09 15:56:02 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-09-09 15:56:02 +0300 |
commit | 0b5d627cd4a3f81934e7772e3558356c9dd2e3cf (patch) | |
tree | a232d232e543ef372d91d0dfffbc93985f37d982 /spec/support | |
parent | 90c338a49541c95452181af9e0d0bcf9da6c51ad (diff) | |
parent | 0d610270d9634b783137bc6318eff4aa82572a7d (diff) |
Merge branch 'master' into ci-and-ce-sitting-in-a-tree-k-i-s-s-i-n-g
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/services_shared_context.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/support/services_shared_context.rb b/spec/support/services_shared_context.rb new file mode 100644 index 00000000000..4d007ae55ee --- /dev/null +++ b/spec/support/services_shared_context.rb @@ -0,0 +1,21 @@ +Service.available_services_names.each do |service| + shared_context service do + let(:dashed_service) { service.dasherize } + let(:service_method) { "#{service}_service".to_sym } + let(:service_klass) { "#{service}_service".classify.constantize } + let(:service_attrs_list) { service_klass.new.fields.inject([]) {|arr, hash| arr << hash[:name].to_sym } } + let(:service_attrs) do + service_attrs_list.inject({}) do |hash, k| + if k =~ /^(token*|.*_token|.*_key)/ + hash.merge!(k => 'secrettoken') + elsif k =~ /^(.*_url|url|webhook)/ + hash.merge!(k => "http://example.com") + elsif service == 'irker' && k == :recipients + hash.merge!(k => 'irc://irc.network.net:666/#channel') + else + hash.merge!(k => "someword") + end + end + end + end +end |