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

The power of match_array and have_attributes in RSpec #75

Open
joshmfrankel opened this issue Feb 9, 2024 · 0 comments
Open

The power of match_array and have_attributes in RSpec #75

joshmfrankel opened this issue Feb 9, 2024 · 0 comments

Comments

@joshmfrankel
Copy link
Owner

joshmfrankel commented Feb 9, 2024

expect(team.schedules).to match_array(
        [
          have_attributes(
            name: "First Line of defense (imported from Pagerduty)",
            created_by_user_id: User.system_user.id,
            external_pagerduty_schedule_id: "first-schedule-id",
            team: team,
            schedule_rotations: match_array(
              [
                have_attributes(
                  name: "Layer 1",
                  position: 1,
                  time_zone: "Eastern Time (US & Canada)",
                  schedule_rotation_users: match_array(
                    [
                      have_attributes(
                        class: MyModel, # type checks
                        position: 1,
                        user_id: first_user.id
                      )
                    ]
                  )
                )
              ]
            )
          )
        ]
      )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant