Skip to content

Commit

Permalink
renaming the action name run_memory_exercise to exercise_memory to be…
Browse files Browse the repository at this point in the history
… more succinct and easier to sort, and to better match the terminology used in the app
  • Loading branch information
gvt committed Aug 13, 2008
1 parent 349ec17 commit edff031
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions app/controllers/hosts_controller.rb
Expand Up @@ -14,9 +14,9 @@ def exercise_performance
redirect_to :action => 'watch_exercise', :id => @exercise.id
end

verify :only => :run_memory_exercise, :params => [:id, :uri], :method => :post,
verify :only => :exercise_memory, :params => [:id, :uri], :method => :post,
:add_flash => {:error => 'some information was missing from the request'}, :redirect_to => {:controller => 'hosts', :action => 'index'}
def run_memory_exercise
def exercise_memory
@uri = params[:uri].to_s.strip
if @uri.blank?
flash[:error] = "the input parameter \"uri\" was absent"
Expand Down
2 changes: 1 addition & 1 deletion app/views/hosts/_exercise.html.erb
Expand Up @@ -35,7 +35,7 @@
<td align="right"><%= sample.page_size %></td>
<td align="right" class="<%= sample.changed_memory < 500 ? 'good' : 'bad' rescue nil %>"><%= sample.changed_memory %></td>
<td align="right" class="<%= sample.total_memory < 500 ? 'good' : 'bad' rescue nil %>"><%= sample.total_memory %></td>
<td><%= button_to 'memory test', memory_exercise_path(
<td><%= button_to 'memory test', exercise_memory_path(
:id => @exercise.host.id, :uri => sample.page_uri) %>
</td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Expand Up @@ -9,7 +9,7 @@

# named routes
map.exercise_performance '/hosts/:id/exercise_performance', :controller => 'hosts', :action => 'exercise_performance'
map.memory_exercise '/hosts/:id/run_memory_exercise', :controller => 'hosts', :action => 'run_memory_exercise'
map.exercise_memory '/hosts/:id/exercise_memory', :controller => 'hosts', :action => 'exercise_memory'

# Install the default routes as the lowest priority.
map.connect ':controller/:action/:id'
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/hosts_controller_spec.rb
Expand Up @@ -383,14 +383,14 @@ def do_request(id = nil)
end
end

describe "handling POST /hosts/:host_id/run_memory_exercise" do
describe "handling POST /hosts/:host_id/exercise_memory" do

before(:each) do
@host = hosts(:localhost)
end

def do_request(host_id = nil, uri = nil)
post :run_memory_exercise,
post :exercise_memory,
:id => (host_id || @host.id),
:uri => uri,
:aut_version => @aut_version = '192837',
Expand Down
8 changes: 4 additions & 4 deletions spec/controllers/hosts_routing_spec.rb
Expand Up @@ -31,8 +31,8 @@
route_for(:controller => "hosts", :action => "exercise_performance", :id => 1).should == "/hosts/1/exercise_performance"
end

it "should map { :controller => 'hosts', :action => 'run_memory_exercise', :id => 1 } to /hosts/1/run_memory_exercise" do
route_for(:controller => "hosts", :action => "run_memory_exercise", :id => 1).should == "/hosts/1/run_memory_exercise"
it "should map { :controller => 'hosts', :action => 'exercise_memory', :id => 1 } to /hosts/1/exercise_memory" do
route_for(:controller => "hosts", :action => "exercise_memory", :id => 1).should == "/hosts/1/exercise_memory"
end
end

Expand Down Expand Up @@ -70,8 +70,8 @@
params_from(:get, "/hosts/1/exercise_performance").should == {:controller => "hosts", :action => "exercise_performance", :id => "1"}
end

it "should generate params { :controller => 'hosts', action => 'run_memory_exercise', id => '1' } from POST /hosts/1/run_memory_exercise" do
params_from(:get, "/hosts/1/run_memory_exercise").should == {:controller => "hosts", :action => "run_memory_exercise", :id => "1"}
it "should generate params { :controller => 'hosts', action => 'exercise_memory', id => '1' } from POST /hosts/1/exercise_memory" do
params_from(:get, "/hosts/1/exercise_memory").should == {:controller => "hosts", :action => "exercise_memory", :id => "1"}
end
end
end

0 comments on commit edff031

Please sign in to comment.