[PATCH aeolus-image-rubygem 1/2] Rename of some spec files - add _spec suffix
Petr Blaho
pblaho at redhat.com
Thu Feb 23 14:18:57 UTC 2012
https://bugzilla.redhat.com/show_bug.cgi?id=791216
---
spec/models/factory/base.rb | 82 ----------------------------
spec/models/factory/base_spec.rb | 82 ++++++++++++++++++++++++++++
spec/models/factory/builder.rb | 31 -----------
spec/models/factory/builder_spec.rb | 31 +++++++++++
spec/models/factory/provider_image.rb | 21 -------
spec/models/factory/provider_image_spec.rb | 21 +++++++
spec/models/factory/target_image.rb | 21 -------
spec/models/factory/target_image_spec.rb | 21 +++++++
8 files changed, 155 insertions(+), 155 deletions(-)
delete mode 100644 spec/models/factory/base.rb
create mode 100644 spec/models/factory/base_spec.rb
delete mode 100644 spec/models/factory/builder.rb
create mode 100644 spec/models/factory/builder_spec.rb
delete mode 100644 spec/models/factory/provider_image.rb
create mode 100644 spec/models/factory/provider_image_spec.rb
delete mode 100644 spec/models/factory/target_image.rb
create mode 100644 spec/models/factory/target_image_spec.rb
diff --git a/spec/models/factory/base.rb b/spec/models/factory/base.rb
deleted file mode 100644
index 86b8a70..0000000
--- a/spec/models/factory/base.rb
+++ /dev/null
@@ -1,82 +0,0 @@
-#
-# Copyright 2011 Red Hat, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-require 'spec_helper'
-require 'timecop'
-
-describe Aeolus::Image::Factory::Base do
-
- before(:each) do
- Timecop.travel(Time.local(2011, 10, 17, 13, 38, 20))
- end
-
- after(:each) do
- Timecop.return
- end
-
- it "should not use_oauth? if configuration is missing" do
- Aeolus::Image::Factory::Base.config = {
- :site => 'http://127.0.0.1:8075/imagefactory'
- }
- Aeolus::Image::Factory::Base.use_oauth?.should be_false
- end
-
- it "should use_oauth? if configuration is present" do
- Aeolus::Image::Factory::Base.config = {
- :site => 'http://127.0.0.1:8075/imagefactory',
- :consumer_key => 'something',
- :consumer_secret => 'anything'
- }
- Aeolus::Image::Factory::Base.use_oauth?.should be_true
- end
-
- it "should succeed with valid OAuth credentials" do
- Aeolus::Image::Factory::Base.config = {
- :site => 'http://127.0.0.1:8075/imagefactory',
- :consumer_key => 'mock-key',
- :consumer_secret => 'mock-secret'
- }
- template = "<template>\n <name>f14jeos</name>\n <os>\n <name>Fedora</name>\n <version>14</version>\n <arch>x86_64</arch>\n <install type='url'>\n <url>http://download.fedoraproject.org/pub/fedora/linux/releases/14/Fedora/x86_64/os/</url>\n </install>\n </os>\n <description>Fedora 14</description>\n</template>\n"
- img = Aeolus::Image::Factory::Image.new(:targets => 'ec2', :template => template)
- img.save!.should be_true
- end
-
- it "should fail with invalid OAuth credentials" do
- Aeolus::Image::Factory::Base.config = {
- :site => 'http://127.0.0.1:8075/imagefactory',
- :consumer_key => 'mock-key',
- :consumer_secret => 'wrong-secret'
- }
- template = "<template>\n <name>f14jeos</name>\n <os>\n <name>Fedora 2</name>\n <version>14</version>\n <arch>x86_64</arch>\n <install type='url'>\n <url>http://download.fedoraproject.org/pub/fedora/linux/releases/14/Fedora/x86_64/os/</url>\n </install>\n </os>\n <description>Fedora 14</description>\n</template>\n"
- img = Aeolus::Image::Factory::Image.new(:targets => 'ec2', :template => template)
- lambda {
- img.save!
- }.should raise_error(ActiveResource::UnauthorizedAccess)
- end
-
- it "should fail with no OAuth credentials" do
- Aeolus::Image::Factory::Base.config = {
- :site => 'http://127.0.0.1:8075/imagefactory'
- }
- template = "<template>\n <name>f14jeos</name>\n <os>\n <name>Fedora 3</name>\n <version>14</version>\n <arch>x86_64</arch>\n <install type='url'>\n <url>http://download.fedoraproject.org/pub/fedora/linux/releases/14/Fedora/x86_64/os/</url>\n </install>\n </os>\n <description>Fedora 14</description>\n</template>\n"
- img = Aeolus::Image::Factory::Image.new(:targets => 'ec2', :template => template)
- # ServerError is actually not what _should_ be returned, but a bug means that's what we get at the moment.
- # When the bug is fixed, we need to update to test for that.
- lambda {
- img.save!.should be_false
- }.should raise_error(ActiveResource::ServerError)
- end
-
-end
diff --git a/spec/models/factory/base_spec.rb b/spec/models/factory/base_spec.rb
new file mode 100644
index 0000000..86b8a70
--- /dev/null
+++ b/spec/models/factory/base_spec.rb
@@ -0,0 +1,82 @@
+#
+# Copyright 2011 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+require 'spec_helper'
+require 'timecop'
+
+describe Aeolus::Image::Factory::Base do
+
+ before(:each) do
+ Timecop.travel(Time.local(2011, 10, 17, 13, 38, 20))
+ end
+
+ after(:each) do
+ Timecop.return
+ end
+
+ it "should not use_oauth? if configuration is missing" do
+ Aeolus::Image::Factory::Base.config = {
+ :site => 'http://127.0.0.1:8075/imagefactory'
+ }
+ Aeolus::Image::Factory::Base.use_oauth?.should be_false
+ end
+
+ it "should use_oauth? if configuration is present" do
+ Aeolus::Image::Factory::Base.config = {
+ :site => 'http://127.0.0.1:8075/imagefactory',
+ :consumer_key => 'something',
+ :consumer_secret => 'anything'
+ }
+ Aeolus::Image::Factory::Base.use_oauth?.should be_true
+ end
+
+ it "should succeed with valid OAuth credentials" do
+ Aeolus::Image::Factory::Base.config = {
+ :site => 'http://127.0.0.1:8075/imagefactory',
+ :consumer_key => 'mock-key',
+ :consumer_secret => 'mock-secret'
+ }
+ template = "<template>\n <name>f14jeos</name>\n <os>\n <name>Fedora</name>\n <version>14</version>\n <arch>x86_64</arch>\n <install type='url'>\n <url>http://download.fedoraproject.org/pub/fedora/linux/releases/14/Fedora/x86_64/os/</url>\n </install>\n </os>\n <description>Fedora 14</description>\n</template>\n"
+ img = Aeolus::Image::Factory::Image.new(:targets => 'ec2', :template => template)
+ img.save!.should be_true
+ end
+
+ it "should fail with invalid OAuth credentials" do
+ Aeolus::Image::Factory::Base.config = {
+ :site => 'http://127.0.0.1:8075/imagefactory',
+ :consumer_key => 'mock-key',
+ :consumer_secret => 'wrong-secret'
+ }
+ template = "<template>\n <name>f14jeos</name>\n <os>\n <name>Fedora 2</name>\n <version>14</version>\n <arch>x86_64</arch>\n <install type='url'>\n <url>http://download.fedoraproject.org/pub/fedora/linux/releases/14/Fedora/x86_64/os/</url>\n </install>\n </os>\n <description>Fedora 14</description>\n</template>\n"
+ img = Aeolus::Image::Factory::Image.new(:targets => 'ec2', :template => template)
+ lambda {
+ img.save!
+ }.should raise_error(ActiveResource::UnauthorizedAccess)
+ end
+
+ it "should fail with no OAuth credentials" do
+ Aeolus::Image::Factory::Base.config = {
+ :site => 'http://127.0.0.1:8075/imagefactory'
+ }
+ template = "<template>\n <name>f14jeos</name>\n <os>\n <name>Fedora 3</name>\n <version>14</version>\n <arch>x86_64</arch>\n <install type='url'>\n <url>http://download.fedoraproject.org/pub/fedora/linux/releases/14/Fedora/x86_64/os/</url>\n </install>\n </os>\n <description>Fedora 14</description>\n</template>\n"
+ img = Aeolus::Image::Factory::Image.new(:targets => 'ec2', :template => template)
+ # ServerError is actually not what _should_ be returned, but a bug means that's what we get at the moment.
+ # When the bug is fixed, we need to update to test for that.
+ lambda {
+ img.save!.should be_false
+ }.should raise_error(ActiveResource::ServerError)
+ end
+
+end
diff --git a/spec/models/factory/builder.rb b/spec/models/factory/builder.rb
deleted file mode 100644
index 8714244..0000000
--- a/spec/models/factory/builder.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Copyright 2011 Red Hat, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-require 'spec_helper'
-require 'timecop'
-
-describe Aeolus::Image::Factory::Builder do
- VCR::Cassette.new 'builder', :record => :new_episodes, :match_requests_on => [:method, :uri, :body]
- it "should get builder object" do
- Aeolus::Image::Factory::Base.config = {
- :site => 'http://127.0.0.1:8075/imagefactory'
- }
- builder = Aeolus::Image::Factory::Builder.first
- builder.builders.should_not be_empty
- build = builder.builders.first
- builder.find_active_build(build.build_id, build.target).should_not be_nil
- builder.find_active_build(build.build_id, 'invalid_target').should be_nil
- end
-end
diff --git a/spec/models/factory/builder_spec.rb b/spec/models/factory/builder_spec.rb
new file mode 100644
index 0000000..8714244
--- /dev/null
+++ b/spec/models/factory/builder_spec.rb
@@ -0,0 +1,31 @@
+#
+# Copyright 2011 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+require 'spec_helper'
+require 'timecop'
+
+describe Aeolus::Image::Factory::Builder do
+ VCR::Cassette.new 'builder', :record => :new_episodes, :match_requests_on => [:method, :uri, :body]
+ it "should get builder object" do
+ Aeolus::Image::Factory::Base.config = {
+ :site => 'http://127.0.0.1:8075/imagefactory'
+ }
+ builder = Aeolus::Image::Factory::Builder.first
+ builder.builders.should_not be_empty
+ build = builder.builders.first
+ builder.find_active_build(build.build_id, build.target).should_not be_nil
+ builder.find_active_build(build.build_id, 'invalid_target').should be_nil
+ end
+end
diff --git a/spec/models/factory/provider_image.rb b/spec/models/factory/provider_image.rb
deleted file mode 100644
index 98983be..0000000
--- a/spec/models/factory/provider_image.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-require 'spec_helper'
-
-module Aeolus
- module Image
- module Factory
- describe ProviderImage do
- it "should return nil when a builder is found but operation is build" do
- @builder = mock(Builder, :operation => "build", :status => "PUSHING")
- Builder.stub!(:find).and_return(@builder)
- ProviderImage.status("1234").should == nil
- end
-
- it "should return a builder when a builder is found and operation is push" do
- @builder = mock(Builder, :operation => "push", :status => "PUSHING")
- Builder.stub!(:find).and_return(@builder)
- ProviderImage.status("1234").should == "PUSHING"
- end
- end
- end
- end
-end
\ No newline at end of file
diff --git a/spec/models/factory/provider_image_spec.rb b/spec/models/factory/provider_image_spec.rb
new file mode 100644
index 0000000..98983be
--- /dev/null
+++ b/spec/models/factory/provider_image_spec.rb
@@ -0,0 +1,21 @@
+require 'spec_helper'
+
+module Aeolus
+ module Image
+ module Factory
+ describe ProviderImage do
+ it "should return nil when a builder is found but operation is build" do
+ @builder = mock(Builder, :operation => "build", :status => "PUSHING")
+ Builder.stub!(:find).and_return(@builder)
+ ProviderImage.status("1234").should == nil
+ end
+
+ it "should return a builder when a builder is found and operation is push" do
+ @builder = mock(Builder, :operation => "push", :status => "PUSHING")
+ Builder.stub!(:find).and_return(@builder)
+ ProviderImage.status("1234").should == "PUSHING"
+ end
+ end
+ end
+ end
+end
\ No newline at end of file
diff --git a/spec/models/factory/target_image.rb b/spec/models/factory/target_image.rb
deleted file mode 100644
index c88295c..0000000
--- a/spec/models/factory/target_image.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-require 'spec_helper'
-
-module Aeolus
- module Image
- module Factory
- describe TargetImage do
- it "should return nil when a builder is found but operation is push" do
- @builder = mock(Builder, :operation => "push")
- Builder.stub!(:find).and_return(@builder)
- TargetImage.status("1234").should == nil
- end
-
- it "should return a builder when a builder is found and operation is build" do
- @builder = mock(Builder, :operation => "build", :status => "BUILDING")
- Builder.stub!(:find).and_return(@builder)
- TargetImage.status("1234").should == "BUILDING"
- end
- end
- end
- end
-end
\ No newline at end of file
diff --git a/spec/models/factory/target_image_spec.rb b/spec/models/factory/target_image_spec.rb
new file mode 100644
index 0000000..c88295c
--- /dev/null
+++ b/spec/models/factory/target_image_spec.rb
@@ -0,0 +1,21 @@
+require 'spec_helper'
+
+module Aeolus
+ module Image
+ module Factory
+ describe TargetImage do
+ it "should return nil when a builder is found but operation is push" do
+ @builder = mock(Builder, :operation => "push")
+ Builder.stub!(:find).and_return(@builder)
+ TargetImage.status("1234").should == nil
+ end
+
+ it "should return a builder when a builder is found and operation is build" do
+ @builder = mock(Builder, :operation => "build", :status => "BUILDING")
+ Builder.stub!(:find).and_return(@builder)
+ TargetImage.status("1234").should == "BUILDING"
+ end
+ end
+ end
+ end
+end
\ No newline at end of file
--
1.7.7.6
More information about the aeolus-devel
mailing list