Skip to content

Commit

Permalink
PR feedback -- rename the virtual column and consolidate the test
Browse files Browse the repository at this point in the history
  • Loading branch information
AparnaKarve committed Jan 12, 2017
1 parent d674956 commit af354f5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions app/models/miq_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ class MiqRequest < ApplicationRecord
virtual_column :v_approved_by_email, :type => :string, :uses => {:miq_approvals => :stamper}
virtual_column :stamped_on, :type => :datetime, :uses => :miq_approvals
virtual_column :v_allowed_tags, :type => :string, :uses => :workflow
virtual_column :v_class, :type => :string, :uses => :workflow
virtual_column :v_workflow_class, :type => :string, :uses => :workflow
virtual_column :request_type_display, :type => :string
virtual_column :resource_type, :type => :string
virtual_column :state, :type => :string

delegate :allowed_tags, :to => :workflow, :prefix => :v
delegate :class, :to => :workflow, :prefix => :v
delegate :class, :to => :workflow, :prefix => :v_workflow

virtual_has_one :workflow

Expand Down
18 changes: 9 additions & 9 deletions spec/requests/api/requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -246,17 +246,17 @@
request.add_tag(t.name, t.children.first.name)

api_basic_authorize action_identifier(:requests, :read, :resource_actions, :get)
run_get requests_url(request.id), :attributes => "workflow,v_allowed_tags,v_class"
run_get requests_url(request.id), :attributes => "workflow,v_allowed_tags,v_workflow_class"

expected_workflow = a_hash_including("id" => request.id, "workflow" => a_hash_including("values"))
expected_tags = a_hash_including("id" => request.id, "v_allowed_tags" => [a_hash_including("children")])
expected_class = a_hash_including(
"id" => request.id,
"v_class" => {"instance_logger" => a_hash_including("klass" => request.workflow.class.to_s)})
expected_response = a_hash_including(
"id" => request.id,
"workflow" => a_hash_including("values"),
"v_allowed_tags" => [a_hash_including("children")],
"v_workflow_class" => a_hash_including(
"instance_logger" => a_hash_including("klass" => request.workflow.class.to_s))
)

expect(response.parsed_body).to match(expected_workflow)
expect(response.parsed_body).to match(expected_tags)
expect(response.parsed_body).to match(expected_class)
expect(response.parsed_body).to match(expected_response)
expect(response).to have_http_status(:ok)
end
end
Expand Down

0 comments on commit af354f5

Please sign in to comment.