Skip to content

Commit

Permalink
Polish spec files and remove redundant testsuite
Browse files Browse the repository at this point in the history
  • Loading branch information
tumido committed May 25, 2018
1 parent 1469841 commit f8771bc
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 245 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
describe ManageIQ::Providers::Google::CloudManager::EventCatcher::Stream do
require 'fog/google'

let(:ems) { FactoryGirl.create(:ems_google_with_project) }
let(:subscription) { Fog::Google::Pubsub::Subscription.new }
let(:ems) { FactoryGirl.create(:ems_google_with_project) }
let(:subscription) { Fog::Google::Pubsub::Subscription.new }
let(:pubsub_connection) { ems.connect(:service => 'pubsub') }
let(:stream) { described_class.new(ems) }
let(:stream) { described_class.new(ems) }
let(:subscription_name) { "projects/GOOGLE_PROJECT/subscriptions/manageiq-eventcatcher-#{ems.guid}" }

before(:all) { Fog.mock! }
after(:all) { Fog.unmock! }

describe '#events' do
before do
allow(ems).to receive(:with_provider_connection).and_yield(pubsub_connection)
allow(ems).to receive(:with_provider_connection).and_yield(pubsub_connection)
allow(stream).to receive(:get_or_create_subscription).and_return(true)
allow(stream).to receive(:pull_subscription).and_return([])
end
Expand Down Expand Up @@ -41,6 +42,7 @@

context "when no subscription is available" do
before(:all) { RSpec::Mocks.configuration.allow_message_expectations_on_nil = true }
after(:all) { RSpec::Mocks.configuration.allow_message_expectations_on_nil = false }
before do
allow(stub_subscriptions).to receive(:get).and_return(nil)
allow(stub_subscriptions).to receive(:create).and_return(subscription)
Expand All @@ -66,6 +68,7 @@

describe '#pull_subscription' do
require "google/apis/pubsub_#{Fog::Google::Pubsub::GOOGLE_PUBSUB_API_VERSION}"

let(:messages) { [] }
let(:response) { Google::Apis::PubsubV1::PullResponse.new(:received_messages => messages) }
subject { stream.send(:pull_subscription, pubsub_connection) }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
describe ManageIQ::Providers::Google::CloudManager::EventParser do
describe '.event_to_hash' do
let(:event_name) { 'default_event' }

shared_examples 'parses_event' do |event_type|
let(:event_json) { read_event(event_type) }
subject { described_class.event_to_hash(event_json, nil) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def assert_specific_flavor
:description => "1 vCPU, 3.75 GB RAM",
:enabled => true,
:cpus => 1,
:memory => 4026531840
:memory => 4_026_531_840
)

expect(flavor.ext_management_system).to eq(@ems)
Expand Down

This file was deleted.

4 changes: 2 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

# Looks for provider subkeys you set in secrets.yml. Replace the values of
# those keys (both escaped or unescaped) with some placeholder text.
secrets.keys.each do |provider|
next if [:secret_key_base, :secret_token].include?(provider) # Defaults
secrets.each_key do |provider|
next if %i(secret_key_base secret_token).include?(provider) # Defaults
cred_hash = secrets.public_send(provider)
cred_hash.each do |key, value|
config.filter_sensitive_data("#{provider.upcase}_#{key.upcase}") { CGI.escape(value) }
Expand Down

0 comments on commit f8771bc

Please sign in to comment.