copycopter_client 1.0.0.beta4 → 1.0.0.beta5

Sign up to get free protection for your applications and to get access to all the features.
@@ -115,6 +115,7 @@ Feature: Using copycopter in a rails app
115
115
  def index
116
116
  @text = t("users.index.controller-test", :default => "default")
117
117
  @unpublished = t("users.index.unpublished-test", :default => "Unpublished")
118
+ t("users.index.unknown-test", :default => "Unknown")
118
119
  end
119
120
  end
120
121
  """
@@ -124,12 +125,15 @@ Feature: Using copycopter in a rails app
124
125
  <%= @text %>
125
126
  <%= @unpublished %>
126
127
  """
127
- When I configure the copycopter client to use published data
128
- And I start the application
128
+ When I start the application in the "production" environment
129
129
  And I wait for changes to be synchronized
130
130
  And I visit /users/
131
131
  Then the response should contain "This is a test"
132
132
  And the response should contain "Unpublished"
133
+ And I wait for changes to be synchronized
134
+ And the "abc123" project should have the following blurbs:
135
+ | key | draft content |
136
+ | en.users.index.unknown-test | Unknown |
133
137
 
134
138
  Scenario: backwards compatibility
135
139
  Given the "abc123" project has the following blurbs:
@@ -44,6 +44,18 @@ When "I start the application" do
44
44
  end
45
45
  end
46
46
 
47
+ When /^I start the application in the "([^"]+)" environment$/ do |environment|
48
+ in_current_dir do
49
+ old_environment = ENV['RAILS_ENV']
50
+ begin
51
+ ENV['RAILS_ENV'] = environment
52
+ RailsServer.start(ENV['RAILS_PORT'], @announce_stderr)
53
+ ensure
54
+ ENV['RAILS_ENV'] = old_environment
55
+ end
56
+ end
57
+ end
58
+
47
59
  When /^I visit (\/.*)$/ do |path|
48
60
  @last_response = RailsServer.get(path)
49
61
  end
@@ -48,7 +48,7 @@ module CopycopterClient
48
48
  return fallback_value if fallback_value && !fallback_value.respond_to?(:to_str)
49
49
 
50
50
  default = fallback_value || options.delete(:default)
51
- content = super(locale, key, options.update(:default => default))
51
+ content = super(locale, key, options.update(:default => default, :fallback => true))
52
52
  if content.respond_to?(:html_safe)
53
53
  content.html_safe
54
54
  else
@@ -1,6 +1,6 @@
1
1
  module CopycopterClient
2
2
  # Client version
3
- VERSION = "1.0.0.beta4"
3
+ VERSION = "1.0.0.beta5"
4
4
 
5
5
  # API version being used to communicate with the server
6
6
  API_VERSION = "2.0"
@@ -130,4 +130,22 @@ describe CopycopterClient::I18nBackend do
130
130
  should include('Expected')
131
131
  end
132
132
  end
133
+
134
+ describe "with a backend using fallbacks" do
135
+ subject { build_backend }
136
+
137
+ before do
138
+ CopycopterClient::I18nBackend.class_eval do
139
+ include I18n::Backend::Fallbacks
140
+ end
141
+ end
142
+
143
+ it "queues missing keys with default" do
144
+ default = 'default value'
145
+
146
+ subject.translate('en', 'test.key', :default => default).should == default
147
+
148
+ sync['en.test.key'].should == default
149
+ end
150
+ end
133
151
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: copycopter_client
3
3
  version: !ruby/object:Gem::Version
4
- hash: 299253592
4
+ hash: 299253593
5
5
  prerelease: true
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
9
  - 0
10
- - beta4
11
- version: 1.0.0.beta4
10
+ - beta5
11
+ version: 1.0.0.beta5
12
12
  platform: ruby
13
13
  authors:
14
14
  - thoughtbot
@@ -26,12 +26,14 @@ dependencies:
26
26
  version_requirements: &id001 !ruby/object:Gem::Requirement
27
27
  none: false
28
28
  requirements:
29
- - - ">="
29
+ - - ~>
30
30
  - !ruby/object:Gem::Version
31
- hash: 3
31
+ hash: 11
32
32
  segments:
33
33
  - 0
34
- version: "0"
34
+ - 5
35
+ - 0
36
+ version: 0.5.0
35
37
  requirement: *id001
36
38
  - !ruby/object:Gem::Dependency
37
39
  type: :runtime