Use alias they
in specs instead of it
, when it reads better
This commit is contained in:
parent
f3894759d6
commit
7a837edaf6
2 changed files with 19 additions and 15 deletions
|
@ -39,15 +39,15 @@ RSpec.describe Pet, type: :model do
|
||||||
subject(:biology_assets) { pet_state.swf_assets }
|
subject(:biology_assets) { pet_state.swf_assets }
|
||||||
let(:asset_ids) { biology_assets.map(&:remote_id) }
|
let(:asset_ids) { biology_assets.map(&:remote_id) }
|
||||||
|
|
||||||
it("are all new") do
|
they("are all new") do
|
||||||
pending("Currently, pets must be saved before assets are assigned.")
|
pending("Currently, pets must be saved before assets are assigned.")
|
||||||
should all be_new_record
|
should all be_new_record
|
||||||
end
|
end
|
||||||
it("match the expected IDs") do
|
they("match the expected IDs") do
|
||||||
expect(asset_ids).to contain_exactly(10083, 11613, 14187, 14189)
|
expect(asset_ids).to contain_exactly(10083, 11613, 14187, 14189)
|
||||||
end
|
end
|
||||||
it("are saved when saving the pet") { pet.save!; should all be_persisted }
|
they("are saved when saving the pet") { pet.save!; should all be_persisted }
|
||||||
it("have the expected asset metadata") do
|
they("have the expected asset metadata") do
|
||||||
expect(pet_state.swf_assets).to contain_exactly(
|
expect(pet_state.swf_assets).to contain_exactly(
|
||||||
a_record_matching(
|
a_record_matching(
|
||||||
type: "biology",
|
type: "biology",
|
||||||
|
@ -127,26 +127,26 @@ RSpec.describe Pet, type: :model do
|
||||||
subject(:biology_assets) { pet.pet_state.swf_assets }
|
subject(:biology_assets) { pet.pet_state.swf_assets }
|
||||||
let(:asset_ids) { biology_assets.map(&:remote_id) }
|
let(:asset_ids) { biology_assets.map(&:remote_id) }
|
||||||
|
|
||||||
it("are all new") do
|
they("are all new") do
|
||||||
pending("Currently, pets must be saved before assets are assigned.")
|
pending("Currently, pets must be saved before assets are assigned.")
|
||||||
should all be_new_record
|
should all be_new_record
|
||||||
end
|
end
|
||||||
it("match the expected IDs") do
|
they("match the expected IDs") do
|
||||||
expect(asset_ids).to contain_exactly(331, 332, 333, 23760, 23411)
|
expect(asset_ids).to contain_exactly(331, 332, 333, 23760, 23411)
|
||||||
end
|
end
|
||||||
it("are saved when saving the pet") { pet.save!; should all be_persisted }
|
they("are saved when saving the pet") { pet.save!; should all be_persisted }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "its items" do
|
describe "its items" do
|
||||||
subject(:items) { pet.items }
|
subject(:items) { pet.items }
|
||||||
let(:item_ids) { items.map(&:id) }
|
let(:item_ids) { items.map(&:id) }
|
||||||
|
|
||||||
it("are all new") { should all be_new_record }
|
they("are all new") { should all be_new_record }
|
||||||
it("match the expected IDs") do
|
they("match the expected IDs") do
|
||||||
expect(item_ids).to contain_exactly(39552, 53874, 71706)
|
expect(item_ids).to contain_exactly(39552, 53874, 71706)
|
||||||
end
|
end
|
||||||
it("are saved when saving the pet") { pet.save! ; should all be_persisted }
|
they("are saved when saving the pet") { pet.save! ; should all be_persisted }
|
||||||
it("have the expected item metadata") do
|
they("have the expected item metadata") do
|
||||||
should contain_exactly(
|
should contain_exactly(
|
||||||
a_record_matching(
|
a_record_matching(
|
||||||
id: 39552,
|
id: 39552,
|
||||||
|
@ -203,15 +203,15 @@ RSpec.describe Pet, type: :model do
|
||||||
subject(:item_assets) { assets_by_item.values.flatten(1) }
|
subject(:item_assets) { assets_by_item.values.flatten(1) }
|
||||||
let(:asset_ids) { item_assets.map(&:remote_id) }
|
let(:asset_ids) { item_assets.map(&:remote_id) }
|
||||||
|
|
||||||
it("are all new") do
|
they("are all new") do
|
||||||
pending("Currently, pets must be saved before assets are assigned.")
|
pending("Currently, pets must be saved before assets are assigned.")
|
||||||
should all be_new_record
|
should all be_new_record
|
||||||
end
|
end
|
||||||
it("match the expected IDs") do
|
they("match the expected IDs") do
|
||||||
expect(asset_ids).to contain_exactly(16933, 108567, 410722)
|
expect(asset_ids).to contain_exactly(16933, 108567, 410722)
|
||||||
end
|
end
|
||||||
it("are saved when saving the pet") { pet.save! ; should all be_persisted }
|
they("are saved when saving the pet") { pet.save! ; should all be_persisted }
|
||||||
it("match the expected metadata") do
|
they("match the expected metadata") do
|
||||||
expect(assets_by_item).to match(
|
expect(assets_by_item).to match(
|
||||||
39552 => a_collection_containing_exactly(
|
39552 => a_collection_containing_exactly(
|
||||||
a_record_matching(
|
a_record_matching(
|
||||||
|
|
|
@ -27,6 +27,10 @@ RSpec.configure do |config|
|
||||||
mocks.verify_partial_doubles = true
|
mocks.verify_partial_doubles = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# In our specs, we describe plural collections sometimes, so we add "they"
|
||||||
|
# as an alias for "it".
|
||||||
|
config.alias_example_to :they
|
||||||
|
|
||||||
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
||||||
# have no way to turn it off -- the option exists only for backwards
|
# have no way to turn it off -- the option exists only for backwards
|
||||||
# compatibility in RSpec 3). It causes shared context metadata to be
|
# compatibility in RSpec 3). It causes shared context metadata to be
|
||||||
|
|
Loading…
Reference in a new issue