Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hi! I cleaned up your code for you! #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
*.pyc

# Numerous always-ignore extensions
###################
*.diff
*.err
*.orig
*.log
*.rej
*.swo
*.swp
*.vi
*~

*.sass-cache
# Folders to ignore
###################
.hg
.svn
.CVS
# OS or Editor folders
###################
.DS_Store
Icon?
Thumbs.db
ehthumbs.db
nbproject
.cache
.project
.settings
.tmproj
*.esproj
*.sublime-project
*.sublime-workspace
# Dreamweaver added files
###################
_notes
dwsync.xml
# Komodo
###################
*.komodoproject
.komodotools
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ To create a RSS/Atom feed to suck from:
:delete_preview => true, # optional: delete all posts from a feed, before it´s sucked (default -> true)
:url => 'http://example.com/posts.atom')

To create it but sucking from XML resouce index:
To create it but sucking from XML resouce index:

FeedsuckerFeed.create(
:title => 'XML resource index example',
Expand Down
2 changes: 1 addition & 1 deletion rails_generators/feedsucker/feedsucker_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def manifest
def file_name
'create_feedsucker_tables'
end

protected
# Override with your own usage banner.
def banner
Expand Down
2 changes: 1 addition & 1 deletion rails_generators/feedsucker/templates/tasks.rake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace :feedsucker do
desc "Suck (fetch & load) every FeedsuckerFeed source stored at DB"
task :suck_all => :environment do
FeedsuckerFeed.suck_all!
FeedsuckerFeed.suck_all!
end
end
26 changes: 13 additions & 13 deletions spec/models/feedsucker_feed_spec.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

module FeedsuckerMacros
def self.included(receiver)
receiver.extend ExampleGroupMethods
def self.included(receiver)
receiver.extend ExampleGroupMethods
end

module ExampleGroupMethods
def it_should_suck_all_posts_if_no_number_is_given
it "should suck all the posts if no number is given" do
@feed.suck!
@feed.posts.size.should == 5
posts = FeedsuckerFeed.find_by_title(@feed.title).posts
posts.size.should == 5
posts.first.url.should == 'http://example.com/last-blog/last-post'
posts.first.title.should == 'Last Post Title'
posts.first.url.should == 'http://example.com/last-blog/last-post'
posts.first.title.should == 'Last Post Title'
posts.last.title.should == 'First Post Title'
end
end
Expand All @@ -24,10 +24,10 @@ def it_should_suck_only_the_right_number_of_posts
@feed.suck!
FeedsuckerFeed.find_by_title(@feed.title).posts.size.should == 2
@feed.posts.size.should == @feed.number_of_posts
@feed.posts.first.title.should == 'Last Post Title'
@feed.posts.first.title.should == 'Last Post Title'
end
end

def it_should_suck_all_the_posts_if_we_ask_more_posts_than_the_feed_has
it "should suck all the posts if we ask more posts than the feed has" do
@feed.update_attribute(:number_of_posts, 12)
Expand All @@ -53,7 +53,7 @@ def it_should_not_replace_html_entities
@feed.posts.first.content.include?('á').should be_true
end
end

def it_should_not_repeat_old_post_when_not_delete_preview
it "should_not_repeat_old_post_when_not_delete_preview" do
@feed.suck!
Expand All @@ -63,13 +63,13 @@ def it_should_not_repeat_old_post_when_not_delete_preview
@feed.posts.size.should == 5
end
end

def it_should_add_new_post_when_not_delete_preview
it "it_should_add_new_post_when_not_delete_preview" do
@feed.suck!
@feed.posts.size.should == 5
@feed.update_attribute(:delete_preview, false)
FakeWeb.register_uri(:get, @feed.url, :body => File.read(RSS_FILE_2_PATH))
FakeWeb.register_uri(:get, @feed.url, :body => File.read(RSS_FILE_2_PATH))
@feed.suck!
@feed.posts.size.should == 7
end
Expand All @@ -79,12 +79,12 @@ def it_should_add_new_post_when_not_delete_preview_in_xml
@feed.suck!
@feed.posts.size.should == 5
@feed.update_attribute(:delete_preview, false)
FakeWeb.register_uri(:get, @feed.url, :body => File.read(XML_FILE_2_PATH))
FakeWeb.register_uri(:get, @feed.url, :body => File.read(XML_FILE_2_PATH))
@feed.suck!
@feed.posts.size.should == 6
end
end

end
end

Expand All @@ -111,7 +111,7 @@ def it_should_add_new_post_when_not_delete_preview_in_xml

describe FeedsuckerFeed, ' with an XML feed' do
include FeedsuckerMacros

XML_FILE_PATH = (File.dirname(__FILE__) + '/../resources/example.xml')
XML_FILE_2_PATH = (File.dirname(__FILE__) + '/../resources/example_2.xml')
before(:each) do
Expand Down
6 changes: 3 additions & 3 deletions spec/models/feedsucker_post_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

module FeedsuckerPostMacros
def self.included(receiver)
receiver.extend ExampleGroupMethods
def self.included(receiver)
receiver.extend ExampleGroupMethods
end

module ExampleGroupMethods
Expand All @@ -11,7 +11,7 @@ def before_do
@feed_post = FeedsuckerPost.new
end
end

def it_should_strip_standard_tags(field)
it 'should strip "standard" tags' do
@feed_post.send "#{field}=", "<p>Tengo el coraz&#243;n contento, lleno de alegr&#237;a.</p>"
Expand Down
6 changes: 3 additions & 3 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
begin
require File.dirname(__FILE__) + '/../../../../spec/spec_helper'
require File.dirname(__FILE__) + '/../../../../spec/spec_helper'
require 'fakeweb'
rescue LoadError
rescue LoadError
puts "You need to install rspec in your base app and the fakeweb gem in order to run the plugin specs"
exit
exit
end