diff --git a/library/date/month_spec.rb b/library/date/month_spec.rb index e040f9a94..f493ec811 100644 --- a/library/date/month_spec.rb +++ b/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/library/date/shared/month.rb b/library/date/shared/month.rb new file mode 100644 index 000000000..5fcb2cbeb --- /dev/null +++ b/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