Skip to content

Commit

Permalink
Use Likeno::Entity#all implementation on MetricCollectorDetails
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoamc committed Mar 28, 2016
1 parent eb46db3 commit 42bba5a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ def self.find_by_name!(metric_collector_name)
def self.all_names
request(:names, {}, :get)['metric_collector_names'].to_a
end

def self.all
create_objects_array_from_hash(request('', {}, :get))
end
end
end
end
Expand Down
35 changes: 0 additions & 35 deletions spec/entities/processor/metric_collector_details_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,41 +52,6 @@
end
end

describe 'all' do
context 'with no metric collector details' do
before :each do
KalibroClient::Entities::Processor::MetricCollectorDetails.
expects(:request).
with('', {}, :get).
returns({"metric_collector_details" => []})
end

it 'should return empty array' do
expect(KalibroClient::Entities::Processor::MetricCollectorDetails.all).to be_empty
end
end

context 'with many metric collector details' do
let!(:metric_collector_details_hash) { FactoryGirl.attributes_for(:metric_collector_details) }
let!(:another_metric_collector_details_hash) { FactoryGirl.attributes_for(:another_metric_collector_details) }

before :each do
KalibroClient::Entities::Processor::MetricCollectorDetails.
expects(:request).
with('', {}, :get).
returns({"metric_collector_details" => [metric_collector_details_hash, another_metric_collector_details_hash]})
end

it 'should return the two elements' do
metric_collector_details = KalibroClient::Entities::Processor::MetricCollectorDetails.all

expect(metric_collector_details.size).to eq(2)
expect(metric_collector_details.first.name).to eq(metric_collector_details_hash[:name])
expect(metric_collector_details.last.name).to eq(another_metric_collector_details_hash[:name])
end
end
end

describe 'find_by_name' do
subject { FactoryGirl.build(:metric_collector_details) }

Expand Down

0 comments on commit 42bba5a

Please sign in to comment.