Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

find_by_url => find_by_path

removes deprecation warnings
  • Loading branch information...
commit c8631ab14f2d9794967548f7944600bc67a7a0f4 1 parent 672b8e1
@johnmuhl johnmuhl authored
View
8 lib/scheduler/page_extensions.rb
@@ -4,18 +4,18 @@ module Scheduler::PageExtensions
def self.included(base)
base.extend ClassMethods
class << base
- alias_method_chain :find_by_url, :scheduling
+ alias_method_chain :find_by_path, :scheduling
end
end
module ClassMethods
- def find_by_url_with_scheduling(url, live=true)
+ def find_by_path_with_scheduling(url, live=true)
if live
self.with_published_only do
- find_by_url_without_scheduling(url, live)
+ find_by_path_without_scheduling(url, live)
end
else
- find_by_url_without_scheduling(url, live)
+ find_by_path_without_scheduling(url, live)
end
end
View
10 spec/models/page_extensions_spec.rb
@@ -4,27 +4,27 @@
dataset :pages_with_scheduling
describe "finding pages" do
- it "should wrap the find_by_url method" do
- Page.should respond_to(:find_by_url_with_scheduling)
+ it "should wrap the find_by_path method" do
+ Page.should respond_to(:find_by_path_with_scheduling)
end
it "should find visible pages in both modes" do
[true, false].each do |live|
[:blank_schedule, :visible, :visible_blank_start, :visible_blank_end].each do |page|
- Page.find_by_url(pages(page).url, live).should == pages(page)
+ Page.find_by_path(pages(page).url, live).should == pages(page)
end
end
end
it "should not find pages scheduled outside the window when live" do
[:expired, :expired_blank_start, :unappeared, :unappeared_blank_end].each do |page|
- Page.find_by_url(pages(page).url).should_not == pages(page)
+ Page.find_by_path(pages(page).url).should_not == pages(page)
end
end
it "should find pages scheduled outside the window when dev" do
[:expired, :expired_blank_start, :unappeared, :unappeared_blank_end].each do |page|
- Page.find_by_url(pages(page).url, false).should == pages(page)
+ Page.find_by_path(pages(page).url, false).should == pages(page)
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.