rack-environment 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,7 +1,6 @@
1
1
  = rack-environment
2
2
 
3
- Rack::Environment is useful for getting ENVironment variables set for your
4
- application.
3
+ Sets ENVironment variables around your app.
5
4
 
6
5
  This can help you to more closely simulate your Heroku environment in
7
6
  development.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.1.0
@@ -33,7 +33,8 @@ private ######################################################################
33
33
  end
34
34
 
35
35
  def read_config_file(filename)
36
- YAML::load_file(filename)
36
+ config = YAML::load_file(filename)
37
+ config.is_a?(Hash) ? config : {}
37
38
  end
38
39
 
39
40
  def update_environment!
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rack-environment}
8
- s.version = "1.0.1"
8
+ s.version = "1.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["David Dollar"]
@@ -26,6 +26,7 @@ Gem::Specification.new do |s|
26
26
  "lib/rack-environment.rb",
27
27
  "lib/rack_environment.rb",
28
28
  "rack-environment.gemspec",
29
+ "spec/config/blank.yml",
29
30
  "spec/config/environment.yml",
30
31
  "spec/rack_environment_spec.rb",
31
32
  "spec/rcov.opts",
File without changes
@@ -3,17 +3,38 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
3
3
  describe "RackEnvironment" do
4
4
  include Rack::Test::Methods
5
5
 
6
+ def rack_environment_with_filename(filename)
7
+ Rack::Builder.new do
8
+ use RackEnvironment, :file => File.join(File.dirname(__FILE__), 'config', filename)
9
+ run TestApplication.new
10
+ end
11
+ end
12
+
13
+ def rack_environment_with_environment(environment)
14
+ Rack::Builder.new do
15
+ use RackEnvironment, :environment => environment
16
+ run TestApplication.new
17
+ end
18
+ end
19
+
6
20
  before :each do
7
21
  get "/"
8
22
  @environment = last_response.headers['X-Rack-Environment']
9
23
  end
10
24
 
25
+ describe "with specified environment" do
26
+ def app
27
+ rack_environment_with_environment :ONE => 'one_value'
28
+ end
29
+
30
+ it "should have the proper environment set" do
31
+ @environment['ONE'].should == 'one_value'
32
+ end
33
+ end
34
+
11
35
  describe "with specified config file" do
12
36
  def app
13
- Rack::Builder.new do
14
- use RackEnvironment, :file => File.expand_path(File.dirname(__FILE__) + '/config/environment.yml')
15
- run TestApplication.new
16
- end
37
+ rack_environment_with_filename 'environment.yml'
17
38
  end
18
39
 
19
40
  it "should have the proper environment set" do
@@ -26,16 +47,13 @@ describe "RackEnvironment" do
26
47
  end
27
48
  end
28
49
 
29
- describe "with specified environment" do
50
+ describe "with blank config file" do
30
51
  def app
31
- Rack::Builder.new do
32
- use RackEnvironment, :environment => { :ONE => 'one_value' }
33
- run TestApplication.new
34
- end
52
+ rack_environment_with_filename 'blank.yml'
35
53
  end
36
54
 
37
- it "should have the proper environment set" do
38
- @environment['ONE'].should == 'one_value'
55
+ it "should not raise an error" do
56
+ @environment.should_not be_nil
39
57
  end
40
58
  end
41
59
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-environment
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Dollar
@@ -51,6 +51,7 @@ files:
51
51
  - lib/rack-environment.rb
52
52
  - lib/rack_environment.rb
53
53
  - rack-environment.gemspec
54
+ - spec/config/blank.yml
54
55
  - spec/config/environment.yml
55
56
  - spec/rack_environment_spec.rb
56
57
  - spec/rcov.opts