diff --git a/app/controllers/provider/admin/cms/email_templates_controller.rb b/app/controllers/provider/admin/cms/email_templates_controller.rb index 70e4052389..47f8ed9dee 100644 --- a/app/controllers/provider/admin/cms/email_templates_controller.rb +++ b/app/controllers/provider/admin/cms/email_templates_controller.rb @@ -29,7 +29,7 @@ def create @page ||= templates.build(cms_templates_params) if @page.save - flash[:info] = 'Email Template overrided.' + flash[:info] = 'Email Template overridden.' redirect_to action: :index else render :new diff --git a/features/api/alerts.feature b/features/api/alerts.feature index b8ce13be06..5ae637e871 100644 --- a/features/api/alerts.feature +++ b/features/api/alerts.feature @@ -9,7 +9,7 @@ Feature: Audience > Applications > Alerts | Product | Name | | API 1 | Plan 1 | | API 2 | Plan 2 | - And a buyer "Jane" of the provider + And a buyer "Jane" And the following applications: | Buyer | Name | Plan | | Jane | Application 1 | Plan 1 | diff --git a/features/api/services/alerts.feature b/features/api/services/alerts.feature index 174e2d3db3..1972a068d9 100644 --- a/features/api/services/alerts.feature +++ b/features/api/services/alerts.feature @@ -7,8 +7,8 @@ Feature: Product > Analytics > Alerts And the following published application plan: | Product | Name | | My Product | Default | - And a buyer "Jane" of the provider - And a buyer "Bob" of the provider + And a buyer "Jane" + And a buyer "Bob" And the following applications: | Buyer | Name | Plan | | Jane | Jane App | Default | diff --git a/features/asset_host/asset_host.feature b/features/asset_host/asset_host.feature index 20a9af850f..2ea660faf0 100644 --- a/features/asset_host/asset_host.feature +++ b/features/asset_host/asset_host.feature @@ -34,7 +34,7 @@ Feature: Asset host Rule: Developer Background: Given a provider exists - And the provider has one buyer + And a buyer "Buyer Bob" Scenario: Developer portal with asset host not configured Given the asset host is unset diff --git a/features/buyers/accounts/billing_status.feature b/features/buyers/accounts/billing_status.feature index 0509a5fb3c..010ad7c771 100644 --- a/features/buyers/accounts/billing_status.feature +++ b/features/buyers/accounts/billing_status.feature @@ -10,7 +10,7 @@ Feature: Admin Portal Buyer's Billing Status And the following application plan: | Product | Name | Default | Cost per month | | My API | Gold | true | 100 | - And an approved buyer "John" signed up to the provider + And an approved buyer "John" And the following application: | Buyer | Name | | John | My App | diff --git a/features/buyers/accounts/bulk_operations.feature b/features/buyers/accounts/bulk_operations.feature index 6137faed52..209462978d 100644 --- a/features/buyers/accounts/bulk_operations.feature +++ b/features/buyers/accounts/bulk_operations.feature @@ -6,7 +6,7 @@ Feature: Buyer accounts bulk operations Rule: Single account plan Background: - Given a buyer "Alice" of the provider + Given a buyer "Alice" Scenario: Bulk operations does not include "Change account plan" Given the provider has "account_plans" switch allowed diff --git a/features/buyers/accounts/edit.feature b/features/buyers/accounts/edit.feature index 38e8107b4c..06622fb339 100644 --- a/features/buyers/accounts/edit.feature +++ b/features/buyers/accounts/edit.feature @@ -3,7 +3,7 @@ Feature: Audience > Accounts > Edit Background: Given a provider is logged in - And a buyer "Pepe" of the provider + And a buyer "Pepe" Scenario: Navigation Given they go to the provider dashboard @@ -26,7 +26,7 @@ Feature: Audience > Accounts > Edit Then field "Organization/Group Name" has inline error "can't be blank" Scenario: Deleting an account - Given a buyer "Deleteme" of the provider + Given a buyer "Deleteme" When they go to the buyer account edit page for "Deleteme" And follow "Delete" and confirm the dialog Then the current page is the buyer accounts page diff --git a/features/buyers/accounts/index.feature b/features/buyers/accounts/index.feature index 12ba862cbb..9bf878716a 100644 --- a/features/buyers/accounts/index.feature +++ b/features/buyers/accounts/index.feature @@ -11,12 +11,12 @@ Feature: Audience > Accounts And should see "Add your first account" Scenario: Provider has one account plan only - Given a buyer "Alice" of the provider + Given a buyer "Alice" When they go to the buyer accounts page Then the table does not have a column "Plan" Scenario: Provider has multiple applications disabled - Given a buyer "Pepe" of the provider + Given a buyer "Pepe" And the default product of the provider has name "The API" And the following application plan: | Product | Name | Default | @@ -26,7 +26,7 @@ Feature: Audience > Accounts Then the table don't have a column "Apps" Scenario: Provider has multiple applications enabled - Given a buyer "Pepe" of the provider + Given a buyer "Pepe" And the default product of the provider has name "The API" And the following application plan: | Product | Name | Default | diff --git a/features/buyers/accounts/show.feature b/features/buyers/accounts/show.feature index 0a1ac2b0e8..b510de112b 100644 --- a/features/buyers/accounts/show.feature +++ b/features/buyers/accounts/show.feature @@ -4,7 +4,7 @@ Feature: Buyer account overview Background: Given a provider is logged in And the provider has "account_plans" allowed - And an approved buyer "Bob Buyer" signed up to the provider + And an approved buyer "Bob Buyer" Scenario: Sending a message Given buyer "Bob Buyer" has no messages diff --git a/features/developer_portal/admin/account/invoices.feature b/features/developer_portal/admin/account/invoices.feature index b6e2e86c5f..2049b7e9e2 100644 --- a/features/developer_portal/admin/account/invoices.feature +++ b/features/developer_portal/admin/account/invoices.feature @@ -10,7 +10,7 @@ Feature: Dev Portal Buyer Invoices And the following application plan: | Product | Name | Default | Cost per month | | My API | Gold | true | 100 | - And an approved buyer "John" signed up to the provider + And an approved buyer "John" And the following application: | Buyer | Name | | John | My App | diff --git a/features/developer_portal/admin/account/payment_details.feature b/features/developer_portal/admin/account/payment_details.feature index 278beae3e8..0be07ad373 100644 --- a/features/developer_portal/admin/account/payment_details.feature +++ b/features/developer_portal/admin/account/payment_details.feature @@ -9,7 +9,7 @@ Feature: Dev Portal Buyer Payment Details And the following application plan: | Product | Name | Default | Cost per month | | My API | Gold | true | 100 | - And an approved buyer "John" signed up to the provider + And an approved buyer "John" And the following application: | Buyer | Name | | John | My App | diff --git a/features/developer_portal/admin/account/personal_details.feature b/features/developer_portal/admin/account/personal_details.feature index b0bcd21e14..0f56efa888 100644 --- a/features/developer_portal/admin/account/personal_details.feature +++ b/features/developer_portal/admin/account/personal_details.feature @@ -8,7 +8,7 @@ Feature: Dev Portal Buyer Personal Details And the following application plan: | Product | Name | Default | Cost per month | | My API | Gold | true | 100 | - And an approved buyer "John" signed up to the provider + And an approved buyer "John" And the following application: | Buyer | Name | | John | My App | diff --git a/features/developer_portal/authentication/sso_token.feature b/features/developer_portal/authentication/sso_token.feature index c1373da1e9..67e71e7a91 100644 --- a/features/developer_portal/authentication/sso_token.feature +++ b/features/developer_portal/authentication/sso_token.feature @@ -5,7 +5,7 @@ Feature: SSO Token Background: Given a provider "foo.3scale.localhost" And provider "foo.3scale.localhost" has multiple applications enabled - And a buyer "bob" signed up to provider "foo.3scale.localhost" + And a buyer "bob" And the current domain is foo.3scale.localhost Scenario: Buyer can't login with an invalid token diff --git a/features/developer_portal/buyer_password_reset.feature b/features/developer_portal/buyer_password_reset.feature index ccb9d8570c..71218cb46d 100644 --- a/features/developer_portal/buyer_password_reset.feature +++ b/features/developer_portal/buyer_password_reset.feature @@ -24,7 +24,7 @@ Feature: Buyer password reset Rule: Reset password flow for different scenarios Background: - Given a buyer "bob" signed up to the provider + Given a buyer "bob" And an active user "zed" of account "bob" with email "zed@3scale.localhost" And the current domain is foo.3scale.localhost And they go to the login page @@ -39,13 +39,13 @@ Feature: Buyer password reset And they fill in "Password confirmation" with "monkey" And they press "Change Password" Then they should see "The password has been changed" - + When they go to the login page And they fill in "Username" with "zed@3scale.localhost" And they fill in "Password" with "monkey" And they press "Sign in" Then they should be logged in as "zed" - + Scenario: Invalid email Given no user exists with an email of "bob@3scale.localhost" And they follow "Forgot password?" @@ -53,7 +53,7 @@ Feature: Buyer password reset And they press "Send instructions" Then they should see "A password reset link will be sent to bob@3scale.localhost if a user exists with this email." And "bob@3scale.localhost" should receive no emails - + Scenario: Wrong confirmation Given they follow "Forgot password?" And they fill in "Email" with "zed@3scale.localhost" @@ -64,7 +64,7 @@ Feature: Buyer password reset And they press "Change Password" Then they should see the password confirmation error And the password of user "zed" should not be "monkey" - + Scenario: Blank passwords When they follow "Forgot password?" And they fill in "Email" with "zed@3scale.localhost" @@ -72,11 +72,11 @@ Feature: Buyer password reset And they follow the link found in the password reset email send to "zed@3scale.localhost" And they press "Change Password" Then they should see "The password is invalid" - + Scenario: Invalid token When they go to the password page with invalid password reset token Then they should see "The password reset token is invalid" - + Scenario: Attempt to login with invalid credentials, then reset password Given they fill in "Username" with "zed@3scale.localhost" And they fill in "Password" with "ihavenoclue" diff --git a/features/developer_portal/login.feature b/features/developer_portal/login.feature index 7a22f49efb..428bb9d8d4 100644 --- a/features/developer_portal/login.feature +++ b/features/developer_portal/login.feature @@ -5,7 +5,7 @@ Feature: Login feature Background: Given a provider "foo.3scale.localhost" And provider "foo.3scale.localhost" has multiple applications enabled - And a buyer "bob" signed up to provider "foo.3scale.localhost" + And a buyer "bob" @security Scenario: Buyer can log in with csrf protection enabled diff --git a/features/developer_portal/xss_protection.feature b/features/developer_portal/xss_protection.feature index 1216a91ff6..a67c2c9b6d 100644 --- a/features/developer_portal/xss_protection.feature +++ b/features/developer_portal/xss_protection.feature @@ -8,7 +8,7 @@ Feature: XSS protection And the following application plan: | Product | Name | Default | | My API | Default | true | - And an approved buyer "John" signed up to the provider + And an approved buyer "John" And the following application: | Buyer | Name | | John | My App | diff --git a/features/finance/automatic_billing_postpaid.feature b/features/finance/automatic_billing_postpaid.feature index 4a0ee582b9..e7438bfaa7 100644 --- a/features/finance/automatic_billing_postpaid.feature +++ b/features/finance/automatic_billing_postpaid.feature @@ -10,7 +10,7 @@ Feature: Automatic billing with plan changes on POSTPAID And the provider is charging its buyers in postpaid mode And the provider has "finance" visible Given the provider service allows to change application plan directly - And the provider has one buyer + And a buyer "Bob Buyer" And the following application plans: | Product | Name | Cost per month | | My API | Paid | 31 | diff --git a/features/finance/automatic_billing_prepaid.feature b/features/finance/automatic_billing_prepaid.feature index 3afabf1443..1e16a341d2 100644 --- a/features/finance/automatic_billing_prepaid.feature +++ b/features/finance/automatic_billing_prepaid.feature @@ -9,7 +9,7 @@ Feature: Automatic billing with plan changes on PREPAID And the provider is charging its buyers in prepaid mode And the provider has "finance" visible Given the provider service allows to change application plan directly - And the provider has one buyer + And a buyer "Bob Buyer" And the following application plans: | Product | Name | Cost per month | | My API | Paid | 31 | diff --git a/features/finance/contracts_invoicing.feature b/features/finance/contracts_invoicing.feature index 95a433b0e8..fa59697774 100644 --- a/features/finance/contracts_invoicing.feature +++ b/features/finance/contracts_invoicing.feature @@ -9,7 +9,7 @@ Feature: All kind of contracts are billed And the default product of the provider has name "My API" And the provider is charging its buyers And the provider has "finance" visible - And the provider has one buyer + And a buyer "Bob Buyer" And the following application plan: | Product | Name | Cost per month | | My API | Application Plan | 100 | diff --git a/features/finance/instant_bill_plan_change.feature b/features/finance/instant_bill_plan_change.feature index 843f7b15e5..9194f5744d 100644 --- a/features/finance/instant_bill_plan_change.feature +++ b/features/finance/instant_bill_plan_change.feature @@ -10,7 +10,7 @@ Feature: Instant biling plan change feature And the default product of the provider has name "My API" Given all the rolling updates features are off And I have instant_bill_plan_change feature enabled - And the provider has one buyer + And a buyer "Bob Buyer" Scenario: Charging variable cost on plan change Given the following application plans: diff --git a/features/finance/variable_cost.feature b/features/finance/variable_cost.feature index 7640ab1a6e..cf3f45dcd2 100644 --- a/features/finance/variable_cost.feature +++ b/features/finance/variable_cost.feature @@ -7,7 +7,7 @@ Feature: Variable cost on automatic billing And the provider is billing but not charging And the provider has "finance" visible Given all the rolling updates features are off - And the provider has one buyer + And a buyer "Bob Buyer" And the following application plans: | Product | Name | | API | VariableOnly | diff --git a/features/old/accounts/buyers/account_fields.feature b/features/old/accounts/buyers/account_fields.feature index 3c1a20cfc4..b1e6941aec 100644 --- a/features/old/accounts/buyers/account_fields.feature +++ b/features/old/accounts/buyers/account_fields.feature @@ -7,7 +7,7 @@ Feature: Buyer side, account fields Background: Given a provider "foo.3scale.localhost" And provider "foo.3scale.localhost" has multiple applications enabled - And a buyer "bob" signed up to provider "foo.3scale.localhost" + And a buyer "bob" Given provider "foo.3scale.localhost" has the following fields defined for accounts: | name | choices | required | read_only | hidden | | false_field | | | | | diff --git a/features/old/accounts/buyers/users_fields.feature b/features/old/accounts/buyers/users_fields.feature index 2377a2aef7..faf1a735de 100644 --- a/features/old/accounts/buyers/users_fields.feature +++ b/features/old/accounts/buyers/users_fields.feature @@ -7,7 +7,7 @@ Feature: Buyer side, user extra fields Background: Given a provider "foo.3scale.localhost" And provider "foo.3scale.localhost" has multiple applications enabled - And a buyer "bob" signed up to provider "foo.3scale.localhost" + And a buyer "bob" Given provider "foo.3scale.localhost" has the following fields defined for users: | name | choices | required | read_only | hidden | | false_field | | | | | diff --git a/features/old/accounts/invitations.feature b/features/old/accounts/invitations.feature index 4ec727af99..953baa4376 100644 --- a/features/old/accounts/invitations.feature +++ b/features/old/accounts/invitations.feature @@ -20,7 +20,7 @@ Feature: Invitations When I request the url of the provider new invitation page then I should see an exception Scenario: When switch is denied as buyer - Given a buyer "apininja" signed up to provider "foo.3scale.localhost" + Given a buyer "apininja" And provider "foo.3scale.localhost" has "multiple_users" switch denied When I log in as "apininja" on foo.3scale.localhost And I follow "Settings" @@ -28,7 +28,7 @@ Feature: Invitations Then I should not see "Invite new user" Scenario: Sending an invitation as buyer - Given a buyer "apininja" signed up to provider "foo.3scale.localhost" + Given a buyer "apininja" And provider "foo.3scale.localhost" has "multiple_users" switch visible When I log in as "apininja" on foo.3scale.localhost And I follow "Settings" diff --git a/features/old/authentication/internal.feature b/features/old/authentication/internal.feature index 32f1b55d0f..325129e752 100644 --- a/features/old/authentication/internal.feature +++ b/features/old/authentication/internal.feature @@ -62,7 +62,7 @@ Feature: Internal authentication And I should be on the homepage Scenario: Successful sign in as a buyer - Given a buyer "alice" signed up to provider "foo.3scale.localhost" + Given a buyer "alice" When the current domain is foo.3scale.localhost And I go to the login page @@ -95,7 +95,7 @@ Feature: Internal authentication @security Scenario: Failed attempt to sign in without being activated - Given a buyer "wickedwidgets" signed up to provider "foo.3scale.localhost" + Given a buyer "wickedwidgets" And a pending user "bob" of account "wickedwidgets" When the current domain is foo.3scale.localhost And I try to log in as "bob" @@ -103,14 +103,14 @@ Feature: Internal authentication @security Scenario: Failed attempt to sign in as user with pending account - Given a pending buyer "wickedwidgets" signed up to provider "foo.3scale.localhost" + Given a pending buyer "wickedwidgets" When the current domain is foo.3scale.localhost And I try to log in as "wickedwidgets" Then I should not be logged in @security Scenario: Failed attempt to sign in as user with rejected account - Given a rejected buyer "wickedwidgets" signed up to provider "foo.3scale.localhost" + Given a rejected buyer "wickedwidgets" When the current domain is foo.3scale.localhost And I try to log in as "wickedwidgets" Then I should not be logged in diff --git a/features/old/authorization/provider_accounts.feature b/features/old/authorization/provider_accounts.feature index 46a90b8744..79ba20848c 100644 --- a/features/old/authorization/provider_accounts.feature +++ b/features/old/authorization/provider_accounts.feature @@ -8,7 +8,7 @@ Feature: Provider accounts authorization Given a provider "foo.3scale.localhost" And provider "foo.3scale.localhost" has Browser CMS activated Given provider "foo.3scale.localhost" has multiple applications enabled - And a buyer "buyer" signed up to provider "foo.3scale.localhost" + And a buyer "buyer" Scenario: Provider admin can access accounts Given current domain is the admin domain of provider "foo.3scale.localhost" @@ -90,7 +90,7 @@ Feature: Provider accounts authorization And user "member" has access to the admin section "partners" And current domain is the admin domain of provider "foo.3scale.localhost" And provider "foo.3scale.localhost" has "multiple_users" switch allowed - Given a pending buyer "pending account" signed up to provider "foo.3scale.localhost" + Given a pending buyer "pending account" When I log in as provider "member" And I follow "2 Accounts" diff --git a/features/old/buyers/accounts/approving.feature b/features/old/buyers/accounts/approving.feature index 8296e76bae..bd44dbda73 100644 --- a/features/old/buyers/accounts/approving.feature +++ b/features/old/buyers/accounts/approving.feature @@ -11,17 +11,17 @@ Feature: Approving buyer account And the provider requires accounts to be approved Scenario: Approving a single buyer account - Given a pending buyer "bob" signed up to provider "foo.3scale.localhost" + Given a pending buyer "bob" When I go to the buyer account page for "bob" And I press "Approve" Then buyer "bob" should be approved Scenario: Approve button is not shown for already approved accounts - Given an approved buyer "bob" signed up to provider "foo.3scale.localhost" + Given an approved buyer "bob" When I go to the buyer account page for "bob" Then I should not see button to approve buyer "bob" Scenario: Approve button is not shown for rejected accounts - Given a rejected buyer "bob" signed up to provider "foo.3scale.localhost" + Given a rejected buyer "bob" When I go to the buyer account page for "bob" Then I should not see button to approve buyer "bob" diff --git a/features/old/buyers/accounts/deleting.feature b/features/old/buyers/accounts/deleting.feature index 19204a2622..d6376e894a 100644 --- a/features/old/buyers/accounts/deleting.feature +++ b/features/old/buyers/accounts/deleting.feature @@ -7,7 +7,7 @@ Feature: Deleting buyer account Background: Given a provider is logged in on 1st January 2011 And the provider has multiple applications enabled - And a buyer "bob" signed up to provider "foo.3scale.localhost" + And a buyer "bob" Scenario: Deleting buyer account from the account summary page When I go to the buyer account page for "bob" diff --git a/features/old/buyers/accounts/rejecting.feature b/features/old/buyers/accounts/rejecting.feature index 2c2f524cab..0d218ce91c 100644 --- a/features/old/buyers/accounts/rejecting.feature +++ b/features/old/buyers/accounts/rejecting.feature @@ -11,17 +11,17 @@ Feature: Rejecting buyer account And the provider requires accounts to be approved Scenario: Rejecting a single buyer account - Given a pending buyer "bob" signed up to provider "foo.3scale.localhost" + Given a pending buyer "bob" When I go to the buyer account page for "bob" And I press "Reject" Then buyer "bob" should be rejected Scenario: Reject button is not shown for already rejected accounts - Given a rejected buyer "bob" signed up to provider "foo.3scale.localhost" + Given a rejected buyer "bob" When I go to the buyer account page for "bob" Then I should not see button to reject buyer "bob" Scenario: Reject button is not shown for approved accounts - Given an approved buyer "bob" signed up to provider "foo.3scale.localhost" + Given an approved buyer "bob" When I go to the buyer account page for "bob" Then I should not see button to reject buyer "bob" diff --git a/features/old/buyers/users.feature b/features/old/buyers/users.feature index 9ea28a3583..4c536c5a27 100644 --- a/features/old/buyers/users.feature +++ b/features/old/buyers/users.feature @@ -10,7 +10,7 @@ Feature: Buyer users management And the provider has the following fields defined for users: | Name | Choices | Label | Required | Read Only | Hidden | | custom_field | | | | | | - And a buyer "SpaceWidgets" signed up to provider "foo.3scale.localhost" + And a buyer "SpaceWidgets" And an active user "alice" of account "SpaceWidgets" And an active user "bob" of account "SpaceWidgets" diff --git a/features/old/buyers/users_fields.feature b/features/old/buyers/users_fields.feature index c4684b8699..6130121318 100644 --- a/features/old/buyers/users_fields.feature +++ b/features/old/buyers/users_fields.feature @@ -7,7 +7,7 @@ Feature: Buyer users fields management Background: Given a provider is logged in And the provider has multiple applications enabled - And a buyer "SpaceWidgets" signed up to provider "foo.3scale.localhost" + And a buyer "SpaceWidgets" And the provider has the following fields defined for users: | name | required | read_only | hidden | | first_name | true | | | diff --git a/features/old/cms/advanced/groups_and_sections.feature b/features/old/cms/advanced/groups_and_sections.feature index 793ad75195..ca4960c568 100644 --- a/features/old/cms/advanced/groups_and_sections.feature +++ b/features/old/cms/advanced/groups_and_sections.feature @@ -6,7 +6,7 @@ Feature: Groups and Sections Given a provider "foo.3scale.localhost" And provider "foo.3scale.localhost" has "groups" switch allowed And provider "foo.3scale.localhost" has multiple applications enabled - And an approved buyer "alice" signed up to provider "foo.3scale.localhost" + And an approved buyer "alice" And provider "foo.3scale.localhost" has a public section "Docs" with path "/docs" And provider "foo.3scale.localhost" has a published page with the title "First" of section "Docs" diff --git a/features/old/cms/email_templates.feature b/features/old/cms/email_templates.feature index 2906679577..699220361b 100644 --- a/features/old/cms/email_templates.feature +++ b/features/old/cms/email_templates.feature @@ -27,7 +27,7 @@ Feature: Email templates management | Subject | Bcc | Cc | From | | subj3ct | some@email.com | "Example" | My Company | And I press "Create Email Template" - Then I should see "Email Template overrided" + Then I should see "Email Template overridden" And the content of the email template "account_approved" should be """ new content for account approved diff --git a/features/old/cms/override.feature b/features/old/cms/override.feature index 15730f3664..d9350f6c80 100644 --- a/features/old/cms/override.feature +++ b/features/old/cms/override.feature @@ -54,7 +54,7 @@ Feature: Render liquid templates from database Scenario Outline: Override public pages - Given a buyer "bob" signed up to provider "foo.3scale.localhost" + Given a buyer "bob" And I log in as "bob" on foo.3scale.localhost When I go to the page Then I should see markup matching '' diff --git a/features/old/dashboards.feature b/features/old/dashboards.feature index 566a71618a..50d502e139 100644 --- a/features/old/dashboards.feature +++ b/features/old/dashboards.feature @@ -18,7 +18,7 @@ Feature: Dashboards # CHECK THIS OUT! Scenario: Buyer dashboard in multiple application mode Given provider "foo.3scale.localhost" has multiple applications enabled - And a buyer "bob" signed up to provider "foo.3scale.localhost" + And a buyer "bob" When I log in as "bob" on foo.3scale.localhost And I go to the dashboard Then I should be on the dashboard @@ -27,7 +27,7 @@ Feature: Dashboards Scenario: '/admin' on buyer domain sees buyer dashboard Given provider "foo.3scale.localhost" has multiple applications enabled When the current domain is foo.3scale.localhost - And a buyer "bob" signed up to provider "foo.3scale.localhost" + And a buyer "bob" And I log in as "bob" on foo.3scale.localhost And I request the url "/admin" Then I should be on the dashboard diff --git a/features/old/emails.feature b/features/old/emails.feature index b2d7eb7b81..0d49c1a8f8 100644 --- a/features/old/emails.feature +++ b/features/old/emails.feature @@ -12,7 +12,7 @@ Feature: Emails """ {% email %}{% do_not_send %}{% endemail %} """ - When a buyer "bob" signed up to provider "foo.3scale.localhost" + When a buyer "bob" And I am logged in as provider "foo.3scale.localhost" on its admin domain And the following application: | Buyer | Name | diff --git a/features/old/finance/invoices/editing.feature b/features/old/finance/invoices/editing.feature index 52372d0401..e5b2618749 100644 --- a/features/old/finance/invoices/editing.feature +++ b/features/old/finance/invoices/editing.feature @@ -7,7 +7,7 @@ Feature: Edit Invoice Background: Given a provider is logged in on 1st January 2011 And the provider is charging its buyers - And a buyer "bob" signed up to provider "foo.3scale.localhost" + And a buyer "bob" And an invoice of buyer "bob" for January, 2011 And an invoice of buyer "bob" for February, 2011 And they go to the invoice "2011-01-00000001" admin portal page diff --git a/features/old/liquid/content_access.feature b/features/old/liquid/content_access.feature index 12347c3a35..17a60c5254 100644 --- a/features/old/liquid/content_access.feature +++ b/features/old/liquid/content_access.feature @@ -41,14 +41,14 @@ Feature: Content access in liquid Then I should see "Protected Content Access DENIED" Scenario: Buyer without access cannot see protected content - Given a buyer "buyer" signed up to provider "foo.3scale.localhost" + Given a buyer "buyer" And I am logged in as "buyer" When I go to the homepage Then I should see "Protected Content Access DENIED" Scenario: Buyer with access granted can see protected content And provider "foo.3scale.localhost" has a private section "protected-section" - Given a buyer "buyer" signed up to provider "foo.3scale.localhost" + Given a buyer "buyer" And the buyer "buyer" has access to the section "protected-section" of provider "foo.3scale.localhost" And I am logged in as "buyer" When I go to the homepage diff --git a/features/old/liquid/drops.feature b/features/old/liquid/drops.feature index 653042e610..8331078c03 100644 --- a/features/old/liquid/drops.feature +++ b/features/old/liquid/drops.feature @@ -8,7 +8,7 @@ Feature: Liquid drops And the current domain is foo.3scale.localhost Scenario: MenuDrop - Given a buyer "bob" of provider "foo.3scale.localhost" + Given a buyer "bob" And I am logged in as "bob" When provider "foo.3scale.localhost" has following template diff --git a/features/old/login.feature b/features/old/login.feature index fdf0b8cdb5..439c0ae6c0 100644 --- a/features/old/login.feature +++ b/features/old/login.feature @@ -5,7 +5,7 @@ Feature: Login feature Background: Given a provider And the provider has multiple applications enabled - And a buyer "bob" signed up to provider "foo.3scale.localhost" + And a buyer "bob" Scenario: Buyer lands on the homepage when in enterprise mode When I log in as "bob" on foo.3scale.localhost diff --git a/features/old/menu/dashboard.feature b/features/old/menu/dashboard.feature index c7031fcc9e..6420e3b92c 100644 --- a/features/old/menu/dashboard.feature +++ b/features/old/menu/dashboard.feature @@ -22,7 +22,7 @@ Feature: Dashboard Then I should see the link "BILLING" within the audience dashboard widget Scenario: Messages link shows correct count - And a buyer "john" signed up to provider "foo.3scale.localhost" + And a buyer "john" And 5 messages sent from buyer "john" to the provider with subject "any" and body "any" And I go to the provider dashboard And I should see the link "5 MESSAGES" within the audience dashboard widget diff --git a/features/old/messages/buyer_side.feature b/features/old/messages/buyer_side.feature index 2e8c32dac3..4d22ea0e9b 100644 --- a/features/old/messages/buyer_side.feature +++ b/features/old/messages/buyer_side.feature @@ -6,7 +6,7 @@ Feature: Buyer side messages Background: Given a provider "foo.3scale.localhost" And provider "foo.3scale.localhost" has multiple applications enabled - And a buyer "bob" signed up to provider "foo.3scale.localhost" + And a buyer "bob" When I log in as "bob" on foo.3scale.localhost Scenario: Sending a message diff --git a/features/old/providers/fields_definitions.feature b/features/old/providers/fields_definitions.feature index f0aad08cb2..81f22f73cb 100644 --- a/features/old/providers/fields_definitions.feature +++ b/features/old/providers/fields_definitions.feature @@ -32,7 +32,7 @@ Feature: Fields Definitions | car_type | true | | | | head_size | | true | | | hidden | | | true | - And a buyer "randomdude" signed up to provider "foo.3scale.localhost" + And a buyer "randomdude" And buyer "randomdude" has extra fields: | car_type | head_size | hidden | | extra_required | user_read_only | hidden | diff --git a/features/old/services/subscriptions/buyer.feature b/features/old/services/subscriptions/buyer.feature index d858b3c9ca..aad5579ded 100644 --- a/features/old/services/subscriptions/buyer.feature +++ b/features/old/services/subscriptions/buyer.feature @@ -9,7 +9,7 @@ Feature: Buyer's service subscription And provider "foo.3scale.localhost" has "multiple_services" visible And a service "Second" of provider "foo.3scale.localhost" - And a buyer "bob" of provider "foo.3scale.localhost" + And a buyer "bob" And the default product of the provider has name "My API" And the following service plan: | Product | Name | State | diff --git a/features/old/signup/multitenant.feature b/features/old/signup/multitenant.feature index e13ae0979b..4c1928d257 100644 --- a/features/old/signup/multitenant.feature +++ b/features/old/signup/multitenant.feature @@ -29,7 +29,7 @@ Feature: Sign Up of enterprise buyers | Product | Name | | api2 | iPhone2 | - Given an approved buyer "bar" signed up to provider "foo.3scale.localhost" + Given an approved buyer "bar" Scenario: try to signup with existent email in other provider When the current domain is foo2.3scale.localhost @@ -41,7 +41,7 @@ Feature: Sign Up of enterprise buyers And I go to the sign up page And I fill in the following: | Email | foobar@example.net | - | Username | bar | + | Username | baz | | Password | supersecret | | Password confirmation | supersecret | | Organization/Group Name | Planet eXpress | diff --git a/features/old/site/settings.feature b/features/old/site/settings.feature index 3b24b72cba..155588db3d 100644 --- a/features/old/site/settings.feature +++ b/features/old/site/settings.feature @@ -9,6 +9,6 @@ Feature: Site settings @security Scenario: Settings is not available for buyers Given provider "foo.3scale.localhost" has multiple applications enabled - And a buyer "bob" signed up to provider "foo.3scale.localhost" + And a buyer "bob" When I log in as "bob" on foo.3scale.localhost When I request the url of the site settings page then I should see 404 diff --git a/features/old/stats/buyer_side.feature b/features/old/stats/buyer_side.feature index ab6efc280e..ff077e08be 100644 --- a/features/old/stats/buyer_side.feature +++ b/features/old/stats/buyer_side.feature @@ -8,7 +8,7 @@ Feature: Buyer stats Scenario: No access to stats if no app plan subscription Given a provider "foo.3scale.localhost" And provider "foo.3scale.localhost" has multiple applications enabled - And a buyer "alice" signed up to provider "foo.3scale.localhost" + And a buyer "alice" When I log in as "alice" on foo.3scale.localhost And I go to the dashboard Then I should not see the link "Statistics" diff --git a/features/old/stats/provider/top_applications.feature b/features/old/stats/provider/top_applications.feature index f92e11af5d..6c8c7db272 100644 --- a/features/old/stats/provider/top_applications.feature +++ b/features/old/stats/provider/top_applications.feature @@ -14,8 +14,8 @@ Feature: Top applications stats | My API | Default | Published | true | And a metric "foos" with friendly name "Number of Foos" of provider "foo.3scale.localhost" And a metric "bars" with friendly name "Number of Bars" of provider "foo.3scale.localhost" - And a buyer "alice" signed up to provider "foo.3scale.localhost" - And a buyer "bob" signed up to provider "foo.3scale.localhost" + And a buyer "alice" + And a buyer "bob" And the following applications: | Buyer | Name | | alice | alice widget | diff --git a/features/old/stats/provider_side.feature b/features/old/stats/provider_side.feature index cf1edbc502..4542905a80 100644 --- a/features/old/stats/provider_side.feature +++ b/features/old/stats/provider_side.feature @@ -24,7 +24,7 @@ Feature: Provider stats Then I should see "Traffic" Scenario: Top applications (multiple applications mode) - Given a buyer "bob" signed up to provider "foo.3scale.localhost" + Given a buyer "bob" And I follow "API" And I follow "Analytics" And I go to the provider stats apps page @@ -90,7 +90,7 @@ Feature: Provider stats Scenario: Signups (multiple application mode) Given provider "foo.3scale.localhost" has multiple applications enabled And a default application plan of provider "foo.3scale.localhost" - And a buyer "alice" signed up to provider "foo.3scale.localhost" + And a buyer "alice" And buyer "alice" has the following applications: | Name | Created at | | AwesomeWidget | Oct 1st 2010 | diff --git a/features/old/switches/groups.feature b/features/old/switches/groups.feature index bd47a07893..1afe185f79 100644 --- a/features/old/switches/groups.feature +++ b/features/old/switches/groups.feature @@ -18,7 +18,7 @@ Feature: Groups switch Then I should be on the groups page Scenario: Buyer groups do not show if groups is disabled - Given a buyer "buyer" signed up to provider "foo.3scale.localhost" + Given a buyer "buyer" Given the provider has "groups" switch denied And I go to the buyer account page for "buyer" Then I should not see link to the buyer account "buyer" groups page diff --git a/features/old/users/with_state_email_unverified.feature b/features/old/users/with_state_email_unverified.feature index 028da6da1e..db05fe0fa5 100644 --- a/features/old/users/with_state_email_unverified.feature +++ b/features/old/users/with_state_email_unverified.feature @@ -5,7 +5,7 @@ Feature: Users enter email unverified state Background: Given a provider "foo.3scale.localhost" And provider "foo.3scale.localhost" has multiple applications enabled - Given a buyer "alice" signed up to provider "foo.3scale.localhost" + Given a buyer "alice" Scenario: User in unverified_email state can login diff --git a/features/old/webhooks.feature b/features/old/webhooks.feature index c6c951ff93..bab3f6c55c 100644 --- a/features/old/webhooks.feature +++ b/features/old/webhooks.feature @@ -2,7 +2,7 @@ Feature: Webhooks Background: Given a provider "foo.3scale.localhost" - And a buyer "bob" of provider "foo.3scale.localhost" + And a buyer "bob" And provider "foo.3scale.localhost" has all webhooks enabled And provider "foo.3scale.localhost" has all the templates setup diff --git a/features/provider/admin/messages/inbox.feature b/features/provider/admin/messages/inbox.feature index c6670fd5d1..83890ea662 100644 --- a/features/provider/admin/messages/inbox.feature +++ b/features/provider/admin/messages/inbox.feature @@ -3,7 +3,7 @@ Feature: Audience > Messages > Inbox Background: Given a provider is logged in - And a buyer "Alice" of the provider + And a buyer "Alice" Scenario: Navigation from Audience When they press "Dashboard" diff --git a/features/provider/admin/messages/outbox.feature b/features/provider/admin/messages/outbox.feature index aca29c938f..c24630be5c 100644 --- a/features/provider/admin/messages/outbox.feature +++ b/features/provider/admin/messages/outbox.feature @@ -3,7 +3,7 @@ Feature: Audience > Messages > Outbox Background: Given a provider is logged in - And a buyer "Alice" of the provider + And a buyer "Alice" Scenario: Navigation from Audience When they press "Dashboard" diff --git a/features/provider/finance/revenue_by_month.feature b/features/provider/finance/revenue_by_month.feature index 814eff2a6b..4a56fd6eaa 100644 --- a/features/provider/finance/revenue_by_month.feature +++ b/features/provider/finance/revenue_by_month.feature @@ -7,7 +7,7 @@ Feature: Group earnings by month Background: Given a provider is logged in And the provider is charging its buyers - And the provider has one buyer + And a buyer "Bob Buyer" Scenario: In process invoice Given an invoice of the buyer with a total cost of 42.00 EUR diff --git a/features/step_definitions/buyer_steps.rb b/features/step_definitions/buyer_steps.rb index 6f143dcc41..47336ed21c 100644 --- a/features/step_definitions/buyer_steps.rb +++ b/features/step_definitions/buyer_steps.rb @@ -1,25 +1,16 @@ # frozen_string_literal: true -Given "a buyer {string}" do |name| - @buyer = @account = FactoryBot.create(:buyer_account, provider_account: @provider, org_name: name) +Given "a(n approved) buyer {string}" do |name| + @buyer = @account = FactoryBot.create(:buyer_account, provider_account: @provider, + org_name: name) @account.buy! @provider.account_plans.default -end - -Given "a buyer {string} of {provider}" do |org_name, provider| - @account = FactoryBot.create(:buyer_account, provider_account: provider, org_name: org_name) - @account.buy! provider.account_plans.default -end - -Given "{buyer} has {int} application(s)" do |buyer, number| - buyer.bought_cinstances.destroy_all - - plan = @plan || @product.plans.first - FactoryBot.create_list(:cinstance, number, user_account: buyer, plan: plan) + assert @buyer.approved? end When "(a )buyer {string} with email {string} signs up to {provider}" do |name, email, provider| - buyer = FactoryBot.build(:buyer_account, :provider_account => provider, - :org_name => name, :state => :created) + buyer = FactoryBot.build(:buyer_account, provider_account: provider, + org_name: name, + state: :created) buyer.users.each do |user| user.email = email user.signup_type = :new_signup @@ -36,6 +27,19 @@ buyer.buy!(plan) end +Given "a pending buyer {string}" do |account_name| + @buyer = FactoryBot.create(:pending_buyer_account, provider_account: @provider, + org_name: account_name) + @buyer.buy! @provider.account_plans.default + assert @buyer.pending? +end + +Given "a rejected buyer {string}" do |account_name| + @buyer = FactoryBot.create(:buyer_account, :rejected, provider_account: @provider, + org_name: account_name) + assert @buyer.rejected? +end + Given "a buyer {string} signed up to {plan}" do |org_name, plan| @buyer = FactoryBot.create(:buyer_account, provider_account: plan.provider_account, org_name: org_name) @@ -43,9 +47,9 @@ @buyer.buy!(plan) end -Given "a buyer {string} signed up to {provider}" do |account_name, provider| - @buyer = pending_buyer(provider, account_name) - @buyer.approve! unless @buyer.approved? +Given "a(n approved) buyer {string} signed up to {provider}" do |account_name, provider| + @buyer = FactoryBot.create(:buyer_account, provider_account: provider, + org_name: account_name) end Given "a pending buyer {string} signed up to {provider}" do |account_name, provider| @@ -53,7 +57,7 @@ end # Create a group of buyer accounts subscribed to one or more service plans - +# # Given the following buyers with service subscriptions signed up to the provider: # | Buyer | Plans | State | # | Ben | Basic, Pro | Pending | @@ -70,28 +74,18 @@ end def pending_buyer(provider, account_name) - # TODO: Refactor this method into a factory - buyer = FactoryBot.create(:buyer_account, :provider_account => provider, - :org_name => account_name, - :buyer => true) - buyer.buy! provider.account_plans.default - - buyer.make_pending! - assert buyer.pending? - - buyer + FactoryBot.create(:pending_buyer_account, provider_account: provider, + org_name: account_name) end -Given "an approved buyer {string} signed up to {provider}" do |account_name, provider| - @buyer = pending_buyer(provider, account_name) - @buyer.approve! unless @buyer.approved? -end +Given "{buyer} has {int} application(s)" do |buyer, number| + buyer.bought_cinstances.destroy_all -Given "a rejected buyer {string} signed up to {provider}" do |account_name, provider| - account = pending_buyer(provider, account_name) - account.reject! + plan = @plan || @product.plans.first + FactoryBot.create_list(:cinstance, number, user_account: buyer, plan: plan) end + Given "{buyer} has extra fields:" do |buyer, table| buyer.extra_fields = table.hashes.first buyer.save! @@ -235,8 +229,8 @@ def login_form end Given "a buyer {string} signed up to {service}" do |name, service| - @buyer = pending_buyer(service.account, name) - @buyer.approve! unless @buyer.approved? + @buyer = FactoryBot.create(:buyer_account, provider_account: service.account, + org_name: name) plans = service.service_plans plan = plans.default_or_first || plans.first diff --git a/features/step_definitions/buyers_management/account_steps.rb b/features/step_definitions/buyers_management/account_steps.rb index 93e39ddb8b..6b150eb49f 100644 --- a/features/step_definitions/buyers_management/account_steps.rb +++ b/features/step_definitions/buyers_management/account_steps.rb @@ -8,8 +8,7 @@ travel_to(Time.zone.now - index.day) # Prevent all buyer from having same sign up date buyer = FactoryBot.create(:buyer_account, provider_account: provider, - org_name: hash[:name], - buyer: true) + org_name: hash[:name]) buyer.update!(state: hash[:state]) if hash[:state] buyer.update!(created_at: Chronic.parse(hash[:created_at])) if hash[:created_at] @@ -19,6 +18,8 @@ plan = provider.account_plans.find_by(name: plan_name) || create_plan(:account, name: plan_name, issuer: provider) + + buyer.contracts.delete_all buyer.buy! plan end end diff --git a/features/step_definitions/provider_steps.rb b/features/step_definitions/provider_steps.rb index a548188d52..bcf66e270f 100644 --- a/features/step_definitions/provider_steps.rb +++ b/features/step_definitions/provider_steps.rb @@ -333,11 +333,6 @@ def create_provider_with_plan(name, plan) # TODO: RENAME THIS NOWWW try_buyer_login_sso_token end -And(/^the provider has one buyer$/) do - @buyer = pending_buyer(@provider, 'bob') - @buyer.approve! unless @buyer.approved? -end - And(/^the provider enables credit card on signup feature manually/) do settings = @provider.settings settings.allow_require_cc_on_signup! unless settings.require_cc_on_signup.allowed? diff --git a/spec/acceptance/api/account_spec.rb b/spec/acceptance/api/account_spec.rb index 347fd7f466..4a81038581 100644 --- a/spec/acceptance/api/account_spec.rb +++ b/spec/acceptance/api/account_spec.rb @@ -64,9 +64,7 @@ # and appropriate callbacks and values will be set in place put '/admin/api/accounts/:id/make_pending.:format' do include_context "resource" - - before { resource.approve! } - before { resource.state.should_not == "pending" } + let(:resource) { FactoryBot.create(:buyer_account, :approved, provider_account: provider) } # the response code and body are checked automatically # you can adjust it by setting: diff --git a/test/factories/account.rb b/test/factories/account.rb index 75578830f1..dd974cf6fd 100644 --- a/test/factories/account.rb +++ b/test/factories/account.rb @@ -23,12 +23,7 @@ factory(:account, :parent => :account_without_users) do after(:create) do |account| - if account.users.empty? - username = account.org_name.gsub(/[^a-zA-Z0-9_\.]+/, '_') - - admin = FactoryBot.create(:admin, :username => username, :account_id => account.id) - admin.activate! - end + FactoryBot.create(:active_admin, account: account) if account.users.empty? end after(:stub) do |account| @@ -37,20 +32,73 @@ account.stubs(:admins).returns([admin]) admin.stubs(:account).returns(account) end - end - factory(:pending_account, :parent => :account) do - after(:create) do |account| - account.make_pending! + trait :approved do + state { :approved } end - end -#FIXME: buyer accounts without provider accounts??? is that ok? - factory(:buyer_account_with_pending_user, :parent => :account) do - buyer { true } + trait :rejected do + state { :rejected } + end + + trait :pending do + state { :pending } + end + + factory :pending_account, traits: [:pending] + + factory :buyer do + buyer { true } + end + + factory :master_account, traits: [:approved] do + master { true } + org_name { 'Master account' } + payment_gateway_type { :bogus } + association :settings + billing_strategy factory: :postpaid_with_charging + + after(:build) do |account| + if account.users.empty? + account.users << FactoryBot.build(:active_admin, account_id: account.id, username: "superadmin") + else + account.admins.each { |user| user.activate! if user.can_activate? } + end + end + + after(:create) do |account| + account.provider_account = account + + if account.users.empty? + account.users << FactoryBot.create(:active_admin, account_id: account.id, username: "superadmin") + else + account.admins.each { |user| user.activate! if user.can_activate? } + end + + service = FactoryBot.create(:service, account: account) + + # Defaults + app_plan = FactoryBot.create(:published_application_plan, issuer: service, default: true) + account_plan = FactoryBot.create(:account_plan, :published, issuer: account, default: true) + account.update_attribute :default_account_plan, account_plan + + service.update_attribute(:default_service_plan, service.service_plans.first) # rubocop:disable Rails/SkipsModelValidations + + %w[prepaid_billing postpaid_billing anonymous_clients liquid].each do |feature| + service.features.create!(system_name: feature, name: feature.humanize) + end + + FactoryBot.create(:cinstance, plan: app_plan, user_account: account) + end + + after(:stub) do |account| + Account.stubs(:master).returns(account) + Account.stubs(:find_by_domain).with(account.internal_domain).returns(account) + end + end end - factory(:pending_buyer_account, :parent => :buyer_account_with_pending_user) do + factory(:pending_buyer_account, traits: [:pending], parent: :buyer) do after(:create) do |account| account.users.each do |user| user.activate! unless user.active? # horrible horrible factories @@ -58,11 +106,8 @@ end end - factory(:buyer_account, :parent => :pending_buyer_account) do + factory(:buyer_account, traits: [:approved], parent: :pending_buyer_account) do association :provider_account - after(:create) do |account| - account.approve! if account.can_approve? - end after(:build) do |account| if account.users.empty? @@ -128,7 +173,7 @@ # assign tenant id manualy, because we cannot do it by trigger account.tenant_id = account.id - account.approve! + account.approve! if account.pending? account.services.first.update_attribute :mandatory_app_key, false account.settings.update!( @@ -189,56 +234,4 @@ a.save end end - - factory(:master_account, :parent => :account) do - master { true } - org_name { 'Master account' } - payment_gateway_type { :bogus } - association :settings - - after(:build) do |account| - account.billing_strategy = FactoryBot.build(:postpaid_with_charging) - if account.users.empty? - account.users << FactoryBot.build(:admin, :account_id => account.id, :username => "superadmin", state: 'active') - end - account.admins.each { |user| user.activate! if user.can_activate? } - end - - after(:create) do |account| - account.provider_account = account - - if account.users.empty? - account.users << FactoryBot.create(:admin, :account_id => account.id, :username => "superadmin", state: 'active') - end - account.admins.each { |user| user.activate! if user.can_activate? } - account.approve! if account.can_approve? - - #[multiservice] First service is the default - service = FactoryBot.create(:service, :account => account) - - # Defaults - application_plan = FactoryBot.create(:application_plan, issuer: service, state: 'published') - account_plan = FactoryBot.create(:account_plan, issuer: account, state: 'published') - - service.update_attribute :default_application_plan, application_plan - service.update_attribute :default_service_plan, service.service_plans.first - account.update_attribute :default_account_plan, account_plan - - # TODO: add more master features here, if needed - %w[prepaid_billing postpaid_billing anonymous_clients liquid].each do |feature| - account.default_service.features.create!(:system_name => feature, :name => feature.humanize) - end - - FactoryBot.create(:cinstance, :plan => account.default_service.application_plans.published.first, - :user_account => account) - - account.reload - end - - - after(:stub) do |account| - Account.stubs(:master).returns(account) - Account.stubs(:find_by_domain).with(account.internal_domain).returns(account) - end - end end diff --git a/test/factories/plan.rb b/test/factories/plan.rb index ffde182b64..dee6fc89cd 100644 --- a/test/factories/plan.rb +++ b/test/factories/plan.rb @@ -32,6 +32,10 @@ after(:build) do |plan, evaluator| plan.issuer.update(default_account_plan: plan) if evaluator.default end + + trait :published do + state { :published } + end end factory(:service_plan, parent: :plan, class: ServicePlan) do diff --git a/test/factories/user.rb b/test/factories/user.rb index 96ffc22369..d2fa9bc6fc 100644 --- a/test/factories/user.rb +++ b/test/factories/user.rb @@ -21,6 +21,7 @@ factory(:admin, :parent => :user) do role { :admin } + username { account.org_name.gsub(/[^a-zA-Z0-9_\.]+/, '_') } end factory(:active_admin, :parent => :admin) do diff --git a/test/unit/mailers/user_mailer_test.rb b/test/unit/mailers/user_mailer_test.rb index f0ed40957b..8fbcd565ca 100644 --- a/test/unit/mailers/user_mailer_test.rb +++ b/test/unit/mailers/user_mailer_test.rb @@ -76,7 +76,7 @@ class BuyerTest < UserMailerTest @provider_account = FactoryBot.create(:provider_account, domain: 'api.monkey.com', org_name: "Monkey", from_email: 'api@monkey.com') - @buyer_account = FactoryBot.create(:buyer_account_with_pending_user, provider_account: @provider_account) + @buyer_account = FactoryBot.create(:buyer, provider_account: @provider_account) @user = FactoryBot.create(:admin, account: @buyer_account) end