Sha256: 3a4a92508b1e895c7464193c773a4e9a5725b42f8c712fcbab8fdbbc41a83e3c

Contents?: true

Size: 1001 Bytes

Versions: 3

Compression:

Stored size: 1001 Bytes

Contents

require 'backup/configuration/attributes'

describe Backup::Configuration::Attributes do
  before(:all) do
    class ConfigurationSample
      extend Backup::Configuration::Attributes
      generate_attributes :file, :username, :password
    end
    @sample = ConfigurationSample.new
  end
  
  it "should generate setter methods to attributes" do
    @sample.should respond_to(:file)
    @sample.should respond_to(:username)
    @sample.should respond_to(:password)
  end
  
  it "should generate accessor for attributes" do
    @sample.should respond_to(:attributes)
  end
  
  it "should store keys of attributes as strings" do
    @sample.file "list.txt"
    @sample.username "jonh"
    @sample.password "secret"
    @sample.attributes.keys.all? {|k| k.is_a?(String)}.should == true
  end
  
  it "should store values of attributes in attributes hash" do
    @sample.file "list.txt"
    @sample.attributes.keys.should include('file')
    @sample.attributes['file'].should == "list.txt"
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
backup-wakiki-2.4.1 spec/configuration/attributes_spec.rb
backup-gundua-2.3.1.2 spec/configuration/attributes_spec.rb
backup-gundua-2.3.1.1 spec/configuration/attributes_spec.rb