test/mayl/commands/cd_test.rb in mayl-0.1.0 vs test/mayl/commands/cd_test.rb in mayl-0.2.0
- old
+ new
@@ -10,23 +10,32 @@
@env = OpenStruct.new(locales: @locales, namespace: 'activerecord.models')
end
it 'enters a directory' do
@command = Cd.new @env, 'post.attributes'
+ @command.stubs(:check_namespace!)
@command.execute
@env.namespace.must_equal 'activerecord.models.post.attributes'
end
it 'goes down one level' do
@command = Cd.new @env, '..'
+ @command.stubs(:check_namespace!)
@command.execute
@env.namespace.must_equal 'activerecord'
end
it 'goes to the root level' do
@command = Cd.new @env, '.'
+ @command.stubs(:check_namespace!)
@command.execute
@env.namespace.must_equal ''
+ end
+
+ it 'does not enter leaves' do
+ @env.stubs(:peek).returns []
+ @command = Cd.new @env, 'activerecord.models.post'
+ proc { @command.execute }.must_raise ArgumentError
end
end
end
end