Skip to content

Commit

Permalink
Prefix key to fetch html with namespace
Browse files Browse the repository at this point in the history
- The value of the ":current" key put there by ember-cli-deploy is the
  revision, not the redis key
  • Loading branch information
kategengler committed Oct 15, 2015
1 parent d5b8aca commit 7b22227
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lib/ember-cli/deploy/redis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def current_key
end

def deploy_key
redis_client.get(current_key).presence || deployment_not_activated!
key = redis_client.get(current_key).presence || deployment_not_activated!
"#{namespace}:#{key}"
end

def build_client
Expand Down
8 changes: 4 additions & 4 deletions spec/lib/ember-cli/deploy/redis_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@

context "when the current index is missing" do
it "raises a helpful exception" do
deploy_key = "#{namespace}:abc123"
deploy_key = "abc123"
stub_index_html(html: nil, deploy_key: deploy_key)
ember_cli_deploy = build_ember_cli_deploy

expect { ember_cli_deploy.html }.to raise_error(
/HTML for #{deploy_key} is missing/
/HTML for #{namespace}:#{deploy_key} is missing/
)
end
end
Expand Down Expand Up @@ -98,9 +98,9 @@ def stub_current_key(deploy_key)
redis.set(current_key, deploy_key)
end

def stub_index_html(deploy_key: "#{namespace}:123", html:)
def stub_index_html(deploy_key: "123", html:)
stub_current_key(deploy_key)
redis.set(deploy_key, html)
redis.set("#{namespace}:#{deploy_key}", html)
end

def redis
Expand Down

0 comments on commit 7b22227

Please sign in to comment.