diff options
4 files changed, 15 insertions, 12 deletions
diff --git a/app/controllers/api/v1/chouette_controller.rb b/app/controllers/api/v1/chouette_controller.rb index 81851013c..b8879cd3f 100644 --- a/app/controllers/api/v1/chouette_controller.rb +++ b/app/controllers/api/v1/chouette_controller.rb @@ -10,8 +10,6 @@ private def authenticate authenticate_or_request_with_http_token do |token, options| - puts "token=#{token}" - puts "Api::V1::ApiKey.all.map(&:token)=#{Api::V1::ApiKey.all.map(&:token).join(',')}" @referential = Api::V1::ApiKey.referential_from_token(token) @api_key = @referential.api_keys.find_by_token(token) if @referential diff --git a/spec/controllers/api/v1/lines_controller_spec.rb b/spec/controllers/api/v1/lines_controller_spec.rb index 5bd8cac57..1d9383593 100644 --- a/spec/controllers/api/v1/lines_controller_spec.rb +++ b/spec/controllers/api/v1/lines_controller_spec.rb @@ -1,15 +1,21 @@ require 'spec_helper' describe Api::V1::LinesController do - let!(:line) { referential.lines.first || create(:line) } + let!(:line) { referential.lines.first || create(:line) } - it_behaves_like "api key protected controller" do - let(:data){line} - end + it_behaves_like "api key protected controller" do + let(:data){line} + end describe "GET #index" do - it "test" do - puts referential.inspect - puts "in spec api_key=#{api_key.inspect}" + context "when authorization provided and request.accept is json" do + before :each do + config_formatted_request_with_authorization( "application/json") + get :index + end + + it "should assign expected lines" do + assigns[:lines].should == [line] + end end end end diff --git a/spec/controllers/api/v1/networks_controller_spec.rb b/spec/controllers/api/v1/networks_controller_spec.rb index f3db35369..01e3ee35d 100644 --- a/spec/controllers/api/v1/networks_controller_spec.rb +++ b/spec/controllers/api/v1/networks_controller_spec.rb @@ -5,7 +5,6 @@ describe Api::V1::NetworksController do it_behaves_like "api key protected controller" do let(:data){network} - let(:referential){referential} end describe "GET #show" do diff --git a/spec/controllers/api/v1/stop_area_controller_spec.rb b/spec/controllers/api/v1/stop_area_controller_spec.rb index cd1c2020b..8ed59f658 100644 --- a/spec/controllers/api/v1/stop_area_controller_spec.rb +++ b/spec/controllers/api/v1/stop_area_controller_spec.rb @@ -13,8 +13,8 @@ describe Api::V1::StopAreasController do config_formatted_request_with_authorization( "application/json") get :index, :route_id => route.objectid, :line_id => route.line.objectid end - it "test" do - assigns[:stop_areas].should == route.stop_areas + it "should assign expected stop_areas" do + assigns[:stop_areas].map(&:id).sort.should == route.stop_areas.map(&:id).sort end end end |
