Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

name and desc are now set properly

  • Loading branch information...
commit 44558a6393e6f947b599a1ec88ff8f76a1e47bfe 1 parent 018a94a
@amattsmith amattsmith authored
Showing with 35 additions and 2 deletions.
  1. +2 −2 lib/rule_helper.rb
  2. +33 −0 spec/name_desc_opts_spec.rb
View
4 lib/rule_helper.rb
@@ -58,8 +58,8 @@ def AND(*args)
# private
def pop_cur_name_desc_opts
- name = defined?(@cur_name) ? @cur_opts : GeneratedTag.new
- desc = defined?(@cur_desc) ? @cur_opts : ""
+ name = defined?(@cur_name) ? @cur_name : GeneratedTag.new
+ desc = defined?(@cur_desc) ? @cur_desc : ""
opts = defined?(@cur_opts) ? @cur_opts : {}
reset_class_vars
return name, desc, opts.dup
View
33 spec/name_desc_opts_spec.rb
@@ -0,0 +1,33 @@
+require 'spec_helper'
+
+class A
+
+end
+
+include Ruleby::RuleHelper
+
+describe Ruleby::Core::Rule do
+
+ before do
+ name 'test1'
+ desc 'testdesc'
+ opts :priority => 1
+ @name, @desc, @opts = self.send(:pop_cur_name_desc_opts)
+ end
+
+ describe 'name' do
+ it 'should have name "test1"' do
+ @name.should == 'test1'
+ end
+ end
+ describe 'desc' do
+ it 'should have desc "testdesc"' do
+ @desc.should == 'testdesc'
+ end
+ end
+ describe 'opts' do
+ it 'should have opts priority => 1' do
+ @opts.should == {:priority => 1}
+ end
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.