File tree Expand file tree Collapse file tree 2 files changed +90
-0
lines changed
Expand file tree Collapse file tree 2 files changed +90
-0
lines changed Original file line number Diff line number Diff line change 1+ # -*- coding: utf-8 -*-
2+ # Name:: Automatic::Plugin::Filter::GithubFeed
3+ # Author:: Kohei Hasegawa <http://github.com/banyan>
4+ # Created:: Jun 6, 2013
5+ # Updated:: Jun 6, 2013
6+ # Copyright:: Kohei Hasegawa Copyright (c) 2013
7+ # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8+
9+ module Automatic ::Plugin
10+ class FilterGithubFeed
11+
12+ def initialize ( config , pipeline = [ ] )
13+ @config = config
14+ @pipeline = pipeline
15+ end
16+
17+ def run
18+ @return_feeds = [ ]
19+ @pipeline . each { |feeds |
20+ dummyFeeds = [ ]
21+ unless feeds . nil?
22+ feeds . items . each { |feed |
23+ Automatic ::Log . puts ( "info" , "Invoked: FilterGithubFeed" )
24+ dummy = Hashie ::Mash . new
25+ dummy . title = feed . title . content
26+ dummy . link = feed . id . content
27+ dummy . description = feed . content . content
28+ dummyFeeds << dummy
29+ }
30+ end
31+ @return_feeds << Automatic ::FeedParser . create ( dummyFeeds )
32+ }
33+ @pipeline = @return_feeds
34+ end
35+ end
36+ end
Original file line number Diff line number Diff line change 1+ # -*- coding: utf-8 -*-
2+ # Name:: Automatic::Plugin::Filter::GithubFeed
3+ # Author:: Kohei Hasegawa <http://github.com/banyan>
4+ # Created:: Jun 6, 2013
5+ # Updated:: Jun 6, 2013
6+ # Copyright:: Kohei Hasegawa Copyright (c) 2013
7+ # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8+
9+ require File . expand_path ( File . dirname ( __FILE__ ) + '../../../spec_helper' )
10+
11+ require 'filter/github_feed'
12+
13+ describe Automatic ::Plugin ::FilterGithubFeed do
14+ context "with description with filename of tumblr should be renamed 500 to 1280" do
15+ subject {
16+ described_class . new (
17+ { } ,
18+ AutomaticSpec . generate_pipeline {
19+ feed {
20+ 2 . times do |i |
21+ @channel . items << Hashie ::Mash . new (
22+ :title => { :content => "title#{ i } " } ,
23+ :id => { :content => i . to_s } ,
24+ :content => { :content => "description#{ i } " }
25+ )
26+ end
27+ }
28+ }
29+ )
30+ }
31+
32+ describe "#run" do
33+ its ( :run ) { should have ( 1 ) . feeds }
34+
35+ specify {
36+ subject . run
37+
38+ subject . instance_variable_get ( :@pipeline ) [ 0 ] . items [ 0 ] . link
39+ . should == '1'
40+ subject . instance_variable_get ( :@pipeline ) [ 0 ] . items [ 0 ] . title
41+ . should == 'title1'
42+ subject . instance_variable_get ( :@pipeline ) [ 0 ] . items [ 0 ] . description
43+ . should == 'description1'
44+
45+ subject . instance_variable_get ( :@pipeline ) [ 0 ] . items [ 1 ] . link
46+ . should == '0'
47+ subject . instance_variable_get ( :@pipeline ) [ 0 ] . items [ 1 ] . title
48+ . should == 'title0'
49+ subject . instance_variable_get ( :@pipeline ) [ 0 ] . items [ 1 ] . description
50+ . should == 'description0'
51+ }
52+ end
53+ end
54+ end
You can’t perform that action at this time.
0 commit comments