Sha256: 296079e475d8d4e45fb9197e535b31f43994d793aafd4a8849b712c79fe68a2a

Contents?: true

Size: 1.61 KB

Versions: 12

Compression:

Stored size: 1.61 KB

Contents

require 'test_helper'
require 'workarea/api/documentation_test'

module Workarea
  module Api
    module Admin
      class EmailSignupsDocumentationTest < DocumentationTest
        include Workarea::Admin::IntegrationTest

        resource 'Email Signups'

        def test_and_document_index
          description 'Listing email signups'
          route admin_api.email_signups_path
          parameter :page, 'Current page'
          parameter :sort_by, 'Field on which to sort (see responses for possible values)'
          parameter :sort_direction, 'Direction to sort (asc or desc)'

          2.times { |i| create_email_signup(email: "#{i}@workarea.com") }

          record_request do
            get admin_api.email_signups_path,
                  params: { page: 1, sort_by: 'created_at', sort_direction: 'desc' }

            assert_equal(200, response.status)
          end
        end

        def test_and_document_show_by_id
          description 'Showing an email signup by ID'
          route admin_api.email_signup_path(':id')

          record_request do
            get admin_api.email_signup_path(create_email_signup.id)
            assert_equal(200, response.status)
          end
        end

        def test_and_document_show_by_email
          description 'Showing an email signup by email'
          route admin_api.email_signup_path(':email')

          signup = create_email_signup(email: 'test@workarea.com')

          record_request do
            get admin_api.email_signup_path(URI.escape(signup.email, '+@.'))
            assert_equal(200, response.status)
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
workarea-api-4.5.6 admin/test/documentation/workarea/api/admin/email_signups_documentation_test.rb
workarea-api-admin-4.5.6 test/documentation/workarea/api/admin/email_signups_documentation_test.rb
workarea-api-4.5.5 admin/test/documentation/workarea/api/admin/email_signups_documentation_test.rb
workarea-api-admin-4.5.5 test/documentation/workarea/api/admin/email_signups_documentation_test.rb
workarea-api-4.5.4 admin/test/documentation/workarea/api/admin/email_signups_documentation_test.rb
workarea-api-admin-4.5.4 test/documentation/workarea/api/admin/email_signups_documentation_test.rb
workarea-api-4.5.3 admin/test/documentation/workarea/api/admin/email_signups_documentation_test.rb
workarea-api-admin-4.5.3 test/documentation/workarea/api/admin/email_signups_documentation_test.rb
workarea-api-4.5.2 admin/test/documentation/workarea/api/admin/email_signups_documentation_test.rb
workarea-api-admin-4.5.2 test/documentation/workarea/api/admin/email_signups_documentation_test.rb
workarea-api-4.5.0 admin/test/documentation/workarea/api/admin/email_signups_documentation_test.rb
workarea-api-admin-4.5.0 test/documentation/workarea/api/admin/email_signups_documentation_test.rb