From 956177f235b75eab2057c11bedb7d4b92a2585d4 Mon Sep 17 00:00:00 2001 From: "geemus (Wesley Beary)" Date: Tue, 16 Feb 2010 20:05:36 -0800 Subject: [PATCH] flavors specs --- spec/aws/models/ec2/flavors_spec.rb | 14 ++++++++++++++ spec/rackspace/models/servers/flavors_spec.rb | 14 ++++++++++++++ spec/shared_examples/flavors_examples.rb | 16 ++++++++++++++++ spec/slicehost/models/flavors_spec.rb | 14 ++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 spec/aws/models/ec2/flavors_spec.rb create mode 100644 spec/rackspace/models/servers/flavors_spec.rb create mode 100644 spec/shared_examples/flavors_examples.rb create mode 100644 spec/slicehost/models/flavors_spec.rb diff --git a/spec/aws/models/ec2/flavors_spec.rb b/spec/aws/models/ec2/flavors_spec.rb new file mode 100644 index 000000000..25c785f33 --- /dev/null +++ b/spec/aws/models/ec2/flavors_spec.rb @@ -0,0 +1,14 @@ +require File.dirname(__FILE__) + '/../../../spec_helper' +require File.dirname(__FILE__) + '/../../../shared_examples/flavors_examples' + +describe 'Fog::AWS::EC2::Flavors' do + + it_should_behave_like "Flavors" + + subject { @flavor = @flavors.all.first } + + before(:each) do + @flavors = AWS[:ec2].flavors + end + +end diff --git a/spec/rackspace/models/servers/flavors_spec.rb b/spec/rackspace/models/servers/flavors_spec.rb new file mode 100644 index 000000000..4b9532f1e --- /dev/null +++ b/spec/rackspace/models/servers/flavors_spec.rb @@ -0,0 +1,14 @@ +require File.dirname(__FILE__) + '/../../../spec_helper' +require File.dirname(__FILE__) + '/../../../shared_examples/flavors_examples' + +describe 'Fog::AWS::Rackspace::Flavors' do + + it_should_behave_like "Flavors" + + subject { @flavor = @flavors.all.first } + + before(:each) do + @flavors = Rackspace[:servers].flavors + end + +end \ No newline at end of file diff --git a/spec/shared_examples/flavors_examples.rb b/spec/shared_examples/flavors_examples.rb new file mode 100644 index 000000000..15bb9825e --- /dev/null +++ b/spec/shared_examples/flavors_examples.rb @@ -0,0 +1,16 @@ +shared_examples_for "Flavors" do + + describe "#get" do + + it "should return a matching flavor if one exists" do + get = @flavors.get(subject.id) + subject.attributes.should == get.attributes + end + + it "should return nil if no matching server exists" do + @flavors.get('0').should be_nil + end + + end + +end diff --git a/spec/slicehost/models/flavors_spec.rb b/spec/slicehost/models/flavors_spec.rb new file mode 100644 index 000000000..0f71d1834 --- /dev/null +++ b/spec/slicehost/models/flavors_spec.rb @@ -0,0 +1,14 @@ +require File.dirname(__FILE__) + '/../../../spec_helper' +require File.dirname(__FILE__) + '/../../../shared_examples/flavors_examples' + +describe 'Fog::AWS::Slicehost::Flavors' do + + it_should_behave_like "Flavors" + + subject { @flavor = @flavors.all.first } + + before(:each) do + @flavors = Slicehost[:slices].flavors + end + +end \ No newline at end of file