Taskme update
This commit is contained in:
@@ -6,6 +6,7 @@ describe HeadshotCollection do
|
||||
project = create(:project,
|
||||
appearance_releases: create_list(:appearance_release, 1),
|
||||
talent_releases: create_list(:talent_release, 1),
|
||||
headshot_collection_uid: "123abc"
|
||||
)
|
||||
|
||||
collection = HeadshotCollection.for_project(project)
|
||||
@@ -14,7 +15,7 @@ describe HeadshotCollection do
|
||||
expect(collection).to be_a(HeadshotCollection)
|
||||
expect(collection.releasables).to include(project.appearance_releases.first)
|
||||
expect(collection.releasables).to include(project.talent_releases.first)
|
||||
expect(collection.collection_uid).to eq(project.id)
|
||||
expect(collection.collection_uid).to eq(project.headshot_collection_uid)
|
||||
end
|
||||
|
||||
context "when a release has no headshot photo attachment" do
|
||||
@@ -85,6 +86,29 @@ describe HeadshotCollection do
|
||||
expect(mapping["appearance_release_#{releases.first.id}"]).to include("123")
|
||||
expect(mapping["talent_release_#{releases.last.id}"]).to include("456")
|
||||
end
|
||||
|
||||
context "when collection uid is blank" do
|
||||
it "is not included in the hash" do
|
||||
releases = []
|
||||
collection = HeadshotCollection.new(nil, releases)
|
||||
|
||||
hash = collection.to_hash
|
||||
|
||||
expect(hash.keys).not_to include(:collection_uid)
|
||||
end
|
||||
end
|
||||
|
||||
context "when there are no releasables" do
|
||||
it "includes a blank hash value for the ids_to_images key" do
|
||||
releases = []
|
||||
collection = HeadshotCollection.new(nil, releases)
|
||||
|
||||
hash = collection.to_hash
|
||||
|
||||
expect(hash.keys).to include(:ids_to_images)
|
||||
expect(hash[:ids_to_images]).to eq(Hash.new)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user