diff options
| author | Marc Florisson | 2012-12-10 18:07:12 +0100 |
|---|---|---|
| committer | Marc Florisson | 2012-12-10 18:07:12 +0100 |
| commit | ffbe6d39c8050a63280566d8a4163bc4e7389809 (patch) | |
| tree | 53e30929c66f7dd44bb0b32b7e4752e3c5959624 /spec/controllers/api | |
| parent | 4a0e5fe475fd7f852f67803a83c80238538bdb8f (diff) | |
| parent | 65f9199029841f1d0f97d9aabdc733d49b37032f (diff) | |
| download | chouette-core-ffbe6d39c8050a63280566d8a4163bc4e7389809.tar.bz2 | |
Merge branch 'api'
Diffstat (limited to 'spec/controllers/api')
| -rw-r--r-- | spec/controllers/api/v1/lines_controller_spec.rb | 15 | ||||
| -rw-r--r-- | spec/controllers/api/v1/networks_controller_spec.rb | 35 |
2 files changed, 50 insertions, 0 deletions
diff --git a/spec/controllers/api/v1/lines_controller_spec.rb b/spec/controllers/api/v1/lines_controller_spec.rb new file mode 100644 index 000000000..5bd8cac57 --- /dev/null +++ b/spec/controllers/api/v1/lines_controller_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe Api::V1::LinesController do + let!(:line) { referential.lines.first || create(:line) } + + 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}" + end + end +end diff --git a/spec/controllers/api/v1/networks_controller_spec.rb b/spec/controllers/api/v1/networks_controller_spec.rb new file mode 100644 index 000000000..01e3ee35d --- /dev/null +++ b/spec/controllers/api/v1/networks_controller_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' + +describe Api::V1::NetworksController do + let!(:network) { referential.networks.first || create(:network) } + + it_behaves_like "api key protected controller" do + let(:data){network} + end + + describe "GET #show" do + context "when authorization provided and request.accept is json" do + before :each do + config_formatted_request_with_authorization( "application/json") + get :show, :id => network.objectid + end + + it "should assign expected network" do + assigns[:network].should == network + end + end + end + describe "GET #index" do + 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 networks" do + assigns[:networks].should == [network] + end + end + end + +end |
