wombat 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -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