dict 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,19 @@
1
+ require 'vcr'
2
+ require 'rspec'
3
+ require 'active_support/all'
4
+
5
+ VCR.configure do |c|
6
+ c.cassette_library_dir = 'spec/dict/vcr_cassettes'
7
+ c.hook_into :fakeweb
8
+ c.allow_http_connections_when_no_cassette = true
9
+ end
10
+
11
+
12
+ RSpec.configure do |c|
13
+ c.treat_symbols_as_metadata_keys_with_true_values = true
14
+ c.around(:each, :vcr) do |example|
15
+ name = example.metadata[:full_description].split(/\s+/, 2).join("/").underscore.gsub(/[^\w\/]+/, "_")
16
+ VCR.use_cassette(name) { example.call }
17
+ end
18
+ end
19
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dict
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2012-07-11 00:00:00.000000000 Z
15
+ date: 2012-07-12 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: slop
@@ -78,6 +78,54 @@ dependencies:
78
78
  - - ! '>='
79
79
  - !ruby/object:Gem::Version
80
80
  version: '0'
81
+ - !ruby/object:Gem::Dependency
82
+ name: vcr
83
+ requirement: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ none: false
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: activesupport
99
+ requirement: !ruby/object:Gem::Requirement
100
+ none: false
101
+ requirements:
102
+ - - ! '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ none: false
109
+ requirements:
110
+ - - ! '>='
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ - !ruby/object:Gem::Dependency
114
+ name: fakeweb
115
+ requirement: !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ type: :development
122
+ prerelease: false
123
+ version_requirements: !ruby/object:Gem::Requirement
124
+ none: false
125
+ requirements:
126
+ - - ! '>='
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
81
129
  description: ! ' Dict is an open source dictionary aggregator.
82
130
 
83
131
  '
@@ -104,11 +152,17 @@ files:
104
152
  - lib/dict/dictpl.rb
105
153
  - lib/dict/version.rb
106
154
  - lib/dict/wiktionary.rb
107
- - spec/dict/bin_translate_spec.rb
155
+ - spec/dict/lib_dict_cli_runner_spec.rb
108
156
  - spec/dict/lib_dict_spec.rb
109
157
  - spec/dict/lib_dictpl_spec.rb
110
158
  - spec/dict/lib_wiktionary_spec.rb
111
159
  - spec/dict/spec_helper.rb
160
+ - spec/dict/vcr_cassettes/examples_krowa_cassette.yml
161
+ - spec/dict/vcr_cassettes/examples_samochod_cassette.yml
162
+ - spec/dict/vcr_cassettes/paired_value_samochod_cassette.yml
163
+ - spec/dict/vcr_cassettes/translations_krowa_cassette.yml
164
+ - spec/dict/vcr_cassettes/translations_samochod_cassette.yml
165
+ - spec/dict/vcr_setup.rb
112
166
  homepage: https://github.com/Ragnarson/dict-gem
113
167
  licenses: []
114
168
  post_install_message:
@@ -1,50 +0,0 @@
1
- # -*- coding: utf-8 -*
2
- require 'dict/cli/runner'
3
-
4
- describe "parameters_valid?" do
5
- it "should return false if ARGV is empty" do
6
- stub_const("ARGV", [])
7
- runner = Dict::CLI::Runner.new
8
- runner.parameters_valid?.should == false
9
- end
10
-
11
- it "should return true if ARGV is not empty" do
12
- stub_const("ARGV", ["słowik", "-t", "36", "-d"])
13
- runner = Dict::CLI::Runner.new
14
- runner.parameters_valid?.should == true
15
- end
16
- end
17
-
18
- describe "parse_parameters" do
19
- it "should return Hash for parameters słowik -t 36" do
20
- stub_const("ARGV", ["słowik", "-t", "36"])
21
- runner = Dict::CLI::Runner.new
22
- opts = runner.parse_parameters
23
- {:help=>nil, :time=>"36", :dict=>nil}.should == opts.to_hash
24
- end
25
-
26
- it "should return Hash for parameters słowik" do
27
- stub_const("ARGV", ["słowik"])
28
- runner = Dict::CLI::Runner.new
29
- opts = runner.parse_parameters
30
- {:help=>nil, :time=>nil, :dict=>nil}.should == opts.to_hash
31
- end
32
- end
33
-
34
-
35
- describe "get_translations" do
36
- # it "should return results from wiktionary and dictpl for word 'słowik'" do
37
- # stub_const("ARGV", ["-w", "słowik"])
38
- # opts = Main::parse_parameters
39
- # Main::get_translations(opts).should == {"wiktionary"=>{}, "dictpl"=>{"słowik"=>["nightingale"], "słowik białobrewy; Luscinia indicus; Tarsiger indicus (gatunek ptaka)"=>["white-browed bush-robin"], "słowik białosterny; Luscinia pectoralis (gatunek ptaka)"=>["Himalayan rubythroat", "white-tailed rubythroat"], "słowik chiński; pekińczyk żółty; Leiothrix lutea"=>["Pekin robin", "red-billed leiothrix"], "słowik chiński; pekińczyk żółty; pekińczyk koralodzioby; Leiothrix lutea"=>["Peking robin"], "słowik czarnogardły; Luscinia obscura"=>["black-throated blue robin"], "słowik himalajski; Luscinia brunnea (gatunek ptaka)"=>["Indian blue chat", "Indian blue robin"], "słowik modry; Luscinia cyane"=>["Siberian blue robin"], "słowik obrożny; Luscinia johnstoniae; Tarsiger johnstoniae (gatunek ptaka)"=>["collared bush-robin"]}}
40
- # end
41
-
42
- it "should return timeout message for word słowik and -t 5" do
43
- stub_const("ARGV", ["słowik","-t","5"])
44
- runner = Dict::CLI::Runner.new
45
- opts = runner.parse_parameters
46
- Dict.should_receive(:get_all_dictionaries_translations).
47
- and_return { sleep 20 }
48
- runner.get_translations(opts, "słowik").should == "Timeout for the query."
49
- end
50
- end