Sha256: 8812a2a3d8a4b41de8f628f5c070d21ba623592a65748f2ed04ee2f0734308eb

Contents?: true

Size: 1.66 KB

Versions: 12

Compression:

Stored size: 1.66 KB

Contents

require 'rails_helper'

RSpec.describe '/de/backend/schaufenster/categories', type: :feature do
  let(:resource_class) { Cmor::Showcase::Category }
  let(:resource) { create(:cmor_showcase_category) }
  let(:resources) { create_list(:cmor_showcase_category, 3) }

  # List
  it { resources; expect(subject).to implement_index_action(self) }

  # Create
  it { 
    expect(subject).to implement_create_action(self)
      .for(resource_class)
      .within_form('#new_category') {
        # fill the needed form inputs via capybara here
        #
        # Example:
        #
        #     select 'de', from: 'slider[locale]'
        #     fill_in 'slider[name]', with: 'My first slider'
        #     check 'slider[auto_start]'
        #     fill_in 'slider[interval]', with: '3'
        select 'de', from: 'category[locale]'
        fill_in 'category[identifier]', with: 'category-1'
        fill_in 'category[name]', with: 'Webseiten'
      }
      .increasing{ Cmor::Showcase::Category.count }.by(1)
  }
  
  # Read
  it { expect(subject).to implement_show_action(self).for(resource) }

  # Update
  it {
    expect(subject).to implement_update_action(self)
      .for(resource)
      .within_form('.edit_category') {
        # fill the needed form inputs via capybara here
        # 
        # Example:
        # 
        #     fill_in 'slider[name]', with: 'New name'
        fill_in 'category[name]', with: 'CI'
      }
      .updating
      .from(resource.attributes)
      .to({ 'name' => 'CI' }) # Example: .to({ 'name' => 'New name' })
  }

  # Delete
  it {
    expect(subject).to implement_delete_action(self)
      .for(resource)
      .reducing{ resource_class.count }.by(1)
  }
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
cmor_showcase-0.0.51.pre spec/features/de/backend/schaufenster/categories_feature_spec.rb
cmor_showcase-0.0.50.pre spec/features/de/backend/schaufenster/categories_feature_spec.rb
cmor_showcase-0.0.49.pre spec/features/de/backend/schaufenster/categories_feature_spec.rb
cmor_showcase-0.0.48.pre spec/features/de/backend/schaufenster/categories_feature_spec.rb
cmor_showcase-0.0.45.pre spec/features/de/backend/schaufenster/categories_feature_spec.rb
cmor_showcase-0.0.44.pre spec/features/de/backend/schaufenster/categories_feature_spec.rb
cmor_showcase-0.0.43.pre spec/features/de/backend/schaufenster/categories_feature_spec.rb
cmor_showcase-0.0.42.pre spec/features/de/backend/schaufenster/categories_feature_spec.rb
cmor_showcase-0.0.41.pre spec/features/de/backend/schaufenster/categories_feature_spec.rb
cmor_showcase-0.0.40.pre spec/features/de/backend/schaufenster/categories_feature_spec.rb
cmor_showcase-0.0.39.pre spec/features/de/backend/schaufenster/categories_feature_spec.rb
cmor_showcase-0.0.38.pre spec/features/de/backend/schaufenster/categories_feature_spec.rb