spec/sugar-high/arguments_spec.rb in sugar-high-0.2.6 vs spec/sugar-high/arguments_spec.rb in sugar-high-0.2.7
- old
+ new
@@ -20,9 +20,37 @@
it "should return arg list with 'hello', 'you'" do
[:hello, ['you']].args.should == ['hello', 'you']
end
end
+ describe "Last argument" do
+ context 'Last arg with default hello' do
+ it "should return the default :hello" do
+ last_arg(:hello, 3,4).should == :hello
+ end
+
+ it "should return the :hello => 'abe' " do
+ last_arg({:hi => :def}, 3,4, :hi => 'abe').should == {:hi => 'abe'}
+ end
+ end
+ end
+
+ describe "Last argument value" do
+ context 'Last arg with default hello' do
+ it "should return the arg value 'abe' " do
+ last_arg_value({:hi => :def}, 3,4, :hi => 'abe').should == 'abe'
+ end
+
+ it "should return the arg value :def " do
+ last_arg_value({:hi => :def}, :hello => 'abe', :good => true).should == :def
+ end
+
+ it "should return the arg value :def " do
+ last_arg_value({:hi => :def}, 3,4 ).should == :def
+ end
+ end
+ end
+
describe "Last option" do
context 'Last arg is Hash' do
it "should return the last hash" do
last_option(3,4, :x => 3, :y => 5).should == {:x => 3, :y => 5}
end