Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

Commit

Permalink
Ignore events if they contain the module title anywhere in the summary
Browse files Browse the repository at this point in the history
Prior to this, events would get ignored only if their summary started
with the module title. This caused problems for events that started with
the module code, followed by the title.
  • Loading branch information
leocassarani committed Dec 19, 2011
1 parent 0cc3772 commit bf49f4e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/timetable/calendar.rb
Expand Up @@ -155,7 +155,7 @@ def ignored_names(ignored)
# its #summary string attribute starts with the name of one of
# the modules the user isn't taking
def should_ignore(event)
@ignored.any? { |ign| event.summary =~ /^#{ign}/i }
@ignored.any? { |ign| event.summary =~ /#{ign}/i }
end

# Return true if @course_id is a single-year course
Expand Down
8 changes: 4 additions & 4 deletions spec/timetable/calendar_spec.rb
Expand Up @@ -38,7 +38,7 @@
end
end

context "excluding ignored modules" do
describe "excluding ignored modules" do
let(:course) { "comp" }
let(:year) { 2 }
let(:yoe) do
Expand All @@ -54,7 +54,7 @@
it "returns a calendar containing events relating to those modules" do
calendar.cal.events.any? do |event|
names.any? do |name|
event.summary =~ /^#{name}/i
event.summary =~ /#{name}/i
end
end.should be_true
end
Expand All @@ -66,10 +66,10 @@
it "returns a calendar with no events relating to those modules" do
calendar.cal.events.each do |event|
names.each do |name|
event.summary.should_not match(/^#{name}/i)
event.summary.should_not match(/#{name}/i)
end
end
end
end
end
end
end

0 comments on commit bf49f4e

Please sign in to comment.