ruri 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,47 @@
1
+ # coding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe Ruri::Search do
5
+ describe '.search' do
6
+ it {
7
+ mock(Ruri::Search).open("#{Ruri::Search::BASE_URL}/ja/search/version:1.8.7/query:gsub%21/") { '<html></html>' }
8
+ mock(Ruri::Search).parse_search_result('<html></html>') { [Ruri::Search::Result.new('title', 'http://foo', 'foo...')] }
9
+ Ruri::Search.search('gsub!', :version => '1.8.7').should == [Ruri::Search::Result.new('title', 'http://foo', 'foo...')]
10
+ Ruri::Search.last_result.should == []
11
+ Ruri::Search.last_query.should == nil
12
+ }
13
+
14
+ describe ':memory => true' do
15
+ it {
16
+ mock(Ruri::Search).open("#{Ruri::Search::BASE_URL}/ja/search/version:#{Ruri::Search::DEFAULT_VERSION}/query:gsub%21/") { '<html></html>' }
17
+ mock(Ruri::Search).parse_search_result('<html></html>') { [Ruri::Search::Result.new('title', 'http://foo', 'foo...')] }
18
+ result = Ruri::Search.search('gsub!', :memory => true)
19
+ result.should == [Ruri::Search::Result.new('title', 'http://foo', 'foo...')]
20
+ Ruri::Search.last_result.should == result
21
+ Ruri::Search.last_query.should == 'gsub!'
22
+ }
23
+ end
24
+ end
25
+
26
+ describe '.parse_search_result' do
27
+ it {
28
+ result = Ruri::Search.parse_search_result(File.read(File.join(fixture_path, 'search_result.html')))
29
+ entry = result.first
30
+ entry.title.should == "String#gsub(pattern, replace) -> String"
31
+ entry.url.should == "#{Ruri::Search::BASE_URL}/ja/1.9.2/method/String/i/gsub.html"
32
+ entry.summary.should == "文字列中で pattern にマッチする部分全てを\n文字列 replace で置き換えた文字列を生成し返します。"
33
+ }
34
+ end
35
+
36
+ describe '.open_reference' do
37
+ pending
38
+ end
39
+
40
+ describe '.parse_reference' do
41
+ pending
42
+ end
43
+
44
+ describe '.web_page_cache' do
45
+ pending
46
+ end
47
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Ruri" do
4
+ pending
5
+ end
@@ -0,0 +1,16 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'ruri'
5
+
6
+ # Requires supporting files with custom matchers and macros, etc,
7
+ # in ./support/ and its subdirectories.
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+ config.mock_with :rr
12
+ end
13
+
14
+ def fixture_path
15
+ @fixture_path ||= File.expand_path('../fixtures', __FILE__)
16
+ end
metadata ADDED
@@ -0,0 +1,237 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruri
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - jugyo
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-01-27 00:00:00 +09:00
18
+ default_executable: ruri
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: cinatra
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :runtime
31
+ prerelease: false
32
+ version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: nokogiri
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ none: false
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ segments:
41
+ - 0
42
+ version: "0"
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: *id002
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: &id003 !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ segments:
54
+ - 2
55
+ - 3
56
+ - 0
57
+ version: 2.3.0
58
+ type: :development
59
+ prerelease: false
60
+ version_requirements: *id003
61
+ - !ruby/object:Gem::Dependency
62
+ name: rr
63
+ requirement: &id004 !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ segments:
69
+ - 1
70
+ - 0
71
+ - 2
72
+ version: 1.0.2
73
+ type: :development
74
+ prerelease: false
75
+ version_requirements: *id004
76
+ - !ruby/object:Gem::Dependency
77
+ name: bundler
78
+ requirement: &id005 !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ~>
82
+ - !ruby/object:Gem::Version
83
+ segments:
84
+ - 1
85
+ - 0
86
+ - 0
87
+ version: 1.0.0
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *id005
91
+ - !ruby/object:Gem::Dependency
92
+ name: jeweler
93
+ requirement: &id006 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ~>
97
+ - !ruby/object:Gem::Version
98
+ segments:
99
+ - 1
100
+ - 5
101
+ - 2
102
+ version: 1.5.2
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: *id006
106
+ - !ruby/object:Gem::Dependency
107
+ name: rcov
108
+ requirement: &id007 !ruby/object:Gem::Requirement
109
+ none: false
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ segments:
114
+ - 0
115
+ version: "0"
116
+ type: :development
117
+ prerelease: false
118
+ version_requirements: *id007
119
+ - !ruby/object:Gem::Dependency
120
+ name: cinatra
121
+ requirement: &id008 !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ segments:
127
+ - 0
128
+ version: "0"
129
+ type: :runtime
130
+ prerelease: false
131
+ version_requirements: *id008
132
+ - !ruby/object:Gem::Dependency
133
+ name: nokogiri
134
+ requirement: &id009 !ruby/object:Gem::Requirement
135
+ none: false
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ segments:
140
+ - 0
141
+ version: "0"
142
+ type: :runtime
143
+ prerelease: false
144
+ version_requirements: *id009
145
+ - !ruby/object:Gem::Dependency
146
+ name: rspec
147
+ requirement: &id010 !ruby/object:Gem::Requirement
148
+ none: false
149
+ requirements:
150
+ - - ~>
151
+ - !ruby/object:Gem::Version
152
+ segments:
153
+ - 2
154
+ - 3
155
+ - 0
156
+ version: 2.3.0
157
+ type: :development
158
+ prerelease: false
159
+ version_requirements: *id010
160
+ - !ruby/object:Gem::Dependency
161
+ name: rr
162
+ requirement: &id011 !ruby/object:Gem::Requirement
163
+ none: false
164
+ requirements:
165
+ - - ~>
166
+ - !ruby/object:Gem::Version
167
+ segments:
168
+ - 1
169
+ - 0
170
+ - 2
171
+ version: 1.0.2
172
+ type: :development
173
+ prerelease: false
174
+ version_requirements: *id011
175
+ description: "Ruri is the \xE3\x82\x8B\xE3\x82\x8A\xE3\x81\xBE shell."
176
+ email: jugyo.org@gmail.com
177
+ executables:
178
+ - ruri
179
+ extensions: []
180
+
181
+ extra_rdoc_files:
182
+ - LICENSE.txt
183
+ - README.md
184
+ files:
185
+ - .document
186
+ - .rspec
187
+ - Gemfile
188
+ - Gemfile.lock
189
+ - LICENSE.txt
190
+ - README.md
191
+ - Rakefile
192
+ - VERSION
193
+ - bin/ruri
194
+ - lib/ruri.rb
195
+ - lib/ruri/search.rb
196
+ - lib/ruri/util.rb
197
+ - spec/fixtures/search_result.html
198
+ - spec/ruri/search_spec.rb
199
+ - spec/ruri_spec.rb
200
+ - spec/spec_helper.rb
201
+ has_rdoc: true
202
+ homepage: http://github.com/jugyo/ruri
203
+ licenses:
204
+ - MIT
205
+ post_install_message:
206
+ rdoc_options: []
207
+
208
+ require_paths:
209
+ - lib
210
+ required_ruby_version: !ruby/object:Gem::Requirement
211
+ none: false
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ hash: -4251334765024878482
216
+ segments:
217
+ - 0
218
+ version: "0"
219
+ required_rubygems_version: !ruby/object:Gem::Requirement
220
+ none: false
221
+ requirements:
222
+ - - ">="
223
+ - !ruby/object:Gem::Version
224
+ segments:
225
+ - 0
226
+ version: "0"
227
+ requirements: []
228
+
229
+ rubyforge_project:
230
+ rubygems_version: 1.3.7
231
+ signing_key:
232
+ specification_version: 3
233
+ summary: "the \xE3\x82\x8B\xE3\x82\x8A\xE3\x81\xBE shell"
234
+ test_files:
235
+ - spec/ruri/search_spec.rb
236
+ - spec/ruri_spec.rb
237
+ - spec/spec_helper.rb