Sha256: 4a1e5f6ebe8d15393a60b3a7c6f9de6e27ffa5fb4cea38b8f36aada477b7ff34

Contents?: true

Size: 1.39 KB

Versions: 4

Compression:

Stored size: 1.39 KB

Contents

require File.dirname(__FILE__) + '/../test_helper.rb'

context "Configuration" do
  specify "should have an empty whitelist if only restful options are passed in" do
    config = Restful.cfg
    config.restful_options[:expansion] = :expanded
    config.whitelisted.should.empty
  end
  
  specify "should return fields without restful_options via whitelisted" do
    config = Restful.cfg([:one, :two])
    config.restful_options[:expansion] = :expanded
    config.whitelisted.should.not.include :restful_options
  end
  
  specify "should have 0 whitelisted fields if none were specified" do
  end
  
  specify "should know if it has restful_options" do
    config = Restful.cfg([:one, :two])
    config.restful_options[:expansion] = :expanded
    config.restful_options.should.not.empty
  end
  
  specify "should be able to handle nested whitelist attributes" do
    config = Restful.cfg(:one, :two => [:a, :b])
    config.nested(:two).whitelisted.should.== [:a,:b]
  end
  
  specify "should set restful options when set in to_restful method" do
    
  end

  specify "should know which attributes are published" do
    config = Restful.cfg(:one, :two => [:a, :b])
    config.published?(:two).should.== true
    config.published?(:one).should.== true
  end
  
  specify "should know if it is nested" do
    config = Restful.cfg(:one, :restful_options => {:nested => true})
    config.nested?.should.== true
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
purzelrakete-restful-0.2.1 test/rails/configuration_test.rb
purzelrakete-restful-0.2.2 test/rails/configuration_test.rb
purzelrakete-restful-0.2.3 test/rails/configuration_test.rb
purzelrakete-restful-0.2.4 test/rails/configuration_test.rb