Sha256: d6002630b2aedc31e38ad50e278b614af4c6b17476e4ff25c16670a85a468a14

Contents?: true

Size: 1.52 KB

Versions: 16

Compression:

Stored size: 1.52 KB

Contents

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

module Workarea
  module Api
    module Storefront
      class EmailSignupsDocumentationTest < DocumentationTest
        resource 'Email Signups'

        setup :set_content

        def set_content
          page = Workarea::Storefront::EmailSignupsViewModel.new
          page.content.blocks.create!(
            type: :text,
            data: { text: 'Here is some administrated content' }
          )
        end

        def test_and_document_show
          description 'Showing an email signup content'
          route storefront_api.email_signups_path
          explanation <<-EOS
            This endpoint will return all relevant data for showing an email
            sign up form.
          EOS

          record_request do
            get storefront_api.email_signups_path
            assert_equal(200, response.status)
          end
        end

        def test_and_document_create
          description 'Creating an email signup'
          route storefront_api.email_signups_path
          explanation <<-EOS
            Use this endpoint to create an email signup. This will usually be
            forwarded to an Email Service Provider, but Workarea will keep a
            record of it just in case.
          EOS

          record_request do
            post storefront_api.email_signups_path,
              as: :json,
              params: { email: 'email@example.com' }
            assert_equal(200, response.status)
          end
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

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