Permalink
Browse files

Flesh out specs for Moonshine::Manifest::Rails#gem.

  • Loading branch information...
technicalpickles committed Oct 7, 2010
1 parent 42deeae commit 3039d2008e7458aa57e13ccab71a331357f9b37b
Showing with 58 additions and 3 deletions.
  1. +1 −1 lib/moonshine/manifest/rails/rails.rb
  2. +13 −2 lib/moonshine/matchers.rb
  3. +44 −0 spec/moonshine/manifest/rails_spec.rb
@@ -185,7 +185,6 @@ def rails_directories
end
end
-private
# Creates package("#{name}") with <tt>:provider</tt> set to <tt>:gem</tt>.
# The given <tt>options[:version]</tt> requirement is tweaked to ensure
# gems aren't reinstalled on each run. <tt>options[:source]</tt> does what
@@ -241,6 +240,7 @@ def gem(name, options = {})
package(name, hash)
end
+ private
def append_system_dependecies(exact_dep, hash) #:nodoc:
#fixup the requires key to be an array
if hash[:require] && !hash[:require].is_a?(Array)
View
@@ -48,7 +48,13 @@ module Matchers
result &&= package.ensure == @version
end
if @provider
- result &&= package.provider == @provider.to_sym
+ @actual_provider = package.provider
+ result &&= @actual_provider == @provider.to_sym
+ end
+
+ if @before
+ @before.each do |type, names|
+ end
end
result
end
@@ -64,7 +70,11 @@ def from_provider(provider)
end
failure_message_for_should do |actual|
- "expected manifest to have package #{expected}, but did not"
+ if @provider
+ "expected manifest to have package #{expected} using #{@provider}, was using #{@actual_provider}"
+ else
+ "expected manifest to have package #{expected}, but did not"
+ end
end
failure_message_for_should_not do |actual|
@@ -138,6 +148,7 @@ def symlinked_to(file)
end
end
+
def in_apache_if_module(contents, some_module)
contents.should =~ /<IfModule #{some_module}>(.*)<\/IfModule>/m
@@ -439,4 +439,48 @@ def search(gem_pattern, platform_only = false)
@manifest.should exec_command('/usr/bin/createdb -O pg_username pg_database')
end
+ describe "#gem" do
+ before do
+ @manifest.gem 'rmagick'
+ end
+ it "uses gem provider for package" do
+ @manifest.should have_package('rmagick').from_provider('gem')
+ end
+
+ it "runs before rails_gem" do
+ package = @manifest.packages['rmagick']
+ package.before.type.should == 'Exec'
+ package.before.title.should == 'rails_gems'
+ end
+
+ it "requires /etc/gemrc" do
+ package = @manifest.packages['rmagick']
+
+ gemrc = package.require.detect do |require|
+ require.title == '/etc/gemrc'
+ end
+
+ gemrc.should_not == nil
+ gemrc.type.should == 'File'
+ end
+
+ it "requires native packages" do
+ package = @manifest.packages['rmagick']
+
+ imagemagick = package.require.detect do |require|
+ require.title == 'imagemagick'
+ end
+
+ imagemagick.should_not == nil
+ imagemagick.type.should == 'Package'
+
+ libmagick9_dev = package.require.detect do |require|
+ require.title == 'libmagick9-dev'
+ end
+
+ libmagick9_dev.should_not == nil
+ libmagick9_dev.type.should == 'Package'
+ end
+ end
+
end

0 comments on commit 3039d20

Please sign in to comment.