aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Florisson2014-05-23 15:17:07 +0200
committerMarc Florisson2014-05-23 15:17:07 +0200
commitd10110dc68a589164e0e49d84e630f2ca504d949 (patch)
tree307e1b6ca9defe5d9b508841a3056c9f0f9090cd
parent21b05c1fd97c4b204dce4bc9268823604db3eabc (diff)
downloadchouette-core-d10110dc68a589164e0e49d84e630f2ca504d949.tar.bz2
clean useless code, after adding stop_points in route#edit
-rw-r--r--app/controllers/stop_points_controller.rb30
-rw-r--r--app/views/routes/show.html.erb3
-rw-r--r--config/routes.rb5
-rw-r--r--spec/controllers/stop_points_controller_spec.rb81
4 files changed, 0 insertions, 119 deletions
diff --git a/app/controllers/stop_points_controller.rb b/app/controllers/stop_points_controller.rb
deleted file mode 100644
index 22b23cff5..000000000
--- a/app/controllers/stop_points_controller.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-class StopPointsController < ChouetteController
- defaults :resource_class => Chouette::StopPoint
-
- respond_to :html
-
- belongs_to :referential do
- belongs_to :line, :parent_class => Chouette::Line do
- belongs_to :route, :parent_class => Chouette::Route
- end
- end
-
- alias_method :route, :parent
-
- def create
- create! do |success, failure|
- success.html { redirect_to :action => :index }
- end
- end
-
- def sort
- if route.reorder!( params[:stop_point])
- flash[:notice] = t("stop_points.reorder_success")
- else
- flash[:alert] = t("stop_points.reorder_failure")
- end
- redirect_to :action => :index
- end
-
-end
-
diff --git a/app/views/routes/show.html.erb b/app/views/routes/show.html.erb
index 7f9f71ba2..8383366b3 100644
--- a/app/views/routes/show.html.erb
+++ b/app/views/routes/show.html.erb
@@ -82,9 +82,6 @@
<ul class="actions">
<li><%= link_to t('routes.actions.edit'), edit_referential_line_route_path(@referential, @line, @route), :class => "edit" %></li>
<li><%= link_to t('routes.actions.destroy'), referential_line_route_path(@referential, @line, @route), :method => :delete, :data => {:confirm => t('routes.actions.destroy_confirm')}, :class => "remove" %></li>
- <li>
- <%= link_to t('stop_points.actions.sort'), [@referential, @line, @route, :stop_points], :class => "edit" %>
- </li>
<% if @route.stop_points.size >= 2 %>
<li>
<%= link_to t('journey_patterns.actions.new'), new_referential_line_route_journey_pattern_path(@referential, @line, @route), :class => "add" %>
diff --git a/config/routes.rb b/config/routes.rb
index de77856f3..92c8b0b20 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -92,11 +92,6 @@ ChouetteIhm::Application.routes.draw do
get 'select_journey_pattern', :on => :member
resources :vehicle_translations
end
- resources :stop_points do
- collection do
- post :sort
- end
- end
end
end
diff --git a/spec/controllers/stop_points_controller_spec.rb b/spec/controllers/stop_points_controller_spec.rb
deleted file mode 100644
index b6d9affbd..000000000
--- a/spec/controllers/stop_points_controller_spec.rb
+++ /dev/null
@@ -1,81 +0,0 @@
-require 'spec_helper'
-
-describe StopPointsController do
- login_user
-
- let!(:route) { Factory(:route) }
- let(:permutated_stop_point_ids) {
- old_stop_point_ids = route.stop_points.map(&:id)
- old_stop_point_ids.permutation.to_a.select { |permutated| permutated != old_stop_point_ids}.first
- }
-
- it { should be_kind_of(ChouetteController) }
-
- shared_examples_for "redirected to referential_line_stop_points_path(referential,line,route)" do
- it "should redirect_to referential_line_route_stop_points_path(referential,line,route)" do
- response.should redirect_to( referential_line_route_stop_points_path(referential,route.line,route) )
- end
- end
- shared_examples_for "route, line and referential linked (stop_points)" do
- it "assigns route as @route" do
- assigns[:route].should == route
- end
- it "assigns route.line as @line" do
- assigns[:line].should == route.line
- end
-
- it "assigns referential as @referential" do
- assigns[:referential].should == referential
- end
- end
-
- describe "sort routing" do
- let(:path) { sort_referential_line_route_stop_points_path( referential, route.line, route)}
- it "routes /referential/:referentialid/line/:lineid/route/:routeid/stop_points/sort to stop_points#sort" do
- { :post => path }.should route_to(:controller => "stop_points",
- :action => "sort",
- :referential_id => referential.id.to_s,
- :line_id => route.line_id.to_s,
- :route_id => route.id.to_s )
- end
- end
-
- describe "POST /sort" do
- before(:each) do
- post :sort, :line_id => route.line_id,
- :route_id => route.id,
- :referential_id => referential.id,
- :stop_point => permutated_stop_point_ids
- end
- it_behaves_like "route, line and referential linked (stop_points)"
- it_behaves_like "redirected to referential_line_stop_points_path(referential,line,route)"
- end
-
- describe "#sort" do
- it "should delegate to route.sort! with permutated_stop_point_ids" do
- controller.stub!(:route => route, :params => { :stop_point => permutated_stop_point_ids})
- controller.stub!(:redirect_to => nil)
- route.should_receive(:reorder!).with(permutated_stop_point_ids)
- controller.sort
- end
- end
- describe "GET /index" do
- before(:each) do
- get :index, :line_id => route.line_id,
- :route_id => route.id,
- :referential_id => referential.id
- end
- it_behaves_like "route, line and referential linked (stop_points)"
- end
- describe "POST /create" do
- before(:each) do
- post :create, :line_id => route.line_id,
- :referential_id => referential.id,
- :route_id => route.id,
- :stop_point => Factory.attributes_for(:stop_point)
-
- end
- it_behaves_like "route, line and referential linked (stop_points)"
- #it_behaves_like "redirected to referential_line_stop_points_path(referential,line,route)"
- end
-end