Permalink
Browse files

added tests for command access in facets

Signed-off-by: Bradley Grzesiak <listrophy@gmail.com>
  • Loading branch information...
1 parent 9e5861c commit 6fd6bba0bf95b0621ad7197413fb9899479c2044 @angelic angelic committed with Dec 20, 2008
Showing with 65 additions and 0 deletions.
  1. +65 −0 test/test_facets.rb
View
65 test/test_facets.rb
@@ -0,0 +1,65 @@
+require File.dirname(__FILE__) + '/../lib/runner.rb'
+require 'test/unit' unless defined? $ZENTEST and $ZENTEST
+require 'rubygems'
+require 'mocha'
+
+class TestFacets < Test::Unit::TestCase
+
+ Facet.define 'facet_name' do; end
+
+ def setup
+ Runner.new('test_app')
+ @facet = Facet.registered_facets['facet_name']
+ end
+
+ def test_generate
+ @facet.expects(:runinside).with('script/generate model ')
+ @facet.generate('model')
+ end
+
+ def test_generate_with_options
+ @facet.expects(:runinside).with('script/generate model user ')
+ @facet.generate('model user')
+ end
+
+ def test_generate_with_options_as_symbols
+ @facet.expects(:runinside).with('script/generate model user')
+ @facet.generate(:model, :user)
+ end
+
+ def test_svn
+ @facet.expects(:runinside).with('svnadmin create')
+ @facet.svn
+ end
+
+ def test_git
+ @facet.expects(:runinside).with('git init')
+ @facet.git
+ end
+
+ def test_plugin
+ @facet.expects(:runinside).with('script/plugin install a')
+ @facet.plugin('a')
+ end
+
+ def test_rake
+ @facet.expects(:runinside).with('rake ')
+ @facet.rake()
+ end
+
+ def test_rake_with_options
+ @facet.expects(:runinside).with('rake test')
+ @facet.rake('test')
+ end
+
+ def test_runinside
+ @facet.expects(:shell).with( "cd test_app; cmd")
+ @facet.runinside('cmd')
+ end
+
+ def test_runinside_with_options
+ @facet.expects(:shell).with( "cd test_app; cmd a b")
+ @facet.runinside('cmd a b')
+ end
+
+end

0 comments on commit 6fd6bba

Please sign in to comment.