yacht 0.2.7 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +7 -2
- data/.travis.yml +5 -0
- data/HISTORY.md +15 -0
- data/LICENSE +0 -2
- data/README.rdoc +18 -15
- data/Rakefile +1 -5
- data/features/load.feature +0 -1
- data/lib/monkeypatches/rails_helper.rb +0 -2
- data/lib/yacht.rb +0 -3
- data/lib/yacht/loader.rb +1 -1
- data/lib/yacht/version.rb +1 -1
- data/spec/monkeypatches/rails_helper_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -0
- data/spec/support/constants.rb +57 -0
- data/spec/yacht/javascript_spec.rb +7 -1
- data/yacht.gemspec +13 -20
- metadata +32 -25
- data/.rvmrc +0 -23
- data/lib/yacht/rails.rb +0 -25
- data/spec/yacht/rails_spec.rb +0 -47
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/HISTORY.md
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
## [0.3.0](https://github.com/attinteractive/yacht/compare/0.2.7...0.3.0)
|
2
|
+
|
3
|
+
### Less features
|
4
|
+
* Remove some unnecessary Rails support features ([#18](https://github.com/attinteractive/yacht/issues/18))
|
5
|
+
|
6
|
+
### Add Travis CI to github repo
|
7
|
+
|
8
|
+
## [0.2.7](https://github.com/attinteractive/yacht/compare/0.2.6...0.2.7)
|
9
|
+
|
10
|
+
### Bugfixes
|
11
|
+
* Compatibility with ruby 1.8.7 ([#16](https://github.com/attinteractive/yacht/issues/16) Mani Tadayon)
|
12
|
+
|
13
|
+
### New features
|
14
|
+
* Don't monkeypatch Hash, use a module instead ([#11](https://github.com/attinteractive/yacht/issues/11) Mani Tadayon)
|
15
|
+
|
1
16
|
## [0.2.6](https://github.com/attinteractive/yacht/compare/0.2.5...0.2.6)
|
2
17
|
|
3
18
|
### Bugfixes
|
data/LICENSE
CHANGED
@@ -10,8 +10,6 @@ so, subject to the following conditions:
|
|
10
10
|
The above copyright notice and this permission notice shall be included in all
|
11
11
|
copies or substantial portions of the Software.
|
12
12
|
|
13
|
-
The Software shall be used for Good, not Evil.
|
14
|
-
|
15
13
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
14
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
15
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
data/README.rdoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
= Yacht
|
1
|
+
= Yacht {<img src="https://secure.travis-ci.org/attinteractive/yacht.png" alt="Build Status" />}[http://travis-ci.org/attinteractive/yacht]
|
2
2
|
|
3
3
|
Yacht is an application configuration gem that lets you define settings for multiple environments in YAML files. It is similar to AppConfig[https://github.com/cjbottaro/app_config] with additional features like:
|
4
4
|
* use of ClassyStruct for improved performance over OpenStruct
|
@@ -55,8 +55,7 @@ First create one or more of the following YAML files in the same directory to de
|
|
55
55
|
# config/yacht/local.yml (optional)
|
56
56
|
# any values set in local.yml will override values set in base.yml
|
57
57
|
# useful for development and testing
|
58
|
-
|
59
|
-
cdn_host: localhost
|
58
|
+
cdn_host: localhost
|
60
59
|
|
61
60
|
=== Step 2: Use +Yacht.my_key+ or <tt>Yacht['my_key']</tt> in ruby
|
62
61
|
|
@@ -78,12 +77,12 @@ First create one or more of the following YAML files in the same directory to de
|
|
78
77
|
=== <tt>Yacht::Loader.to_js_snippet</tt> export to javascript
|
79
78
|
If you would like to access values stored in Yacht inside of javascript, there is a helper for that. First, create a YAML file to tell Yacht which keys should be exported:
|
80
79
|
|
81
|
-
# config/yacht/
|
80
|
+
# config/yacht/js_keys.yml
|
82
81
|
# only keys listed here will be available in javascript
|
83
82
|
# remember that any values exported to javascript will be visible to all visitors to your site
|
84
83
|
- cookie_domain
|
85
84
|
|
86
|
-
Then use
|
85
|
+
Then use <tt>Yacht::Loader#to_js_snippet</tt> to create a string that can be eval'd or included in the DOM:
|
87
86
|
|
88
87
|
Yacht::Loader.to_js_snippet
|
89
88
|
# => ";var Yacht = {\"cookie_domain\":\"example.com\"};"
|
@@ -94,27 +93,31 @@ You can also add in extra values from outside of Yacht using the :merge option,
|
|
94
93
|
# => ";var Yacht = {\"cookie_domain\":\"example.com\",\"current_time\":\"06/29/2011\"};"
|
95
94
|
|
96
95
|
|
97
|
-
===
|
96
|
+
=== Rails
|
97
|
+
|
98
|
+
To use Yacht inside of Rails, just add an initializer to <tt>config/initializers</tt>:
|
98
99
|
|
99
|
-
|
100
|
+
# config/initializers/00_yacht_init.rb
|
100
101
|
|
101
|
-
Yacht
|
102
|
-
#
|
103
|
-
|
102
|
+
# Yacht needs to know where to find its YAML files...
|
103
|
+
# ...and the current Rails environment
|
104
|
+
Yacht::Loader.dir = Rails.root.join('config', 'yacht')
|
105
|
+
Yacht::Loader.environment = Rails.env
|
106
|
+
|
107
|
+
When used inside of a Rails application, the <tt>yacht_js_snippet</tt> Rails helper is included in the global <tt>ApplicationHelper</tt> so you can use it in views. <tt>yacht_js_snippet</tt> wraps the string from <tt>Yacht::Loader#to_js_snippet</tt> in a script tag using Rails' +javascript_tag+ helper.
|
104
108
|
|
105
109
|
# inside a view or helper:
|
106
110
|
yacht_js_snippet
|
107
|
-
# => "<script type=\"text/javascript\">\n//<![CDATA[\n;var Yacht = {\"cookie_domain\":\"localhost\"
|
111
|
+
# => "<script type=\"text/javascript\">\n//<![CDATA[\n;var Yacht = {\"cookie_domain\":\"localhost\"\n//]]>\n</script>"
|
108
112
|
|
109
|
-
# you can also pass options to yacht_js_snippet:
|
110
|
-
yacht_js_snippet(:merge => {:current_time => Time.now.to_s})
|
113
|
+
# you can also pass options to yacht_js_snippet, like the the current Rails environment:
|
114
|
+
yacht_js_snippet(:merge => {:current_time => Time.now.to_s, :rails_env => Rails.env})
|
111
115
|
# => "<script type=\"text/javascript\">\n//<![CDATA[\n;var Yacht = {\"cookie_domain\":\"localhost\",\"rails_env\":\"development\",\"current_time\":\"06/29/2011\"};\n//]]>\n</script>"
|
112
116
|
|
113
|
-
|
114
117
|
== Ruby compatibility
|
115
118
|
|
116
119
|
Yacht works with ruby 1.8.7 and 1.9.2.
|
117
120
|
|
118
121
|
== License
|
119
122
|
|
120
|
-
Yacht is licensed under the MIT License
|
123
|
+
Yacht is licensed under the MIT License.
|
data/Rakefile
CHANGED
data/features/load.feature
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
module Yacht::RailsHelper
|
2
2
|
# Create a string with a javascript version of Yacht values intended for inclusion in an HTML page
|
3
3
|
#
|
4
|
-
# @note environment will be set to Rails.env by default
|
5
|
-
#
|
6
4
|
# @example Set custom environment
|
7
5
|
# yacht_js_snippet(:env => 'local_development')
|
8
6
|
# # => "<script type=\"text/javascript\">;var Yacht = {\"foo\":\"bar\"};</script>"
|
data/lib/yacht.rb
CHANGED
data/lib/yacht/loader.rb
CHANGED
@@ -10,7 +10,7 @@ class Yacht::Loader
|
|
10
10
|
attr_accessor :dir
|
11
11
|
|
12
12
|
def full_file_path_for_config(config_type)
|
13
|
-
raise Yacht::LoadError.new "No directory set" unless dir
|
13
|
+
raise Yacht::LoadError.new "No directory set" unless self.dir
|
14
14
|
|
15
15
|
File.join( self.dir, "#{config_type}.yml" )
|
16
16
|
end
|
data/lib/yacht/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -0,0 +1,57 @@
|
|
1
|
+
# Mock a constant within the passed block
|
2
|
+
# @example mock RAILS_ENV constant
|
3
|
+
# it "does not allow links to be added in production environment" do
|
4
|
+
# with_constants :RAILS_ENV => 'production' do
|
5
|
+
# get :add, @nonexistent_link.url
|
6
|
+
# response.should_not be_success
|
7
|
+
# end
|
8
|
+
# end
|
9
|
+
# @note adapted from:
|
10
|
+
# * http://stackoverflow.com/a/7849835/457819
|
11
|
+
# * http://digitaldumptruck.jotabout.com/?p=551
|
12
|
+
def with_constants(constants)
|
13
|
+
@constants_to_restore = {}
|
14
|
+
@constants_to_unset = []
|
15
|
+
|
16
|
+
constants.each do |name, val|
|
17
|
+
if Object.const_defined?(name)
|
18
|
+
@constants_to_restore[name] = Object.const_get(name)
|
19
|
+
else
|
20
|
+
@constants_to_unset << name
|
21
|
+
end
|
22
|
+
|
23
|
+
Object.const_set( name, val )
|
24
|
+
end
|
25
|
+
|
26
|
+
begin
|
27
|
+
yield
|
28
|
+
ensure
|
29
|
+
@constants_to_restore.each do |name, val|
|
30
|
+
Object.const_set( name, val )
|
31
|
+
end
|
32
|
+
|
33
|
+
@constants_to_unset.each do |name|
|
34
|
+
Object.send(:remove_const, name)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def without_constants(constants)
|
40
|
+
@constants_to_restore = {}
|
41
|
+
|
42
|
+
constants.each do |name, val|
|
43
|
+
if Object.const_defined?(name)
|
44
|
+
@constants_to_restore[name] = Object.const_get(name)
|
45
|
+
end
|
46
|
+
|
47
|
+
Object.send(:remove_const, name)
|
48
|
+
end
|
49
|
+
|
50
|
+
begin
|
51
|
+
yield
|
52
|
+
ensure
|
53
|
+
@constants_to_restore.each do |name, val|
|
54
|
+
Object.const_set( name, val )
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -26,7 +26,13 @@ describe Yacht::Loader do
|
|
26
26
|
subject.stub(:to_hash).and_return(:foo => 'bar', :baz => 'snafu')
|
27
27
|
subject.stub(:js_keys).and_return(:baz)
|
28
28
|
|
29
|
-
|
29
|
+
correct_snippets = [ # hash key order is random in ruby 1.8.7
|
30
|
+
';var Yacht = {"baz":"snafu","request_id":123};',
|
31
|
+
';var Yacht = {"request_id":123,"baz":"snafu"};'
|
32
|
+
]
|
33
|
+
|
34
|
+
actual = subject.to_js_snippet(:merge => {:request_id => 123})
|
35
|
+
correct_snippets.should include(actual)
|
30
36
|
end
|
31
37
|
end
|
32
38
|
|
data/yacht.gemspec
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
$:.unshift lib unless $:.include?(lib)
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
4
3
|
|
5
4
|
require 'yacht/version'
|
6
5
|
|
@@ -8,28 +7,22 @@ Gem::Specification.new do |s|
|
|
8
7
|
s.name = "yacht"
|
9
8
|
s.version = Yacht::VERSION
|
10
9
|
s.authors = ["Mani Tadayon", "Rico Rodriquez Collins"]
|
11
|
-
s.description = "Yacht is Yet Another Configuration Helper Tool."
|
12
|
-
s.summary = "yacht-#{s.version}"
|
13
10
|
s.email = ["mtadayon@atti.com", "rcollins@atti.com"]
|
14
11
|
s.homepage = "https://github.com/attinteractive/yacht"
|
12
|
+
s.summary = "yacht-#{s.version}"
|
13
|
+
s.description = "Yacht is Yet Another Configuration Helper Tool."
|
15
14
|
|
16
|
-
s.
|
17
|
-
|
18
|
-
s.add_dependency "classy_struct", ">= 0.3.2"
|
15
|
+
s.add_dependency "classy_struct", "~> 0.3.2"
|
19
16
|
s.add_dependency "json"
|
20
17
|
|
21
|
-
s.add_development_dependency "gherkin", '
|
18
|
+
s.add_development_dependency "gherkin", '~> 2.4.0'
|
22
19
|
s.add_development_dependency "cucumber", '~> 1.0'
|
23
20
|
s.add_development_dependency 'aruba'
|
24
|
-
s.add_development_dependency "rspec", '
|
25
|
-
s.add_development_dependency "simplecov", '
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
s.
|
30
|
-
s.
|
31
|
-
|
32
|
-
s.extra_rdoc_files = ["LICENSE", "README.rdoc"]
|
33
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
34
|
-
s.require_path = "lib"
|
35
|
-
end
|
21
|
+
s.add_development_dependency "rspec", '~> 2.6.0'
|
22
|
+
s.add_development_dependency "simplecov", '~> 0.4.1'
|
23
|
+
|
24
|
+
s.files = `git ls-files`.split("\n")
|
25
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
26
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
27
|
+
s.require_paths = ["lib"]
|
28
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yacht
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 0.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Mani Tadayon
|
@@ -16,7 +16,8 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date:
|
19
|
+
date: 2012-01-06 00:00:00 -08:00
|
20
|
+
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
22
23
|
name: classy_struct
|
@@ -24,7 +25,7 @@ dependencies:
|
|
24
25
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
26
|
none: false
|
26
27
|
requirements:
|
27
|
-
- -
|
28
|
+
- - ~>
|
28
29
|
- !ruby/object:Gem::Version
|
29
30
|
hash: 23
|
30
31
|
segments:
|
@@ -54,7 +55,7 @@ dependencies:
|
|
54
55
|
requirement: &id003 !ruby/object:Gem::Requirement
|
55
56
|
none: false
|
56
57
|
requirements:
|
57
|
-
- -
|
58
|
+
- - ~>
|
58
59
|
- !ruby/object:Gem::Version
|
59
60
|
hash: 31
|
60
61
|
segments:
|
@@ -99,7 +100,7 @@ dependencies:
|
|
99
100
|
requirement: &id006 !ruby/object:Gem::Requirement
|
100
101
|
none: false
|
101
102
|
requirements:
|
102
|
-
- -
|
103
|
+
- - ~>
|
103
104
|
- !ruby/object:Gem::Version
|
104
105
|
hash: 23
|
105
106
|
segments:
|
@@ -115,7 +116,7 @@ dependencies:
|
|
115
116
|
requirement: &id007 !ruby/object:Gem::Requirement
|
116
117
|
none: false
|
117
118
|
requirements:
|
118
|
-
- -
|
119
|
+
- - ~>
|
119
120
|
- !ruby/object:Gem::Version
|
120
121
|
hash: 13
|
121
122
|
segments:
|
@@ -133,13 +134,12 @@ executables: []
|
|
133
134
|
|
134
135
|
extensions: []
|
135
136
|
|
136
|
-
extra_rdoc_files:
|
137
|
-
|
138
|
-
- README.rdoc
|
137
|
+
extra_rdoc_files: []
|
138
|
+
|
139
139
|
files:
|
140
140
|
- .gitignore
|
141
141
|
- .rspec
|
142
|
-
- .
|
142
|
+
- .travis.yml
|
143
143
|
- .yardopts
|
144
144
|
- Gemfile
|
145
145
|
- HISTORY.md
|
@@ -164,22 +164,22 @@ files:
|
|
164
164
|
- lib/yacht/hash_helper.rb
|
165
165
|
- lib/yacht/javascript.rb
|
166
166
|
- lib/yacht/loader.rb
|
167
|
-
- lib/yacht/rails.rb
|
168
167
|
- lib/yacht/version.rb
|
169
168
|
- spec/monkeypatches/rails_helper_spec.rb
|
170
169
|
- spec/spec_helper.rb
|
170
|
+
- spec/support/constants.rb
|
171
171
|
- spec/yacht/base_spec.rb
|
172
172
|
- spec/yacht/classy_struct_spec.rb
|
173
173
|
- spec/yacht/javascript_spec.rb
|
174
174
|
- spec/yacht/loader_spec.rb
|
175
|
-
- spec/yacht/rails_spec.rb
|
176
175
|
- yacht.gemspec
|
176
|
+
has_rdoc: true
|
177
177
|
homepage: https://github.com/attinteractive/yacht
|
178
178
|
licenses: []
|
179
179
|
|
180
180
|
post_install_message:
|
181
|
-
rdoc_options:
|
182
|
-
|
181
|
+
rdoc_options: []
|
182
|
+
|
183
183
|
require_paths:
|
184
184
|
- lib
|
185
185
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -196,24 +196,31 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
196
|
requirements:
|
197
197
|
- - ">="
|
198
198
|
- !ruby/object:Gem::Version
|
199
|
-
hash:
|
199
|
+
hash: 3
|
200
200
|
segments:
|
201
|
-
-
|
202
|
-
|
203
|
-
- 7
|
204
|
-
version: 1.3.7
|
201
|
+
- 0
|
202
|
+
version: "0"
|
205
203
|
requirements: []
|
206
204
|
|
207
205
|
rubyforge_project:
|
208
|
-
rubygems_version: 1.
|
206
|
+
rubygems_version: 1.6.2
|
209
207
|
signing_key:
|
210
208
|
specification_version: 3
|
211
|
-
summary: yacht-0.
|
209
|
+
summary: yacht-0.3.0
|
212
210
|
test_files:
|
211
|
+
- features/load.feature
|
212
|
+
- features/missing_yaml_files.feature
|
213
|
+
- features/step_definitions/aruba_extension_steps.rb
|
214
|
+
- features/step_definitions/debugger_steps.rb
|
215
|
+
- features/step_definitions/error_handling_steps.rb
|
216
|
+
- features/step_definitions/javascript_steps.rb
|
217
|
+
- features/step_definitions/loader_steps.rb
|
218
|
+
- features/support/cleanup.rb
|
219
|
+
- features/support/env.rb
|
213
220
|
- spec/monkeypatches/rails_helper_spec.rb
|
214
221
|
- spec/spec_helper.rb
|
222
|
+
- spec/support/constants.rb
|
215
223
|
- spec/yacht/base_spec.rb
|
216
224
|
- spec/yacht/classy_struct_spec.rb
|
217
225
|
- spec/yacht/javascript_spec.rb
|
218
226
|
- spec/yacht/loader_spec.rb
|
219
|
-
- spec/yacht/rails_spec.rb
|
data/.rvmrc
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
|
3
|
-
# adapted from: http://rvm.beginrescueend.com/workflow/rvmrc/
|
4
|
-
|
5
|
-
ruby_string="1.9.2-p0"
|
6
|
-
gemset_name="yacht"
|
7
|
-
|
8
|
-
if rvm list strings | grep -q "${ruby_string}" ; then
|
9
|
-
|
10
|
-
# Load or create the specified environment
|
11
|
-
if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
|
12
|
-
&& -s "${rvm_path:-$HOME/.rvm}/environments/${ruby_string}@${gemset_name}" ]] ; then
|
13
|
-
\. "${rvm_path:-$HOME/.rvm}/environments/${ruby_string}@${gemset_name}"
|
14
|
-
else
|
15
|
-
rvm --create "${ruby_string}@${gemset_name}"
|
16
|
-
fi
|
17
|
-
|
18
|
-
else
|
19
|
-
|
20
|
-
# Notify the user to install the desired interpreter before proceeding.
|
21
|
-
echo "${ruby_string} was not found, please run 'rvm install ${ruby_string}' and then cd back into the project directory."
|
22
|
-
|
23
|
-
fi
|
data/lib/yacht/rails.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
class Yacht::Loader
|
2
|
-
class << self
|
3
|
-
# use the current rails environment by default
|
4
|
-
def environment
|
5
|
-
@environment ||= Rails.env
|
6
|
-
end
|
7
|
-
|
8
|
-
def dir
|
9
|
-
@dir ||= Rails.root.join('config', 'yacht')
|
10
|
-
end
|
11
|
-
|
12
|
-
def full_file_path_for_config(config_type)
|
13
|
-
dir.join("#{config_type}.yml")
|
14
|
-
end
|
15
|
-
|
16
|
-
# Add current Rails environment to defined keys
|
17
|
-
def all_with_rails_env
|
18
|
-
all_without_rails_env.merge('rails_env' => Rails.env)
|
19
|
-
end
|
20
|
-
# alias_method_chain is wonky in rspec with ruby 1.8.7
|
21
|
-
alias_method :all_without_rails_env, :all
|
22
|
-
alias_method :all, :all_with_rails_env
|
23
|
-
|
24
|
-
end
|
25
|
-
end
|
data/spec/yacht/rails_spec.rb
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Rails support" do
|
4
|
-
subject { Yacht::Loader }
|
5
|
-
|
6
|
-
before do
|
7
|
-
Rails = stub("Rails")
|
8
|
-
Object.stub(:alias_method_chain).as_null_object
|
9
|
-
require "yacht/rails"
|
10
|
-
@yacht_dir = "/path/to/rails/config/yacht"
|
11
|
-
end
|
12
|
-
|
13
|
-
describe :environment do
|
14
|
-
it "uses the current rails environment by default" do
|
15
|
-
Rails.should_receive(:env).and_return('awesome')
|
16
|
-
|
17
|
-
subject.environment.should == 'awesome'
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
describe :dir do
|
22
|
-
it "uses config/yacht by default" do
|
23
|
-
Rails.stub_chain(:root, :join).and_return(@yacht_dir)
|
24
|
-
|
25
|
-
subject.dir.should == @yacht_dir
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe :full_file_path_for_config do
|
30
|
-
it "calls dir.join" do
|
31
|
-
fake_dir = stub("dir stub")
|
32
|
-
subject.stub(:dir).and_return(fake_dir)
|
33
|
-
fake_dir.should_receive(:join).with("some.yml")
|
34
|
-
|
35
|
-
subject.full_file_path_for_config("some")
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe :all_with_rails_env do
|
40
|
-
it "adds the current Rails environment to super" do
|
41
|
-
subject.stub(:all_without_rails_env).and_return(:foo => :bar)
|
42
|
-
|
43
|
-
Rails.stub(:env).and_return(:awesome)
|
44
|
-
subject.all_with_rails_env.should == {:foo => :bar, 'rails_env' => :awesome}
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|