From: Michal Fojtik <[email protected]>

---
 server/tests/instance_states_test.rb               |    2 +-
 server/views/instance_states/show.html.haml        |    2 +-
 tests/mock/step_definitions/api_steps.rb           |   10 +++++++++-
 .../mock/step_definitions/instance_states_steps.rb |    2 +-
 4 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/server/tests/instance_states_test.rb 
b/server/tests/instance_states_test.rb
index 77acf3c..e931dc5 100644
--- a/server/tests/instance_states_test.rb
+++ b/server/tests/instance_states_test.rb
@@ -42,7 +42,7 @@ module DeltacloudUnitTest
     end
 
     def test_it_responses_to_png
-      do_request '/api/instance_states.png', {}, false
+      do_request '/api/instance_states', { :format => 'png' }, false
       last_response.status.should == 200
       last_response.headers['Content-Type'].should == 'image/png'
     end
diff --git a/server/views/instance_states/show.html.haml 
b/server/views/instance_states/show.html.haml
index 0f67db1..21c6343 100644
--- a/server/views/instance_states/show.html.haml
+++ b/server/views/instance_states/show.html.haml
@@ -1,7 +1,7 @@
 %h1 Instance States
 
 %div#state_graph
-  = image_tag url_for( '/api/instance_states.png' )
+  = image_tag url_for( '/api/instance_states?format=png' )
 
 %table.states
   %thead
diff --git a/tests/mock/step_definitions/api_steps.rb 
b/tests/mock/step_definitions/api_steps.rb
index 0af6f98..e55a4eb 100644
--- a/tests/mock/step_definitions/api_steps.rb
+++ b/tests/mock/step_definitions/api_steps.rb
@@ -52,7 +52,15 @@ end
 Then /^this URI should be available in (.+) format$/ do |formats|
   @no_header = true
   formats.split(',').each do |format|
-    get "#...@uri}.#{format.strip.downcase}", {}
+    case format.downcase
+      when 'xml':
+        header 'Accept', 'application/xml;q=9'
+      when 'json'
+        header 'Accept', 'application/json;q=9'
+      when 'html'
+        header 'Accept', 'application/xml+xhtml;q=9'
+    end
+    get @uri, {}
     last_response.status.should == 200
   end
   @no_header = false
diff --git a/tests/mock/step_definitions/instance_states_steps.rb 
b/tests/mock/step_definitions/instance_states_steps.rb
index a587e5d..fd391fb 100644
--- a/tests/mock/step_definitions/instance_states_steps.rb
+++ b/tests/mock/step_definitions/instance_states_steps.rb
@@ -25,7 +25,7 @@ Then /^each transitions should have 'to' attribute$/ do
 end
 
 When /^client wants (\w+) format$/ do |format|
-  get "#...@uri}.#{format.downcase}", {}
+  get @uri, { :format => format.downcase }
 end
 
 Then /^client should get PNG image$/ do
-- 
1.7.2.3

Reply via email to