zdzolton-cambric 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.2
1
+ 0.6.3
data/cambric.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{cambric}
5
- s.version = "0.6.2"
5
+ s.version = "0.6.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Zachary Zolton", "Geoff Buesing"]
9
- s.date = %q{2009-06-05}
9
+ s.date = %q{2009-06-09}
10
10
  s.email = %q{zachary.zolton@gmail.com}
11
11
  s.extra_rdoc_files = [
12
12
  "LICENSE",
@@ -4,7 +4,12 @@ module Cambric
4
4
  attr_accessor :cambric_design_doc_name
5
5
 
6
6
  def view name, options={}, &block
7
- super "#{@cambric_design_doc_name}/#{name}", options, &block
7
+ case name
8
+ when String
9
+ super name, options, &block
10
+ when Symbol
11
+ super "#{@cambric_design_doc_name}/#{name}", options, &block
12
+ end
8
13
  end
9
14
 
10
15
  def cambric_design_doc
data/lib/cambric.rb CHANGED
@@ -16,14 +16,20 @@ module Cambric
16
16
  def self.environment
17
17
  @environment
18
18
  end
19
+
20
+ def self.environment= value
21
+ @config.environment = value
22
+ @databases = @config.initialize_databases
23
+ @environment = @config.environment
24
+ end
19
25
 
20
26
  def self.configure
21
- config = Configurator.new
22
- yield config if block_given?
23
- @databases = config.initialize_databases
24
- @design_doc_name = config.design_doc_name
25
- @db_dir = config.db_dir
26
- @environment = config.environment
27
+ @config = Configurator.new
28
+ yield @config if block_given?
29
+ @databases = @config.initialize_databases
30
+ @design_doc_name = @config.design_doc_name
31
+ @db_dir = @config.db_dir
32
+ @environment = @config.environment
27
33
  end
28
34
 
29
35
  def self.create_databases!
@@ -11,7 +11,11 @@ describe Cambric::AssumeDesignDocName do
11
11
  after(:all){ delete_twitter_clone_databases }
12
12
 
13
13
  it "should be able to query view without re-specifying design doc name" do
14
- Cambric[:tweets].view 'by_follower_and_created_at'
14
+ Cambric[:tweets].view :by_follower_and_created_at
15
+ end
16
+
17
+ it "should be able to specify design doc name when giving a string" do
18
+ Cambric[:tweets].view 'twitter-clone/by_follower_and_created_at'
15
19
  end
16
20
 
17
21
  it "should get the design doc specified by configuration" do
@@ -50,6 +50,20 @@ describe Cambric do
50
50
  it "should not blow up when calling push_design_docs for non-existent directories" do
51
51
  Cambric.push_design_docs
52
52
  end
53
+
54
+ describe "after changing the environment" do
55
+ before :all do
56
+ Cambric.environment = 'development'
57
+ end
58
+
59
+ it "should match the new environment value" do
60
+ Cambric.environment.should == 'development'
61
+ end
62
+
63
+ it "should match the expected database URI for the new environment" do
64
+ Cambric[:tweets].uri.should == 'http://127.0.0.1:5984/tweets-development'
65
+ end
66
+ end
53
67
  end
54
68
 
55
69
  describe "after creating databases" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zdzolton-cambric
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zachary Zolton
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-06-05 00:00:00 -07:00
13
+ date: 2009-06-09 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency