wombat 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +1 -4
- data/Gemfile +4 -0
- data/Gemfile.lock +11 -0
- data/README.md +22 -0
- data/VERSION +1 -1
- data/fixtures/vcr_cassettes/basic_crawler_page.yml +600 -0
- data/lib/wombat/crawler.rb +20 -17
- data/lib/wombat/metadata.rb +7 -17
- data/lib/wombat/parser.rb +6 -4
- data/lib/wombat/property_container.rb +44 -0
- data/lib/wombat/property_locator.rb +3 -3
- data/spec/crawler_spec.rb +35 -13
- data/spec/helpers/sample_crawler.rb +27 -8
- data/spec/integration/integration_spec.rb +25 -0
- data/spec/metadata_spec.rb +7 -14
- data/spec/parser_spec.rb +20 -54
- data/spec/property_container_spec.rb +49 -0
- data/spec/property_locator_spec.rb +21 -11
- data/spec/sample_crawler_spec.rb +10 -8
- data/spec/spec_helper.rb +7 -1
- data/wombat.gemspec +20 -6
- metadata +68 -22
- data/README.rdoc +0 -20
- data/lib/wombat/properties.rb +0 -31
- data/spec/properties_spec.rb +0 -31
data/lib/wombat/properties.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
#coding: utf-8
|
2
|
-
require 'wombat/property'
|
3
|
-
|
4
|
-
module Wombat
|
5
|
-
class Properties
|
6
|
-
def initialize
|
7
|
-
@properties = []
|
8
|
-
end
|
9
|
-
|
10
|
-
def method_missing method, *args, &block
|
11
|
-
@properties << Property.new(
|
12
|
-
name: method.to_s,
|
13
|
-
selector: args.first,
|
14
|
-
format: args[1],
|
15
|
-
namespaces: args[2],
|
16
|
-
callback: block)
|
17
|
-
end
|
18
|
-
|
19
|
-
# TODO: Why I need this?????
|
20
|
-
def to_ary
|
21
|
-
end
|
22
|
-
|
23
|
-
def get_property name
|
24
|
-
@properties.detect {|p| p.name == name }
|
25
|
-
end
|
26
|
-
|
27
|
-
def all_properties
|
28
|
-
@properties
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
data/spec/properties_spec.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Wombat::Properties do
|
4
|
-
before(:each) do
|
5
|
-
@props = Wombat::Properties.new
|
6
|
-
end
|
7
|
-
|
8
|
-
it 'should store event properties' do
|
9
|
-
block_executed = false
|
10
|
-
@props.title "/my/custom/selector", :text, { xmlns: "http://whatwg.org/xmlns" } do |x|
|
11
|
-
block_executed = true
|
12
|
-
end
|
13
|
-
|
14
|
-
title = @props.get_property "title"
|
15
|
-
|
16
|
-
title.name.should == "title"
|
17
|
-
title.selector.should == "/my/custom/selector"
|
18
|
-
title.format.should == :text
|
19
|
-
title.namespaces.should == { xmlns: "http://whatwg.org/xmlns" }
|
20
|
-
title.callback.should_not be_nil
|
21
|
-
title.callback.call
|
22
|
-
block_executed.should be_true
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'should return all stored properties' do
|
26
|
-
@props.name "something"
|
27
|
-
@props.date DateTime.now
|
28
|
-
|
29
|
-
@props.all_properties.size.should == 2
|
30
|
-
end
|
31
|
-
end
|