Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expected to record a snapshot #175

Open
Renatdz opened this issue Dec 14, 2018 · 2 comments
Open

Expected to record a snapshot #175

Renatdz opened this issue Dec 14, 2018 · 2 comments

Comments

@Renatdz
Copy link

Renatdz commented Dec 14, 2018

When I try to record a snapshot, the matcher always return to me the message below:

"expected to record a snapshot"

I did not found any issue about this, can you give me any information about this error?

My test class is based in a UITableViewCell.

class ExamCellTests: QuickSpec {
    
    var sut: ExamCell!
    
    override func spec() {
        
        describe("ExamCellTests") {
            
            context("when you tried to instantiate ExamCell with coder") {
                
                beforeEach {
                    let coder = NSCoder()
                    self.sut = ExamCell(coder: coder)
                }
                
                it("should be expected a nil value") {
                    expect(self.sut).to(beNil())
                }
            }

            context("when load into screen") {

                beforeEach {
                    self.sut = ExamCell()
                    self.sut.frame = CGRect(x: 0, y: 0, width: 320, height: 86)

                    let exam = Exam(id: 0, sigla: "invalid", name: "Ultrassonografia, abdomen superior", itemID: 0, item: 0, subitemID: 0, itemStatus: 0)

                    self.sut.setup(exam: exam)
                }

                it("should have the expected layout") {
                    expect(self.sut) == recordSnapshot()
                }
            }
        }
    }
}

The strange thing is that this happens only in this class, in others it works...

Any idea?

Thanks.

@marcelofabri
Copy link
Collaborator

This is the expected behavior: the matcher fails to remind you that you should replace it with == snapshot() after recording it (generating the reference image).

@Renatdz
Copy link
Author

Renatdz commented Dec 14, 2018

Hey Marcelo, the image was not recorded and the folder was not created too.

When the image is recorded, the matcher show me another message, somenthing like "expected to record Sucessfully, please change the recordSnapshot() to snapshot()"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants