ex_ua 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/spec/spec_helper.rb CHANGED
@@ -1,15 +1,11 @@
1
1
  require 'ex_ua'
2
2
  module StubbedExUAClient
3
- BASE_URL = File.join(File.expand_path('..', __FILE__), 'data')
4
- def client
5
- @client ||= (
6
- c=ExUA::Client.new
7
- c.define_singleton_method(:get) do |page|
8
- page = 'index.html' if page == '/'
9
- Nokogiri.parse(File.new("#{BASE_URL}/#{page}", external_encoding: Encoding::UTF_8).read)
10
- end
11
- c
12
- )
3
+ BASE_URL = File.expand_path('../data', __FILE__)
4
+ def stub_client
5
+ ExUA::Client.instance.stub(:get) do |page|
6
+ page = '/index.html' if page == '/'
7
+ Nokogiri.parse(File.new("#{BASE_URL}#{page}", external_encoding: Encoding::UTF_8).read)
8
+ end
13
9
  end
14
10
  end
15
11
 
@@ -0,0 +1,20 @@
1
+ desc 'Update spec data'
2
+ task :update_spec_data do
3
+ require 'httparty'
4
+ begin
5
+ base_url = 'http://www.ex.ua'
6
+ data_path = File.expand_path('../../spec/data', __FILE__)
7
+ files = {'/' => 'index.html',
8
+ '/ru/video' => 'ru_video.html',
9
+ '/view/53667787?r=2,23775' => 'video_test.html',
10
+ '/ru/video/foreign?r=23775' => 'foreign_video_russia.html',
11
+ '/search?s=futurama' => 'search?s=futurama&p=0&per=20'}
12
+ files.each do |remote, local|
13
+ url = "#{base_url}#{remote}"
14
+ puts url
15
+ File.write(File.join(data_path, local), HTTParty.get(url))
16
+ end
17
+ rescue => e
18
+ puts "Failed updating spec data: #{e.message}."
19
+ end
20
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ex_ua
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andriy Dmytrenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-05 00:00:00.000000000 Z
11
+ date: 2013-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: 1.5.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: addressable
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: 2.3.0
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: 2.3.0
69
83
  description: Ruby API for ex.ua
70
84
  email:
71
85
  - refresh.xss@gmail.com
@@ -75,6 +89,7 @@ extra_rdoc_files: []
75
89
  files:
76
90
  - .gitignore
77
91
  - Gemfile
92
+ - LICENCE
78
93
  - README.md
79
94
  - Rakefile
80
95
  - ex_ua.gemspec
@@ -88,10 +103,13 @@ files:
88
103
  - spec/data/foreign_video_russia.html
89
104
  - spec/data/index.html
90
105
  - spec/data/ru_video.html
106
+ - spec/data/search?s=futurama&p=0&per=20
91
107
  - spec/data/video_test.html
92
108
  - spec/spec_helper.rb
109
+ - tasks/update_spec_data.rake
93
110
  homepage: ''
94
- licenses: []
111
+ licenses:
112
+ - MIT
95
113
  metadata: {}
96
114
  post_install_message:
97
115
  rdoc_options: []
@@ -119,5 +137,6 @@ test_files:
119
137
  - spec/data/foreign_video_russia.html
120
138
  - spec/data/index.html
121
139
  - spec/data/ru_video.html
140
+ - spec/data/search?s=futurama&p=0&per=20
122
141
  - spec/data/video_test.html
123
142
  - spec/spec_helper.rb