Skip to content
This repository has been archived by the owner on Nov 16, 2018. It is now read-only.

Commit

Permalink
improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
pgolm committed Dec 17, 2013
1 parent 40bb7e3 commit cb4d2f5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 2 additions & 6 deletions spec/factories/inventory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@
name { "Inventory#{id}" }
owner { create(:user) }

trait :with_host do
hosts { create_list(:host, 1, inventory_id: id) }
end

trait :with_hosts do
hosts { create_list(:host, 12, inventory_id: id) }
hosts { create_list(:host, 3, inventory_id: id) }
end

factory :small_inventory, traits: [:with_host]
factory :small_inventory, traits: [:with_hosts]
factory :big_inventory, traits: [:with_hosts]
end

Expand Down
6 changes: 4 additions & 2 deletions spec/requests/apis_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,18 @@
expect(response.body).to eq @expected
end

it "returns a inventory with host" do
it "returns a inventory with hosts" do
@expected = {
all: [small_inventory.hosts[0].alias],
all: small_inventory.hosts.map(&:alias),
}.to_json

get "/api/v1/inventory/#{small_inventory.key}?token=#{admin.api_key}"

expect(response.status).to eq 200
expect(response.body).to eq @expected
end

it "returns an inventory with groups"
end

describe "GET host" do
Expand Down

0 comments on commit cb4d2f5

Please sign in to comment.