Skip to content

Commit

Permalink
Merge pull request #1046 from mzazrivec/dont_interpolate_inside_a_get…
Browse files Browse the repository at this point in the history
…text_string

Dont interpolate inside a gettext string
  • Loading branch information
Dan Clarizio authored Apr 18, 2017
2 parents 680b180 + 85b29f7 commit 3100e3a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion app/views/report/_form_filter_chargeback.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
= ui_lookup(:model => @edit[:new][:cb_model])
.col-md-8
- opts = [["<#{_('Choose %{entity}')}>" % {:entity => ui_lookup(:model => @edit[:new][:cb_model])}, nil],
[_("All #{ui_lookup(:tables => @edit[:new][:cb_model].to_s)}"), :all]]
[_("All %{chargeback_type}") % {:chargeback_type => ui_lookup(:tables => @edit[:new][:cb_model].to_s)}, :all]]
- if @cb_entities_by_provider_id[@edit[:new][:cb_provider_id].to_i].present?
- opts += Array(@cb_entities_by_provider_id[@edit[:new][:cb_provider_id].to_i][@edit[:new][:cb_model].underscore.to_sym].invert).sort_by { |a| a.first.downcase }
= select_tag('cb_entity_id',
Expand Down
30 changes: 15 additions & 15 deletions spec/controllers/ems_infra_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
expect(controller.send(:flash_errors?)).to be_truthy
flash_messages = assigns(:flash_array)
expect(flash_messages.first[:message]).to include(
_("A value must be changed or provider stack will not be updated."))
"A value must be changed or provider stack will not be updated.")
end

it "when values are changed, but exceed number of hosts available" do
Expand All @@ -124,7 +124,7 @@
expect(controller.send(:flash_errors?)).to be_truthy
flash_messages = assigns(:flash_array)
expect(flash_messages.first[:message]).to include(
_("Assigning #{@ems.hosts.count * 2} but only have #{@ems.hosts.count} hosts available."))
"Assigning #{@ems.hosts.count * 2} but only have #{@ems.hosts.count} hosts available.")
end

it "when values are changed, and values do not exceed number of hosts available" do
Expand All @@ -145,17 +145,17 @@
post :scaling, :params => { :id => @ems.id, :scale => "", :orchestration_stack_id => nil }
expect(controller.send(:flash_errors?)).to be_truthy
flash_messages = assigns(:flash_array)
expect(flash_messages.first[:message]).to include(_("Orchestration stack could not be found."))
expect(flash_messages.first[:message]).to include("Orchestration stack could not be found.")
end

it "when patch operation fails, an error message should be displayed" do
allow_any_instance_of(ManageIQ::Providers::Openstack::InfraManager::OrchestrationStack)
.to receive(:update_stack_queue) { raise _("my error") }
.to receive(:update_stack_queue) { raise "my error" }
post :scaling, :params => { :id => @ems.id, :scale => "", :orchestration_stack_id => @ems.orchestration_stacks.first.id,
@orchestration_stack_parameter_compute.name => 2 }
expect(controller.send(:flash_errors?)).to be_truthy
flash_messages = assigns(:flash_array)
expect(flash_messages.first[:message]).to include(_("Unable to initiate scaling: my error"))
expect(flash_messages.first[:message]).to include("Unable to initiate scaling: my error")
end

it "when operation in progress, an error message should be displayed" do
Expand All @@ -166,7 +166,7 @@
expect(controller.send(:flash_errors?)).to be_truthy
flash_messages = assigns(:flash_array)
expect(flash_messages.first[:message]).to include(
_("Provider stack is not ready to be updated, another operation is in progress."))
"Provider stack is not ready to be updated, another operation is in progress.")
end
end

Expand All @@ -184,7 +184,7 @@
:orchestration_stack_id => @ems.orchestration_stacks.first.id, :host_ids => []}
expect(controller.send(:flash_errors?)).to be_truthy
flash_messages = assigns(:flash_array)
expect(flash_messages.first[:message]).to include(_("No compute hosts were selected for scale down."))
expect(flash_messages.first[:message]).to include("No compute hosts were selected for scale down.")
end

it "when values are changed, but selected host is in incorrect state" do
Expand All @@ -193,7 +193,7 @@
expect(controller.send(:flash_errors?)).to be_truthy
flash_messages = assigns(:flash_array)
expect(flash_messages.first[:message]).to include(
_("Not all hosts can be removed from the deployment."))
"Not all hosts can be removed from the deployment.")
end

it "when values are changed, and selected host is in correct state" do
Expand All @@ -214,17 +214,17 @@
post :scaledown, :params => {:id => @ems.id, :scaledown => "", :orchestration_stack_id => nil}
expect(controller.send(:flash_errors?)).to be_truthy
flash_messages = assigns(:flash_array)
expect(flash_messages.first[:message]).to include(_("Orchestration stack could not be found."))
expect(flash_messages.first[:message]).to include("Orchestration stack could not be found.")
end

it "when patch operation fails, an error message should be displayed" do
allow_any_instance_of(ManageIQ::Providers::Openstack::InfraManager::OrchestrationStack)
.to receive(:update_stack_queue) { raise _("my error") }
.to receive(:update_stack_queue) { raise "my error" }
post :scaledown, :params => {:id => @ems.id, :scaledown => "",
:orchestration_stack_id => @ems.orchestration_stacks.first.id, :host_ids => [@ems.hosts[1].id]}
expect(controller.send(:flash_errors?)).to be_truthy
flash_messages = assigns(:flash_array)
expect(flash_messages.first[:message]).to include(_("Unable to initiate scaling: my error"))
expect(flash_messages.first[:message]).to include("Unable to initiate scaling: my error")
end

it "when operation in progress, an error message should be displayed" do
Expand All @@ -235,7 +235,7 @@
expect(controller.send(:flash_errors?)).to be_truthy
flash_messages = assigns(:flash_array)
expect(flash_messages.first[:message]).to include(
_("Provider stack is not ready to be updated, another operation is in progress."))
"Provider stack is not ready to be updated, another operation is in progress.")
end
end

Expand Down Expand Up @@ -265,7 +265,7 @@
post :register_nodes, :params => {:id => @ems.id, :nodes_json => @nodes_example, :register => 1}
expect(controller.send(:flash_errors?)).to be_truthy
flash_messages = assigns(:flash_array)
message = _("Cannot connect to workflow service")
message = "Cannot connect to workflow service"
expect(flash_messages.first[:message]).to include(message)
end

Expand All @@ -275,15 +275,15 @@
post :register_nodes, :params => {:id => @ems.id, :nodes_json => @nodes_example, :register => 1}
expect(controller.send(:flash_errors?)).to be_truthy
flash_messages = assigns(:flash_array)
message = _("Error executing register and configure workflows")
message = "Error executing register and configure workflows"
expect(flash_messages.first[:message]).to include(message)
end

it "when failure expected, node_json file is not selected" do
post :register_nodes, :params => {:id => @ems.id, :register => 1}
expect(controller.send(:flash_errors?)).to be_truthy
flash_messages = assigns(:flash_array)
message = _("Please select a JSON file containing the nodes you would like to register.")
message = "Please select a JSON file containing the nodes you would like to register."
expect(flash_messages.first[:message]).to include(message)
end
end
Expand Down

0 comments on commit 3100e3a

Please sign in to comment.