Skip to content

Commit

Permalink
Add missing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyStabler committed Oct 14, 2017
1 parent 9a3bed2 commit ed3184b
Showing 1 changed file with 43 additions and 1 deletion.
44 changes: 43 additions & 1 deletion spec/models/entry_filter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,54 @@
filter.projects
end

it "billed_options" do
it "#billed_options" do
filter = EntryFilter.new

expect(filter.billed_options).to eq([
[I18n.t("entry_filters.not_billed"), false],
[I18n.t("entry_filters.billed"), true]
])
end

it "#billable_options" do
filter = EntryFilter.new

expect(filter.billable_options).to eq([
[I18n.t("entry_filters.not_billable"), false],
[I18n.t("entry_filters.billable"), true]
])
end

it "#archived_options" do
filter = EntryFilter.new

expect(filter.archived_options).to eq([
[I18n.t("entry_filters.not_archived"), false],
[I18n.t("entry_filters.archived"), true]
])
end

describe "#from_date" do
it "is a DateTime" do
filter = EntryFilter.new(from_date: "14/10/2017")
expect(filter.from_date).to eq DateTime.parse("14/10/2017")
end

it "is nil when there is no from_date" do
filter = EntryFilter.new
expect(filter.from_date).to be_nil
end
end

describe "#to_date" do
it "is a DateTime" do
filter = EntryFilter.new(to_date: "14/10/2017")
expect(filter.to_date).to eq DateTime.parse("14/10/2017")
end

it "is nil when there is no to_date" do
filter = EntryFilter.new
expect(filter.to_date).to be_nil
end
end
end

0 comments on commit ed3184b

Please sign in to comment.