diff --git a/spec/library/date/mon_spec.rb b/spec/library/date/mon_spec.rb new file mode 100644 index 000000000..616d72cf8 --- /dev/null +++ b/spec/library/date/mon_spec.rb @@ -0,0 +1,7 @@ +require_relative '../../spec_helper' +require_relative 'shared/month' +require 'date' + +describe "Date#mon" do + it_behaves_like :date_month, :mon +end diff --git a/spec/library/date/month_spec.rb b/spec/library/date/month_spec.rb index e040f9a94..f493ec811 100644 --- a/spec/library/date/month_spec.rb +++ b/spec/library/date/month_spec.rb @@ -1,9 +1,7 @@ require_relative '../../spec_helper' +require_relative 'shared/month' require 'date' describe "Date#month" do - it "returns the month" do - m = Date.new(2000, 7, 1).month - m.should == 7 - end + it_behaves_like :date_month, :month end diff --git a/spec/library/date/shared/month.rb b/spec/library/date/shared/month.rb new file mode 100644 index 000000000..5fcb2cbeb --- /dev/null +++ b/spec/library/date/shared/month.rb @@ -0,0 +1,6 @@ +describe :date_month, shared: true do + it "returns the month" do + m = Date.new(2000, 7, 1).send(@method) + m.should == 7 + end +end