lib/micronaut/behaviour.rb in spicycode-micronaut-0.1.6.9 vs lib/micronaut/behaviour.rb in spicycode-micronaut-0.1.6.9.1

- old
+ new

@@ -83,11 +83,14 @@ @metadata[:behaviour][:describes] = args.shift end @metadata[:behaviour][:description] = args.shift || '' @metadata[:behaviour][:name] = "#{describes} #{description}".strip @metadata[:behaviour][:block] = extra_metadata.delete(:behaviour_block) - @metadata[:behaviour][:file_path] = eval("caller(0)[0]", @metadata[:behaviour][:block].binding) + file_path_with_line_num = eval("caller(0)[0]", @metadata[:behaviour][:block].binding) + @metadata[:behaviour][:file_path_with_line_number] = file_path_with_line_num + @metadata[:behaviour][:file_path] = file_path_with_line_num.split(":")[0].strip + @metadata[:behaviour][:line_number] = file_path_with_line_num.split(":")[1].to_i extra_metadata.delete(:behaviour) # Remove it if it is present @metadata.update(extra_metadata) # should this be here? I think it should be in the runner, the only possible @@ -114,9 +117,13 @@ @metadata[:behaviour][:describes] end def self.description @metadata[:behaviour][:description] + end + + def self.file_path + @metadata[:behaviour][:file_path] end def self.describe(*args, &behaviour_block) raise(ArgumentError, "No arguments given. You must a least supply a type or description") if args.empty? raise(ArgumentError, "You must supply a block when calling describe") if behaviour_block.nil? \ No newline at end of file