gnip-gnip 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +144 -0
- data/Rakefile +221 -0
- data/TODO +72 -0
- data/bin/gnip +651 -0
- data/doc/api.html +1201 -0
- data/gemspec.rb +25 -0
- data/gnip-ruby.gemspec +26 -0
- data/lib/gnip.rb +71 -0
- data/lib/gnip/activity.rb +665 -0
- data/lib/gnip/api.rb +191 -0
- data/lib/gnip/arguments.rb +21 -0
- data/lib/gnip/blankslate.rb +5 -0
- data/lib/gnip/config.rb +144 -0
- data/lib/gnip/filter.rb +311 -0
- data/lib/gnip/list.rb +126 -0
- data/lib/gnip/options.rb +96 -0
- data/lib/gnip/orderedhash.rb +199 -0
- data/lib/gnip/publisher.rb +316 -0
- data/lib/gnip/resource.rb +301 -0
- data/lib/gnip/template.rb +44 -0
- data/lib/gnip/util.rb +120 -0
- data/sample/data/activity.yml +21 -0
- data/test/auth.rb +60 -0
- data/test/config.yml +2 -0
- data/test/data/activity.xml +14 -0
- data/test/data/activity_only_required.xml +4 -0
- data/test/data/activity_with_payload.xml +22 -0
- data/test/data/activity_with_place.xml +18 -0
- data/test/data/activity_with_place_wo_bounds.xml +36 -0
- data/test/data/activity_with_unbounded_media_urls.xml +44 -0
- data/test/data/activity_without_bounds.xml +24 -0
- data/test/helper.rb +115 -0
- data/test/integration/auth.rb +12 -0
- data/test/integration/publisher.rb +86 -0
- data/test/lib/shoulda.rb +9 -0
- data/test/lib/shoulda/action_controller.rb +28 -0
- data/test/lib/shoulda/action_controller/helpers.rb +47 -0
- data/test/lib/shoulda/action_controller/macros.rb +277 -0
- data/test/lib/shoulda/action_controller/matchers.rb +37 -0
- data/test/lib/shoulda/action_controller/matchers/assign_to_matcher.rb +109 -0
- data/test/lib/shoulda/action_controller/matchers/filter_param_matcher.rb +57 -0
- data/test/lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb +81 -0
- data/test/lib/shoulda/action_controller/matchers/respond_with_content_type_matcher.rb +70 -0
- data/test/lib/shoulda/action_controller/matchers/respond_with_matcher.rb +77 -0
- data/test/lib/shoulda/action_controller/matchers/route_matcher.rb +93 -0
- data/test/lib/shoulda/action_controller/matchers/set_session_matcher.rb +83 -0
- data/test/lib/shoulda/action_controller/matchers/set_the_flash_matcher.rb +85 -0
- data/test/lib/shoulda/action_mailer.rb +10 -0
- data/test/lib/shoulda/action_mailer/assertions.rb +38 -0
- data/test/lib/shoulda/action_view.rb +10 -0
- data/test/lib/shoulda/action_view/macros.rb +56 -0
- data/test/lib/shoulda/active_record.rb +16 -0
- data/test/lib/shoulda/active_record/assertions.rb +69 -0
- data/test/lib/shoulda/active_record/helpers.rb +40 -0
- data/test/lib/shoulda/active_record/macros.rb +586 -0
- data/test/lib/shoulda/active_record/matchers.rb +42 -0
- data/test/lib/shoulda/active_record/matchers/allow_mass_assignment_of_matcher.rb +83 -0
- data/test/lib/shoulda/active_record/matchers/allow_value_matcher.rb +102 -0
- data/test/lib/shoulda/active_record/matchers/association_matcher.rb +226 -0
- data/test/lib/shoulda/active_record/matchers/ensure_inclusion_of_matcher.rb +87 -0
- data/test/lib/shoulda/active_record/matchers/ensure_length_of_matcher.rb +141 -0
- data/test/lib/shoulda/active_record/matchers/have_db_column_matcher.rb +169 -0
- data/test/lib/shoulda/active_record/matchers/have_index_matcher.rb +105 -0
- data/test/lib/shoulda/active_record/matchers/have_named_scope_matcher.rb +125 -0
- data/test/lib/shoulda/active_record/matchers/have_readonly_attribute_matcher.rb +59 -0
- data/test/lib/shoulda/active_record/matchers/validate_acceptance_of_matcher.rb +41 -0
- data/test/lib/shoulda/active_record/matchers/validate_numericality_of_matcher.rb +39 -0
- data/test/lib/shoulda/active_record/matchers/validate_presence_of_matcher.rb +60 -0
- data/test/lib/shoulda/active_record/matchers/validate_uniqueness_of_matcher.rb +148 -0
- data/test/lib/shoulda/active_record/matchers/validation_matcher.rb +56 -0
- data/test/lib/shoulda/assertions.rb +59 -0
- data/test/lib/shoulda/autoload_macros.rb +46 -0
- data/test/lib/shoulda/context.rb +304 -0
- data/test/lib/shoulda/helpers.rb +8 -0
- data/test/lib/shoulda/macros.rb +73 -0
- data/test/lib/shoulda/private_helpers.rb +20 -0
- data/test/lib/shoulda/proc_extensions.rb +14 -0
- data/test/lib/shoulda/rails.rb +13 -0
- data/test/lib/shoulda/rspec.rb +9 -0
- data/test/lib/shoulda/tasks.rb +3 -0
- data/test/lib/shoulda/tasks/list_tests.rake +29 -0
- data/test/lib/shoulda/tasks/yaml_to_shoulda.rake +28 -0
- data/test/lib/shoulda/test_unit.rb +19 -0
- data/test/lib/xmlsimple.rb +1021 -0
- data/test/loader.rb +25 -0
- data/test/unit/activity.rb +26 -0
- data/test/unit/util.rb +39 -0
- metadata +158 -0
data/test/loader.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# sets up the required environment for running tests
|
2
|
+
#
|
3
|
+
$src_dir = File.expand_path(File.dirname(File.dirname(__FILE__)))
|
4
|
+
$lib_dir = File.join($src_dir, 'lib')
|
5
|
+
$test_dir = File.join($src_dir, 'test')
|
6
|
+
$test_lib_dir = File.join($src_dir, 'test', 'lib')
|
7
|
+
$test_data_dir = File.join($src_dir, 'test', 'data')
|
8
|
+
$test_unit_dir = File.join($test_dir, 'unit')
|
9
|
+
$test_unit_lib_dir = File.join($test_unit_dir, 'lib')
|
10
|
+
$test_integration_dir = File.join($test_dir, 'integration')
|
11
|
+
$test_integration_lib_dir = File.join($test_integration_dir, 'lib')
|
12
|
+
$test_config_file = File.join($test_dir, 'config.yml')
|
13
|
+
|
14
|
+
$load_path = [$lib_dir, $test_dir, $test_lib_dir]
|
15
|
+
$load_path.each{|load_path| $LOAD_PATH.unshift(load_path)}
|
16
|
+
ENV['RUBYLIB'] = $LOAD_PATH.join(File::PATH_SEPARATOR)
|
17
|
+
|
18
|
+
Dir.chdir($src_dir)
|
19
|
+
|
20
|
+
require 'test/unit'
|
21
|
+
require 'socket'
|
22
|
+
require File.join($lib_dir, 'gnip')
|
23
|
+
require File.join($test_lib_dir, 'shoulda')
|
24
|
+
require File.join($test_lib_dir, 'xmlsimple')
|
25
|
+
require File.join($test_dir, 'helper')
|
@@ -0,0 +1,26 @@
|
|
1
|
+
Test 'Activty' do
|
2
|
+
should 'initialize with no args' do
|
3
|
+
activity = nil
|
4
|
+
assert_nothing_raised{ assert(activity = Gnip.activity.new) }
|
5
|
+
end
|
6
|
+
|
7
|
+
should 'transitively serialize to and from xml' do
|
8
|
+
glob = File.join($test_data_dir, 'activity*.xml')
|
9
|
+
Dir[glob].each do |activity_xml|
|
10
|
+
expected_xml = IO.read(activity_xml)
|
11
|
+
activity = nil
|
12
|
+
assert_nothing_raised{ activity = Gnip.activity.from_xml(expected_xml) }
|
13
|
+
assert activity
|
14
|
+
actual_xml = nil
|
15
|
+
assert_nothing_raised{
|
16
|
+
begin
|
17
|
+
actual_xml = activity.to_xml
|
18
|
+
xml_cmp!(expected_xml, actual_xml)
|
19
|
+
rescue Object => e
|
20
|
+
STDERR.puts "\n\n # activity_xml=#{ activity_xml }\n\n"
|
21
|
+
raise
|
22
|
+
end
|
23
|
+
}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/test/unit/util.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
Class.new(Test::Unit::TestCase) do
|
2
|
+
context 'util' do
|
3
|
+
setup do
|
4
|
+
assert_nothing_raised{ assert(@util = Gnip.util) }
|
5
|
+
end
|
6
|
+
|
7
|
+
should 'detect the home directory' do
|
8
|
+
assert(test(?d, @util.homedir))
|
9
|
+
end
|
10
|
+
|
11
|
+
should 'unindent strings' do
|
12
|
+
string = "\n\n foobar\n barfoo\n"
|
13
|
+
unindented = @util.unindent(string)
|
14
|
+
assert "\n\nfoobar\nbarfoo\n", unindented
|
15
|
+
assert "\n\nfoobar\nbarfoo\n", @util.unindent!(string)
|
16
|
+
assert "\n\nfoobar\nbarfoo\n", string
|
17
|
+
end
|
18
|
+
|
19
|
+
should 'indent strings' do
|
20
|
+
string = "\n\n foobar\n barfoo\n"
|
21
|
+
indented = @util.indent(string, 1)
|
22
|
+
assert "\n\n foobar\n barfoo\n", indented
|
23
|
+
indented = @util.indent(string, 3)
|
24
|
+
assert "\n\n foobar\n barfoo\n", indented
|
25
|
+
indented = @util.indent!(string, 3)
|
26
|
+
assert "\n\n foobar\n barfoo\n", indented
|
27
|
+
assert "\n\n foobar\n barfoo\n", string
|
28
|
+
end
|
29
|
+
|
30
|
+
should 'inline strings' do
|
31
|
+
string = "\n\n foobar\n barfoo\n"
|
32
|
+
inlined = @util.inline(string)
|
33
|
+
assert "foobar barfoo", inlined
|
34
|
+
inlined = @util.inline!(string)
|
35
|
+
assert "foobar barfoo", inlined
|
36
|
+
assert "foobar barfoo", string
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
metadata
ADDED
@@ -0,0 +1,158 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gnip-gnip
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ara T. Howard
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-05-16 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description:
|
17
|
+
email: ara.t.howard@gmail.com
|
18
|
+
executables:
|
19
|
+
- gnip
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
24
|
+
files:
|
25
|
+
- bin
|
26
|
+
- bin/gnip
|
27
|
+
- doc
|
28
|
+
- doc/api.html
|
29
|
+
- gemspec.rb
|
30
|
+
- gnip-ruby.gemspec
|
31
|
+
- lib
|
32
|
+
- lib/gnip
|
33
|
+
- lib/gnip/activity.rb
|
34
|
+
- lib/gnip/api.rb
|
35
|
+
- lib/gnip/arguments.rb
|
36
|
+
- lib/gnip/blankslate.rb
|
37
|
+
- lib/gnip/config.rb
|
38
|
+
- lib/gnip/filter.rb
|
39
|
+
- lib/gnip/list.rb
|
40
|
+
- lib/gnip/options.rb
|
41
|
+
- lib/gnip/orderedhash.rb
|
42
|
+
- lib/gnip/publisher.rb
|
43
|
+
- lib/gnip/resource.rb
|
44
|
+
- lib/gnip/template.rb
|
45
|
+
- lib/gnip/util.rb
|
46
|
+
- lib/gnip.rb
|
47
|
+
- Rakefile
|
48
|
+
- README
|
49
|
+
- sample
|
50
|
+
- sample/data
|
51
|
+
- sample/data/activity.yml
|
52
|
+
- test
|
53
|
+
- test/auth.rb
|
54
|
+
- test/config.yml
|
55
|
+
- test/data
|
56
|
+
- test/data/activity.xml
|
57
|
+
- test/data/activity_only_required.xml
|
58
|
+
- test/data/activity_with_payload.xml
|
59
|
+
- test/data/activity_with_place.xml
|
60
|
+
- test/data/activity_with_place_wo_bounds.xml
|
61
|
+
- test/data/activity_with_unbounded_media_urls.xml
|
62
|
+
- test/data/activity_without_bounds.xml
|
63
|
+
- test/helper.rb
|
64
|
+
- test/integration
|
65
|
+
- test/integration/auth.rb
|
66
|
+
- test/integration/publisher.rb
|
67
|
+
- test/lib
|
68
|
+
- test/lib/shoulda
|
69
|
+
- test/lib/shoulda/action_controller
|
70
|
+
- test/lib/shoulda/action_controller/helpers.rb
|
71
|
+
- test/lib/shoulda/action_controller/macros.rb
|
72
|
+
- test/lib/shoulda/action_controller/matchers
|
73
|
+
- test/lib/shoulda/action_controller/matchers/assign_to_matcher.rb
|
74
|
+
- test/lib/shoulda/action_controller/matchers/filter_param_matcher.rb
|
75
|
+
- test/lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb
|
76
|
+
- test/lib/shoulda/action_controller/matchers/respond_with_content_type_matcher.rb
|
77
|
+
- test/lib/shoulda/action_controller/matchers/respond_with_matcher.rb
|
78
|
+
- test/lib/shoulda/action_controller/matchers/route_matcher.rb
|
79
|
+
- test/lib/shoulda/action_controller/matchers/set_session_matcher.rb
|
80
|
+
- test/lib/shoulda/action_controller/matchers/set_the_flash_matcher.rb
|
81
|
+
- test/lib/shoulda/action_controller/matchers.rb
|
82
|
+
- test/lib/shoulda/action_controller.rb
|
83
|
+
- test/lib/shoulda/action_mailer
|
84
|
+
- test/lib/shoulda/action_mailer/assertions.rb
|
85
|
+
- test/lib/shoulda/action_mailer.rb
|
86
|
+
- test/lib/shoulda/action_view
|
87
|
+
- test/lib/shoulda/action_view/macros.rb
|
88
|
+
- test/lib/shoulda/action_view.rb
|
89
|
+
- test/lib/shoulda/active_record
|
90
|
+
- test/lib/shoulda/active_record/assertions.rb
|
91
|
+
- test/lib/shoulda/active_record/helpers.rb
|
92
|
+
- test/lib/shoulda/active_record/macros.rb
|
93
|
+
- test/lib/shoulda/active_record/matchers
|
94
|
+
- test/lib/shoulda/active_record/matchers/allow_mass_assignment_of_matcher.rb
|
95
|
+
- test/lib/shoulda/active_record/matchers/allow_value_matcher.rb
|
96
|
+
- test/lib/shoulda/active_record/matchers/association_matcher.rb
|
97
|
+
- test/lib/shoulda/active_record/matchers/ensure_inclusion_of_matcher.rb
|
98
|
+
- test/lib/shoulda/active_record/matchers/ensure_length_of_matcher.rb
|
99
|
+
- test/lib/shoulda/active_record/matchers/have_db_column_matcher.rb
|
100
|
+
- test/lib/shoulda/active_record/matchers/have_index_matcher.rb
|
101
|
+
- test/lib/shoulda/active_record/matchers/have_named_scope_matcher.rb
|
102
|
+
- test/lib/shoulda/active_record/matchers/have_readonly_attribute_matcher.rb
|
103
|
+
- test/lib/shoulda/active_record/matchers/validate_acceptance_of_matcher.rb
|
104
|
+
- test/lib/shoulda/active_record/matchers/validate_numericality_of_matcher.rb
|
105
|
+
- test/lib/shoulda/active_record/matchers/validate_presence_of_matcher.rb
|
106
|
+
- test/lib/shoulda/active_record/matchers/validate_uniqueness_of_matcher.rb
|
107
|
+
- test/lib/shoulda/active_record/matchers/validation_matcher.rb
|
108
|
+
- test/lib/shoulda/active_record/matchers.rb
|
109
|
+
- test/lib/shoulda/active_record.rb
|
110
|
+
- test/lib/shoulda/assertions.rb
|
111
|
+
- test/lib/shoulda/autoload_macros.rb
|
112
|
+
- test/lib/shoulda/context.rb
|
113
|
+
- test/lib/shoulda/helpers.rb
|
114
|
+
- test/lib/shoulda/macros.rb
|
115
|
+
- test/lib/shoulda/private_helpers.rb
|
116
|
+
- test/lib/shoulda/proc_extensions.rb
|
117
|
+
- test/lib/shoulda/rails.rb
|
118
|
+
- test/lib/shoulda/rspec.rb
|
119
|
+
- test/lib/shoulda/tasks
|
120
|
+
- test/lib/shoulda/tasks/list_tests.rake
|
121
|
+
- test/lib/shoulda/tasks/yaml_to_shoulda.rake
|
122
|
+
- test/lib/shoulda/tasks.rb
|
123
|
+
- test/lib/shoulda/test_unit.rb
|
124
|
+
- test/lib/shoulda.rb
|
125
|
+
- test/lib/xmlsimple.rb
|
126
|
+
- test/loader.rb
|
127
|
+
- test/unit
|
128
|
+
- test/unit/activity.rb
|
129
|
+
- test/unit/util.rb
|
130
|
+
- TODO
|
131
|
+
has_rdoc: true
|
132
|
+
homepage: http://github.com/ahoward/gnip/tree/master
|
133
|
+
post_install_message:
|
134
|
+
rdoc_options: []
|
135
|
+
|
136
|
+
require_paths:
|
137
|
+
- lib
|
138
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: "0"
|
143
|
+
version:
|
144
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - ">="
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: "0"
|
149
|
+
version:
|
150
|
+
requirements: []
|
151
|
+
|
152
|
+
rubyforge_project: codeforpeople
|
153
|
+
rubygems_version: 1.2.0
|
154
|
+
signing_key:
|
155
|
+
specification_version: 2
|
156
|
+
summary: gnip
|
157
|
+
test_files: []
|
158
|
+
|