Skip to content

Commit

Permalink
Convert Date#month to a shared spec
Browse files Browse the repository at this point in the history
  • Loading branch information
herwinw committed Sep 25, 2024
1 parent 9341c0a commit 22ce2cb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 2 additions & 4 deletions library/date/month_spec.rb
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions library/date/shared/month.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 22ce2cb

Please sign in to comment.