Sha256: 7108eaecc7a8ecfa9a3c01f2aff3cc71235a8a80a46bbd4c8688bfbda2c2b1d3

Contents?: true

Size: 1.25 KB

Versions: 6

Compression:

Stored size: 1.25 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 ['structure_type_id', 'parent_id', 'position_type_id'].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

6 entries across 6 versions & 1 rubygems

Version Path
sunrise-cms-0.6.5 spec/requests/manager/default/new_spec.rb
sunrise-cms-0.6.4 spec/requests/manager/default/new_spec.rb
sunrise-cms-0.6.3 spec/requests/manager/default/new_spec.rb
sunrise-cms-0.6.2 spec/requests/manager/default/new_spec.rb
sunrise-cms-0.6.1 spec/requests/manager/default/new_spec.rb
sunrise-cms-0.6.0 spec/requests/manager/default/new_spec.rb