Sha256: 34c2ea9de9f273a2afc0c7c277376ea188f36bbf6b7332c070ba5355b432869a

Contents?: true

Size: 1.86 KB

Versions: 20

Compression:

Stored size: 1.86 KB

Contents

require 'spec_helper'

feature 'disable user flow', organization_workspace: :test do
  let!(:current_organization) { Organization.current }
  let(:user) { create(:user) }

  let!(:chapter) {
    create(:chapter, lessons: [
        create(:lesson, guide: create(:guide))]) }

  let(:book) { current_organization.book }

  before { reindex_current_organization! }

  before { set_current_user! user }

  scenario 'enabled organization' do
    visit '/'

    expect(page).to have_text('ム mumuki')
    expect(page).to have_text(current_organization.book.name)
    expect(user.reload.last_organization).to eq current_organization
  end

  context 'unprepared organization' do

    before { current_organization.update! in_preparation_until: 2.minutes.since }

    scenario 'visit /' do
      visit '/'

      expect(page).to_not have_text('ム mumuki')
      expect(page).to_not have_text(current_organization.book.name)
      expect(page).to have_text(I18n.t(:unprepared_organization_explanation))
    end

    scenario 'visit /user' do
      visit '/test/user'

      expect(page).to_not have_text('ム mumuki')
      expect(page).to_not have_text(current_organization.book.name)
      expect(page).to have_text(I18n.t(:unprepared_organization_explanation))
    end

  end

  context 'disabled organization' do

    before { current_organization.update! disabled_from: 2.minutes.ago }

    scenario 'visit /' do
      visit '/'

      expect(page).to_not have_text('ム mumuki')
      expect(page).to_not have_text(current_organization.book.name)
      expect(page).to have_text(I18n.t(:disabled_organization_explanation))
    end

    scenario 'visit /user' do
      visit '/test/user'

      expect(page).to_not have_text('ム mumuki')
      expect(page).to_not have_text(current_organization.book.name)
      expect(page).to have_text(I18n.t(:disabled_organization_explanation))
    end

    end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
mumuki-laboratory-7.10.5 spec/features/disabled_organization_flow_spec.rb
mumuki-laboratory-7.10.4 spec/features/disabled_organization_flow_spec.rb
mumuki-laboratory-7.10.3 spec/features/disabled_organization_flow_spec.rb
mumuki-laboratory-7.10.2 spec/features/disabled_organization_flow_spec.rb
mumuki-laboratory-7.10.1 spec/features/disabled_organization_flow_spec.rb
mumuki-laboratory-7.10.0 spec/features/disabled_organization_flow_spec.rb
mumuki-laboratory-7.9.2 spec/features/disabled_organization_flow_spec.rb
mumuki-laboratory-7.9.1 spec/features/disabled_organization_flow_spec.rb
mumuki-laboratory-7.9.0 spec/features/disabled_organization_flow_spec.rb
mumuki-laboratory-7.7.6 spec/features/disabled_organization_flow_spec.rb
mumuki-laboratory-7.7.5 spec/features/disabled_organization_flow_spec.rb
mumuki-laboratory-7.7.4 spec/features/disabled_organization_flow_spec.rb
mumuki-laboratory-7.8.0 spec/features/disabled_organization_flow_spec.rb
mumuki-laboratory-7.7.3 spec/features/disabled_organization_flow_spec.rb
mumuki-laboratory-7.7.2 spec/features/disabled_organization_flow_spec.rb
mumuki-laboratory-7.7.1 spec/features/disabled_organization_flow_spec.rb
mumuki-laboratory-7.7.0 spec/features/disabled_organization_flow_spec.rb
mumuki-laboratory-7.6.2 spec/features/disabled_organization_flow_spec.rb
mumuki-laboratory-7.6.1 spec/features/disabled_organization_flow_spec.rb
mumuki-laboratory-7.6.0 spec/features/disabled_organization_flow_spec.rb