gnip 0.4.2

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.
Files changed (89) hide show
  1. data/README +144 -0
  2. data/Rakefile +53 -0
  3. data/TODO +72 -0
  4. data/bin/gnip +651 -0
  5. data/doc/api.html +1201 -0
  6. data/gemspec.rb +47 -0
  7. data/gnip-0.4.2.gem +0 -0
  8. data/lib/gnip.rb +71 -0
  9. data/lib/gnip/activity.rb +663 -0
  10. data/lib/gnip/api.rb +191 -0
  11. data/lib/gnip/arguments.rb +21 -0
  12. data/lib/gnip/blankslate.rb +5 -0
  13. data/lib/gnip/config.rb +144 -0
  14. data/lib/gnip/filter.rb +304 -0
  15. data/lib/gnip/list.rb +126 -0
  16. data/lib/gnip/options.rb +96 -0
  17. data/lib/gnip/orderedhash.rb +199 -0
  18. data/lib/gnip/publisher.rb +309 -0
  19. data/lib/gnip/resource.rb +301 -0
  20. data/lib/gnip/template.rb +44 -0
  21. data/lib/gnip/util.rb +120 -0
  22. data/sample/data/activity.yml +21 -0
  23. data/test/auth.rb +60 -0
  24. data/test/config.yml +2 -0
  25. data/test/data/activity.xml +14 -0
  26. data/test/data/activity_only_required.xml +4 -0
  27. data/test/data/activity_with_payload.xml +22 -0
  28. data/test/data/activity_with_place.xml +18 -0
  29. data/test/data/activity_with_place_wo_bounds.xml +36 -0
  30. data/test/data/activity_with_unbounded_media_urls.xml +44 -0
  31. data/test/data/activity_without_bounds.xml +24 -0
  32. data/test/helper.rb +115 -0
  33. data/test/helper.rb.bak +28 -0
  34. data/test/integration/auth.rb +12 -0
  35. data/test/integration/publisher.rb +86 -0
  36. data/test/lib/shoulda.rb +9 -0
  37. data/test/lib/shoulda/action_controller.rb +28 -0
  38. data/test/lib/shoulda/action_controller/helpers.rb +47 -0
  39. data/test/lib/shoulda/action_controller/macros.rb +277 -0
  40. data/test/lib/shoulda/action_controller/matchers.rb +37 -0
  41. data/test/lib/shoulda/action_controller/matchers/assign_to_matcher.rb +109 -0
  42. data/test/lib/shoulda/action_controller/matchers/filter_param_matcher.rb +57 -0
  43. data/test/lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb +81 -0
  44. data/test/lib/shoulda/action_controller/matchers/respond_with_content_type_matcher.rb +70 -0
  45. data/test/lib/shoulda/action_controller/matchers/respond_with_matcher.rb +77 -0
  46. data/test/lib/shoulda/action_controller/matchers/route_matcher.rb +93 -0
  47. data/test/lib/shoulda/action_controller/matchers/set_session_matcher.rb +83 -0
  48. data/test/lib/shoulda/action_controller/matchers/set_the_flash_matcher.rb +85 -0
  49. data/test/lib/shoulda/action_mailer.rb +10 -0
  50. data/test/lib/shoulda/action_mailer/assertions.rb +38 -0
  51. data/test/lib/shoulda/action_view.rb +10 -0
  52. data/test/lib/shoulda/action_view/macros.rb +56 -0
  53. data/test/lib/shoulda/active_record.rb +16 -0
  54. data/test/lib/shoulda/active_record/assertions.rb +69 -0
  55. data/test/lib/shoulda/active_record/helpers.rb +40 -0
  56. data/test/lib/shoulda/active_record/macros.rb +586 -0
  57. data/test/lib/shoulda/active_record/matchers.rb +42 -0
  58. data/test/lib/shoulda/active_record/matchers/allow_mass_assignment_of_matcher.rb +83 -0
  59. data/test/lib/shoulda/active_record/matchers/allow_value_matcher.rb +102 -0
  60. data/test/lib/shoulda/active_record/matchers/association_matcher.rb +226 -0
  61. data/test/lib/shoulda/active_record/matchers/ensure_inclusion_of_matcher.rb +87 -0
  62. data/test/lib/shoulda/active_record/matchers/ensure_length_of_matcher.rb +141 -0
  63. data/test/lib/shoulda/active_record/matchers/have_db_column_matcher.rb +169 -0
  64. data/test/lib/shoulda/active_record/matchers/have_index_matcher.rb +105 -0
  65. data/test/lib/shoulda/active_record/matchers/have_named_scope_matcher.rb +125 -0
  66. data/test/lib/shoulda/active_record/matchers/have_readonly_attribute_matcher.rb +59 -0
  67. data/test/lib/shoulda/active_record/matchers/validate_acceptance_of_matcher.rb +41 -0
  68. data/test/lib/shoulda/active_record/matchers/validate_numericality_of_matcher.rb +39 -0
  69. data/test/lib/shoulda/active_record/matchers/validate_presence_of_matcher.rb +60 -0
  70. data/test/lib/shoulda/active_record/matchers/validate_uniqueness_of_matcher.rb +148 -0
  71. data/test/lib/shoulda/active_record/matchers/validation_matcher.rb +56 -0
  72. data/test/lib/shoulda/assertions.rb +59 -0
  73. data/test/lib/shoulda/autoload_macros.rb +46 -0
  74. data/test/lib/shoulda/context.rb +304 -0
  75. data/test/lib/shoulda/helpers.rb +8 -0
  76. data/test/lib/shoulda/macros.rb +73 -0
  77. data/test/lib/shoulda/private_helpers.rb +20 -0
  78. data/test/lib/shoulda/proc_extensions.rb +14 -0
  79. data/test/lib/shoulda/rails.rb +13 -0
  80. data/test/lib/shoulda/rspec.rb +9 -0
  81. data/test/lib/shoulda/tasks.rb +3 -0
  82. data/test/lib/shoulda/tasks/list_tests.rake +29 -0
  83. data/test/lib/shoulda/tasks/yaml_to_shoulda.rake +28 -0
  84. data/test/lib/shoulda/test_unit.rb +19 -0
  85. data/test/lib/xmlsimple.rb +1021 -0
  86. data/test/loader.rb +25 -0
  87. data/test/unit/activity.rb +26 -0
  88. data/test/unit/util.rb +39 -0
  89. metadata +198 -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,198 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gnip
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.2
5
+ platform: ruby
6
+ authors:
7
+ - Ara T. Howard
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-03-27 00:00:00 -06:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rest-client
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: nokogiri
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: threadify
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: tagz
47
+ type: :runtime
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 5.0.1
54
+ version:
55
+ description:
56
+ email: ara.t.howard@gmail.com
57
+ executables:
58
+ - gnip
59
+ extensions: []
60
+
61
+ extra_rdoc_files: []
62
+
63
+ files:
64
+ - bin
65
+ - bin/gnip
66
+ - doc
67
+ - doc/api.html
68
+ - gemspec.rb
69
+ - gnip-0.4.2.gem
70
+ - lib
71
+ - lib/gnip
72
+ - lib/gnip/activity.rb
73
+ - lib/gnip/api.rb
74
+ - lib/gnip/arguments.rb
75
+ - lib/gnip/blankslate.rb
76
+ - lib/gnip/config.rb
77
+ - lib/gnip/filter.rb
78
+ - lib/gnip/list.rb
79
+ - lib/gnip/options.rb
80
+ - lib/gnip/orderedhash.rb
81
+ - lib/gnip/publisher.rb
82
+ - lib/gnip/resource.rb
83
+ - lib/gnip/template.rb
84
+ - lib/gnip/util.rb
85
+ - lib/gnip.rb
86
+ - Rakefile
87
+ - README
88
+ - sample
89
+ - sample/data
90
+ - sample/data/activity.yml
91
+ - test
92
+ - test/auth.rb
93
+ - test/config.yml
94
+ - test/data
95
+ - test/data/activity.xml
96
+ - test/data/activity_only_required.xml
97
+ - test/data/activity_with_payload.xml
98
+ - test/data/activity_with_place.xml
99
+ - test/data/activity_with_place_wo_bounds.xml
100
+ - test/data/activity_with_unbounded_media_urls.xml
101
+ - test/data/activity_without_bounds.xml
102
+ - test/helper.rb
103
+ - test/helper.rb.bak
104
+ - test/integration
105
+ - test/integration/auth.rb
106
+ - test/integration/publisher.rb
107
+ - test/lib
108
+ - test/lib/shoulda
109
+ - test/lib/shoulda/action_controller
110
+ - test/lib/shoulda/action_controller/helpers.rb
111
+ - test/lib/shoulda/action_controller/macros.rb
112
+ - test/lib/shoulda/action_controller/matchers
113
+ - test/lib/shoulda/action_controller/matchers/assign_to_matcher.rb
114
+ - test/lib/shoulda/action_controller/matchers/filter_param_matcher.rb
115
+ - test/lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb
116
+ - test/lib/shoulda/action_controller/matchers/respond_with_content_type_matcher.rb
117
+ - test/lib/shoulda/action_controller/matchers/respond_with_matcher.rb
118
+ - test/lib/shoulda/action_controller/matchers/route_matcher.rb
119
+ - test/lib/shoulda/action_controller/matchers/set_session_matcher.rb
120
+ - test/lib/shoulda/action_controller/matchers/set_the_flash_matcher.rb
121
+ - test/lib/shoulda/action_controller/matchers.rb
122
+ - test/lib/shoulda/action_controller.rb
123
+ - test/lib/shoulda/action_mailer
124
+ - test/lib/shoulda/action_mailer/assertions.rb
125
+ - test/lib/shoulda/action_mailer.rb
126
+ - test/lib/shoulda/action_view
127
+ - test/lib/shoulda/action_view/macros.rb
128
+ - test/lib/shoulda/action_view.rb
129
+ - test/lib/shoulda/active_record
130
+ - test/lib/shoulda/active_record/assertions.rb
131
+ - test/lib/shoulda/active_record/helpers.rb
132
+ - test/lib/shoulda/active_record/macros.rb
133
+ - test/lib/shoulda/active_record/matchers
134
+ - test/lib/shoulda/active_record/matchers/allow_mass_assignment_of_matcher.rb
135
+ - test/lib/shoulda/active_record/matchers/allow_value_matcher.rb
136
+ - test/lib/shoulda/active_record/matchers/association_matcher.rb
137
+ - test/lib/shoulda/active_record/matchers/ensure_inclusion_of_matcher.rb
138
+ - test/lib/shoulda/active_record/matchers/ensure_length_of_matcher.rb
139
+ - test/lib/shoulda/active_record/matchers/have_db_column_matcher.rb
140
+ - test/lib/shoulda/active_record/matchers/have_index_matcher.rb
141
+ - test/lib/shoulda/active_record/matchers/have_named_scope_matcher.rb
142
+ - test/lib/shoulda/active_record/matchers/have_readonly_attribute_matcher.rb
143
+ - test/lib/shoulda/active_record/matchers/validate_acceptance_of_matcher.rb
144
+ - test/lib/shoulda/active_record/matchers/validate_numericality_of_matcher.rb
145
+ - test/lib/shoulda/active_record/matchers/validate_presence_of_matcher.rb
146
+ - test/lib/shoulda/active_record/matchers/validate_uniqueness_of_matcher.rb
147
+ - test/lib/shoulda/active_record/matchers/validation_matcher.rb
148
+ - test/lib/shoulda/active_record/matchers.rb
149
+ - test/lib/shoulda/active_record.rb
150
+ - test/lib/shoulda/assertions.rb
151
+ - test/lib/shoulda/autoload_macros.rb
152
+ - test/lib/shoulda/context.rb
153
+ - test/lib/shoulda/helpers.rb
154
+ - test/lib/shoulda/macros.rb
155
+ - test/lib/shoulda/private_helpers.rb
156
+ - test/lib/shoulda/proc_extensions.rb
157
+ - test/lib/shoulda/rails.rb
158
+ - test/lib/shoulda/rspec.rb
159
+ - test/lib/shoulda/tasks
160
+ - test/lib/shoulda/tasks/list_tests.rake
161
+ - test/lib/shoulda/tasks/yaml_to_shoulda.rake
162
+ - test/lib/shoulda/tasks.rb
163
+ - test/lib/shoulda/test_unit.rb
164
+ - test/lib/shoulda.rb
165
+ - test/lib/xmlsimple.rb
166
+ - test/loader.rb
167
+ - test/unit
168
+ - test/unit/activity.rb
169
+ - test/unit/util.rb
170
+ - TODO
171
+ has_rdoc: true
172
+ homepage: http://gnip.com
173
+ post_install_message:
174
+ rdoc_options: []
175
+
176
+ require_paths:
177
+ - lib
178
+ required_ruby_version: !ruby/object:Gem::Requirement
179
+ requirements:
180
+ - - ">="
181
+ - !ruby/object:Gem::Version
182
+ version: "0"
183
+ version:
184
+ required_rubygems_version: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - ">="
187
+ - !ruby/object:Gem::Version
188
+ version: "0"
189
+ version:
190
+ requirements: []
191
+
192
+ rubyforge_project: gnip
193
+ rubygems_version: 1.3.1
194
+ signing_key:
195
+ specification_version: 2
196
+ summary: gnip
197
+ test_files: []
198
+