Sha256: f692597275d11e200e4674b3cad6afcb44b87584d821ee6828c52d774c39a89e

Contents?: true

Size: 1.22 KB

Versions: 16

Compression:

Stored size: 1.22 KB

Contents

require 'spec_helper'

describe "Sunrise Manager New" do
  subject { page }
  before(:all) { @admin = FactoryGirl.create(:admin_user) }

  context "admin" do
    before(:each) { login_as @admin }
    
    describe "GET /manage/typo/new" do
      it "should raise NotFound" do
        lambda {
          visit new_path(:model_name => "whatever")
        }.should raise_error ActionController::RoutingError
      end
    end

    describe "GET /manage/structures/new" do
      before(:each) do
        visit new_path(:model_name => "structures")
      end
      
      it "should show page title" do
        should have_content( I18n.t('manage.add') )
      end
      
      it "should generate field to edit" do
        SunriseStructure.config.edit.fields.each do |f|
          if ['kind', 'parent_id', 'position'].include?(f.name)
            should have_selector "select[@name='structure[#{f.name}]']"
          else
            should have_selector "input[@name='structure[#{f.name}]']"
          end
        end
      end
    end
  end
  
  describe "anonymous user" do
    before(:each) do
      visit new_path(:model_name => "structures")
    end
    
    it "should redirect to login page" do
      should have_content('Sign in')
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
sunrise-cms-0.5.3 spec/requests/manager/default/new_spec.rb
sunrise-cms-0.5.2 spec/requests/manager/default/new_spec.rb
sunrise-cms-0.5.1 spec/requests/manager/default/new_spec.rb
sunrise-cms-0.5.0 spec/requests/manager/default/new_spec.rb
sunrise-cms-0.5.0.rc5 spec/requests/manager/default/new_spec.rb
sunrise-cms-0.5.0.rc4 spec/requests/manager/default/new_spec.rb
sunrise-cms-0.5.0.rc3 spec/requests/manager/default/new_spec.rb
sunrise-cms-0.5.0.rc2 spec/requests/manager/default/new_spec.rb
sunrise-cms-0.5.0.rc1 spec/requests/manager/default/new_spec.rb
sunrise-cms-0.4.2 spec/requests/manager/default/new_spec.rb
sunrise-cms-0.4.1 spec/requests/manager/default/new_spec.rb
sunrise-cms-0.4.0 spec/requests/manager/default/new_spec.rb
sunrise-cms-0.3.3 spec/requests/manager/default/new_spec.rb
sunrise-cms-0.3.2 spec/requests/manager/default/new_spec.rb
sunrise-cms-0.3.1 spec/requests/manager/default/new_spec.rb
sunrise-cms-0.3.0 spec/requests/manager/default/new_spec.rb