Skip to content

Change expectation nesting for directory matchers#13

Merged
jcouball merged 1 commit into
mainfrom
nested_expectations
Jun 28, 2025
Merged

Change expectation nesting for directory matchers#13
jcouball merged 1 commit into
mainfrom
nested_expectations

Conversation

@jcouball

Copy link
Copy Markdown
Member

Instead of setting expectations on directory contents using a block like this:

expect('lib').to(
  be_dir do
    file('file1.txt')
    file('file2.txt')
  end
)

You now call the #containing method on the matcher like this:

expect('lib').to(
  be_dir.containing(
    file('file1.txt'),
    file('file2.txt')
  )
)

BREAKING CHANGE: You must use #containing to to set expectations on dir content instead of a block

Instead of setting expectations on directory contents using a block like this:

```ruby
expect('lib').to(
  be_dir do
    file('file1.txt')
    file('file2.txt')
  end
)
```

You now call the `#containing` method on the matcher like this:

```ruby
expect('lib').to(
  be_dir.containing(
    file('file1.txt'),
    file('file2.txt')
  )
)
```

BREAKING CHANGE: You must use `#containing` to to set expectations on dir content instead of a block
@jcouball
jcouball merged commit e61d8fd into main Jun 28, 2025
3 checks passed
@jcouball
jcouball deleted the nested_expectations branch June 28, 2025 00:01
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

Successfully merging this pull request may close these issues.

1 participant