rubyfox-server 2.9.1.0 → 2.9.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a07fe81be878fd64ef7dfd9f735ca8f72092d8a7
4
- data.tar.gz: f16905179a9a860e4a60a57824627e2816d07bd7
3
+ metadata.gz: b3bb678fae2e675f459165d628cc3bd9e7fb9cb7
4
+ data.tar.gz: 130373c54d93698b37a6d762e043e41b3e10bd6f
5
5
  SHA512:
6
- metadata.gz: cff66391e980b3ef4571a4820dff66cc1e109bb291be054b4f7f46d7abc4af0f94244ccf646ec36480545de71c7a01cc39e23326fe39b0dc02663d025ef4cacc
7
- data.tar.gz: 258d28bd310b92360e12e0063b20d6c7f0f6581915b2d69999ab34d60c24f23ebfc043423652d3577537e0a949d85e65fea0b28f6bf1960807757a119d7a910a
6
+ metadata.gz: ccb44e8b886654c2feb311dd74057706e576ded30e0aabb101b0368aa38abc4345a46d99380986b3ea6881b51a527f359d6fae004f5e373f50a7be63f7646d57
7
+ data.tar.gz: e990b19c2e0bd6b00c38872db9d3bcdb24c2643e79347c2a54cce0665aede5c6d5fc6fb27467084c032e498d032690a7ebddc42086c11fec48dc6ddaebe2257d
@@ -0,0 +1,3 @@
1
+ rvm:
2
+ - 2.1
3
+ - ruby-head
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ gem 'rake'
data/Rakefile CHANGED
@@ -1 +1,10 @@
1
1
  require "bundler/gem_tasks"
2
+
3
+ task :default => :spec
4
+
5
+ require "rake/testtask"
6
+ Rake::TestTask.new(:spec) do |t|
7
+ t.libs << "spec"
8
+ t.test_files = FileList['spec/**/*_spec.rb']
9
+ t.verbose = true
10
+ end
@@ -56,7 +56,7 @@ module Rubyfox
56
56
 
57
57
  no_tasks do
58
58
  def env
59
- @env ||= Environment.new(ENV)
59
+ @env ||= Environment.new(ENV, self)
60
60
  end
61
61
  end
62
62
 
@@ -1,11 +1,10 @@
1
1
  module Rubyfox
2
2
  module Server
3
3
  class Environment
4
- include Thor::Shell
5
-
6
- def initialize(env)
7
- @env = env
8
- @local = {}
4
+ def initialize(env, asker)
5
+ @env = env
6
+ @asker = asker
7
+ @local = {}
9
8
  end
10
9
 
11
10
  def [](name)
@@ -14,7 +13,7 @@ module Rubyfox
14
13
  value || begin
15
14
  msg = "Specify env #{name}:"
16
15
  loop do
17
- answer = ask(msg)
16
+ answer = @asker.ask(msg)
18
17
  unless answer.empty?
19
18
  self[name] = answer
20
19
  break answer
@@ -1,5 +1,5 @@
1
1
  module Rubyfox
2
2
  module Server
3
- VERSION = "2.9.1.0"
3
+ VERSION = "2.9.2.0"
4
4
  end
5
5
  end
@@ -20,4 +20,6 @@ Gem::Specification.new do |gem|
20
20
 
21
21
  gem.add_runtime_dependency 'thor'
22
22
  gem.add_runtime_dependency 'mime-types'
23
+
24
+ gem.add_development_dependency 'minitest', '~> 5.4.2'
23
25
  end
@@ -0,0 +1,71 @@
1
+ require 'spec_helper'
2
+
3
+ require 'rubyfox/server/environment'
4
+
5
+ class TestAsker
6
+ attr_reader :answers, :asked
7
+
8
+ def initialize
9
+ @asked = []
10
+ @answers = []
11
+ end
12
+
13
+ def ask(message)
14
+ @asked << message
15
+ @answers.shift or fail "no answers left"
16
+ end
17
+ end
18
+
19
+ describe Rubyfox::Server::Environment do
20
+ let(:env) { Hash.new }
21
+ let(:asker) { TestAsker.new }
22
+ let(:environment) { Rubyfox::Server::Environment.new(env, asker) }
23
+
24
+ context "[]" do
25
+ it "returns predefined value" do
26
+ env["foo"] = 23
27
+ assert_equal 23, environment["foo"]
28
+ end
29
+
30
+ it "asks for missing value" do
31
+ asker.answers << "23"
32
+
33
+ assert_equal "23", environment["foo"]
34
+ assert_equal "23", environment["foo"]
35
+
36
+ assert_asked "foo", 1
37
+ end
38
+
39
+ it "keep asking for empty values" do
40
+ asker.answers << ""
41
+ asker.answers << "23"
42
+
43
+ assert_equal "23", environment["foo"]
44
+ assert_asked "foo", 2
45
+ end
46
+ end
47
+
48
+ context "[]=" do
49
+ it "sets env" do
50
+ environment["foo"] = 23
51
+
52
+ assert_equal 23, environment["foo"]
53
+ end
54
+
55
+ it "stringifies when setting env" do
56
+ environment[:foo] = 23
57
+
58
+ assert_equal 23, environment["foo"]
59
+ assert_equal 23, environment[:foo]
60
+ end
61
+ end
62
+
63
+ private
64
+
65
+ def assert_asked(key, amount=1)
66
+ expected = ["Specify env #{key}:"] * amount
67
+
68
+ assert_equal expected, asker.asked
69
+ end
70
+
71
+ end
@@ -0,0 +1,7 @@
1
+ require 'minitest/autorun'
2
+
3
+ Minitest::Spec.class_eval do
4
+ class << self
5
+ alias :context :describe
6
+ end
7
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyfox-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.1.0
4
+ version: 2.9.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Suschlik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-28 00:00:00.000000000 Z
11
+ date: 2015-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 5.4.2
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 5.4.2
41
55
  description: SmartFox Server bundled as a gem
42
56
  email:
43
57
  - ps@neopoly.de
@@ -47,6 +61,7 @@ extensions: []
47
61
  extra_rdoc_files: []
48
62
  files:
49
63
  - ".gitignore"
64
+ - ".travis.yml"
50
65
  - Gemfile
51
66
  - LICENSE.txt
52
67
  - README.rdoc
@@ -1102,6 +1117,8 @@ files:
1102
1117
  - lib/rubyfox/server/environment.rb
1103
1118
  - lib/rubyfox/server/version.rb
1104
1119
  - rubyfox-server.gemspec
1120
+ - spec/rubyfox/server/environment_spec.rb
1121
+ - spec/spec_helper.rb
1105
1122
  homepage: https://github.com/neopoly/rubyfox-server
1106
1123
  licenses:
1107
1124
  - MIT
@@ -1126,4 +1143,6 @@ rubygems_version: 2.2.2
1126
1143
  signing_key:
1127
1144
  specification_version: 4
1128
1145
  summary: ''
1129
- test_files: []
1146
+ test_files:
1147
+ - spec/rubyfox/server/environment_spec.rb
1148
+ - spec/spec_helper.rb