Sha256: d37710d82aa763f4c32d19856f87e5b064666197c9599cbb3854b4f1a8bee480

Contents?: true

Size: 1.12 KB

Versions: 7

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

describe "Security: " do

  before(:all) do
    Alchemy::Page.root.children.destroy_all
    Alchemy::User.delete_all
    # ensuring that we have the correct locale here
    ::I18n.locale = :en
  end

  context "If no user is present" do

    it "render the signup view" do
      visit '/alchemy/'
      within('#alchemy_greeting') { page.should have_content('signup') }
    end
  end

  context "If user is present" do

    before(:all) do
      create_admin_user
    end

    it "a visitor should not be able to signup" do
      visit '/alchemy/admin/signup'
      within('#alchemy_greeting') { page.should_not have_content('have to signup') }
    end

    context "that is not logged in" do
      it "should see login-form" do
        visit '/alchemy/admin/dashboard'
        current_path.should == '/alchemy/admin/login'
      end
    end

    context "that is already logged in" do

      before(:each) do
        login_into_alchemy
      end

      it "should be redirected to dashboard" do
        visit '/alchemy/admin/login'
        current_path.should == '/alchemy/admin/dashboard'
      end

    end

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
alchemy_cms-2.2.2 spec/integration/security_spec.rb
alchemy_cms-2.2.1 spec/integration/security_spec.rb
alchemy_cms-2.2.0 spec/integration/security_spec.rb
alchemy_cms-2.2.rc15 spec/integration/security_spec.rb
alchemy_cms-2.2.rc14 spec/integration/security_spec.rb
alchemy_cms-2.2.rc13 spec/integration/security_spec.rb
alchemy_cms-2.2.rc11 spec/integration/security_spec.rb