Sha256: 9e495162daed8e863c1cd65990781021647127e7eb4e6dc3845d0daf9e4da797

Contents?: true

Size: 1.6 KB

Versions: 9

Compression:

Stored size: 1.6 KB

Contents

require File.join(File.dirname(__FILE__), %w[.. spec_helper])
require File.join(File.dirname(__FILE__), %w[.. .. lib lockdown rules])

describe Lockdown::System do
  it "should fetch the option" do
    Lockdown::System.options = {}
    Lockdown::System.options['test'] = "my test"
    Lockdown::System.fetch('test').should == "my test"
  end
  
  describe "#configure" do
    it "should call the methods responsible for defining the rules" do
      Lockdown::System.stub!(:skip_sync?).and_return(false)

      Lockdown::System.should_receive :set_defaults 
 
      Lockdown::System.should_receive :instance_eval
 
      Lockdown::System.should_receive :process_rules
 
      Lockdown::Database.should_receive :sync_with_db 
     
      Lockdown.should_receive :caching?

      Lockdown::System.configure do
      end
    end
  end

  describe "#paths_for" do
    it "should join the str_sym to the methods" do 
      Lockdown::System.paths_for(:users, :show, :edit).
        should == ["users/show", "users/edit"]
    end

    it "should add users to the array if access is granted on index" do 
      Lockdown::System.paths_for(:users, :index, :show, :edit).
        should == ["users/index", "users/show", "users/edit", "users"]
    end

    it "should build the paths from the controller class if no methods specified" do
      methods = ["new","edit","create","update"]
      Lockdown.stub!(:fetch_controller_class)
      Lockdown::System.stub!(:available_actions).
        and_return(methods)

      Lockdown::System.paths_for(:users).
        should == ["users/new","users/edit","users/create","users/update"]
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
lockdown-1.6.5 spec/lockdown/system_spec.rb
revo-lockdown-1.6.2.2 spec/lockdown/system_spec.rb
lockdown-1.6.4 spec/lockdown/system_spec.rb
lockdown-1.6.3 spec/lockdown/system_spec.rb
revo-lockdown-1.6.2.1 spec/lockdown/system_spec.rb
revo-lockdown-1.6.2 spec/lockdown/system_spec.rb
lockdown-1.6.2 spec/lockdown/system_spec.rb
lockdown-1.6.1 spec/lockdown/system_spec.rb
lockdown-1.6.0 spec/lockdown/system_spec.rb