From 01c2a29a49835d13125291e5ff3107f0773d931a Mon Sep 17 00:00:00 2001 From: geemus Date: Mon, 3 May 2010 16:48:46 -0700 Subject: [PATCH] add identity setter and fix more deprecated directory calls --- lib/fog/model.rb | 4 ++++ spec/aws/models/s3/directories_spec.rb | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/fog/model.rb b/lib/fog/model.rb index d36b326c4..29adc7f1d 100644 --- a/lib/fog/model.rb +++ b/lib/fog/model.rb @@ -51,6 +51,10 @@ module Fog send(self.class.instance_variable_get('@identity')) end + def identity=(new_identity) + send("#{identity}=", new_identity) + end + def initialize(new_attributes = {}) merge_attributes(new_attributes) end diff --git a/spec/aws/models/s3/directories_spec.rb b/spec/aws/models/s3/directories_spec.rb index b4444c491..f87ff0fba 100644 --- a/spec/aws/models/s3/directories_spec.rb +++ b/spec/aws/models/s3/directories_spec.rb @@ -5,8 +5,8 @@ describe 'Fog::AWS::S3::Directories' do describe "#all" do it "should include persisted directories" do - @directory = AWS[:s3].directories.create(:name => 'fogdirectoryname') - AWS[:s3].directories.all.map {|directory| @directory.name}.should include('fogdirectoryname') + @directory = AWS[:s3].directories.create(:key => 'fogdirectorykey') + AWS[:s3].directories.all.map {|directory| @directory.key}.should include('fogdirectorykey') @directory.destroy end @@ -15,8 +15,8 @@ describe 'Fog::AWS::S3::Directories' do describe "#create" do it "should exist on s3" do - directory = AWS[:s3].directories.create(:name => 'fogdirectoryname') - AWS[:s3].directories.get(directory.name).should_not be_nil + directory = AWS[:s3].directories.create(:key => 'fogdirectorykey') + AWS[:s3].directories.get(directory.key).should_not be_nil directory.destroy end @@ -25,8 +25,8 @@ describe 'Fog::AWS::S3::Directories' do describe "#get" do it "should return a Fog::AWS::S3::Directory if a matching directory exists" do - directory = AWS[:s3].directories.create(:name => 'fogdirectoryname') - get = AWS[:s3].directories.get('fogdirectoryname') + directory = AWS[:s3].directories.create(:key => 'fogdirectorykey') + get = AWS[:s3].directories.get('fogdirectorykey') directory.attributes.should == get.attributes directory.destroy end