order = create_integer(options[:order_min], options[:order_max], false)
x = options[:x].sample
order.times{ result << single(factor(options), factor(options), x) }
- result.join("")
+ result.sort_by(&:length).reverse.join("")
end
end
end
subject.stub(:single => @single)
subject.instance_variable_set(:@options, :x => ['x'])
end
-
it do
expression = subject.__send__(:expansion)
expression.should == "#{@single}#{@single}"
end
+ it do
+ subject.should_receive(:single).and_return('x', @single)
+ expression = subject.__send__(:expansion)
+ expression.should == "#{@single}x"
+ end
+ it do
+ subject.should_receive(:single).and_return(@single, 'x')
+ expression = subject.__send__(:expansion)
+ expression.should == "#{@single}x"
+ end
end
end
end