Permalink
Browse files

GH#2 don't tweet if reloading a show

  • Loading branch information...
1 parent 4758b9f commit 4b25e82a1e2d437f3d71c0c4eae94a94881bde5c @tardate committed Jan 2, 2012
Showing with 10 additions and 2 deletions.
  1. +1 −1 lib/navd/scraper/control.rb
  2. +9 −1 spec/lib/scraper/control_spec.rb
@@ -46,7 +46,7 @@ def load_show(number,reload=false)
:description => show_note[:description]
)
end
- notify_new_show(show)
+ notify_new_show(show) unless reload
return true
else
log "#{number}: show already published - cannot reload"
@@ -51,7 +51,11 @@
it "should create show notes" do
expect { subject }.to change { Note.count }.from(0).to(1)
end
- context "when attempting to reload" do
+ it "should attempt to tweet" do
+ scraper_control.should_receive(:notify_new_show).once
+ subject
+ end
+ context "when attempting to load the show again" do
before { scraper_control.load_show(show_number) }
it "should not update the show details" do
Show.any_instance.should_receive(:update_attributes!).never
@@ -65,6 +69,10 @@
Show.any_instance.should_receive(:update_attributes!).once
scraper_control.load_show(show_number,true)
end
+ it "should not attempt to tweet" do
+ scraper_control.should_receive(:notify_new_show).never
+ scraper_control.load_show(show_number,true)
+ end
end
end

0 comments on commit 4b25e82

Please sign in to comment.