Skip to content

Commit

Permalink
add additional user scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
fractalwrench committed Feb 22, 2018
1 parent d0053f3 commit 7e188b6
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 3 deletions.
10 changes: 10 additions & 0 deletions features/user_email.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Feature: Android support

Scenario: User email
When I run "UserEmailScenario" with the defaults
Then I should receive a request
And the request is a valid for the error reporting API
And the exception "message" equals "UserEmailScenario"
And the event "user.id" is null
And the event "user.email" equals "user@example.com"
And the event "user.name" is null
10 changes: 10 additions & 0 deletions features/user_id.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Feature: Android support

Scenario: User ID
When I run "UserIdScenario" with the defaults
Then I should receive a request
And the request is a valid for the error reporting API
And the exception "message" equals "UserIdScenario"
And the event "user.id" equals "abc"
And the event "user.email" is null
And the event "user.name" is null
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.bugsnag.android.mazerunner.scenarios

import com.bugsnag.android.Bugsnag
import com.bugsnag.android.mazerunner.scenarios.Scenario

/**
* Sends a handled exception to Bugsnag, which does not include user data.
Expand All @@ -10,7 +9,7 @@ internal class UserDisabledScenario : Scenario() {

override fun run() {
Bugsnag.setUser(null, null, null)
Bugsnag.notify(RuntimeException("UserDisabledScenario"))
Bugsnag.notify(generateException())
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.bugsnag.android.mazerunner.scenarios

import com.bugsnag.android.Bugsnag

/**
* Sends a handled exception to Bugsnag, which only includes a user's email
*/
internal class UserEmailScenario : Scenario() {

override fun run() {
Bugsnag.setUser(null, "user@example.com", null)
Bugsnag.notify(generateException())
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ internal class UserEnabledScenario : Scenario() {

override fun run() {
Bugsnag.setUser("123", "user@example.com", "Joe Bloggs")
Bugsnag.notify(RuntimeException("UserEnabledScenario"))
Bugsnag.notify(generateException())
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.bugsnag.android.mazerunner.scenarios

import com.bugsnag.android.Bugsnag

/**
* Sends a handled exception to Bugsnag, which only includes a user's id
*/
internal class UserIdScenario : Scenario() {

override fun run() {
Bugsnag.setUser("abc", null, null)
Bugsnag.notify(generateException())
}

}

0 comments on commit 7e188b6

Please sign in to comment.