Skip to content

Commit

Permalink
Refactored so that the project that we're importing for is stored in …
Browse files Browse the repository at this point in the history
…the form some how, will review this later to see if we can further improve this but this should do the trick for now
  • Loading branch information
baphled committed Jun 28, 2010
1 parent ea74a30 commit 34bec4d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/views/common/_import_feature.html.erb
@@ -1,6 +1,6 @@
<% if Feature.find_by_title(file[:feature].title).nil? %>
<div id="<%=h file[:file].gsub(/\./,"_")%>-<%= index+1%>">
<%= render :partial => '/common/forms/feature_import', :locals => {:file => file, :feature => @feature}%>
<%= render :partial => '/common/forms/feature_import', :locals => {:file => file, :feature => @feature, :current_project => @project}%>
<p>
<%= render :partial => '/common/scenario_steps', :locals => {:scenarios => file[:feature].stories,:feature => file[:file].sub(/\./,"_")}%>
</p>
Expand Down
3 changes: 2 additions & 1 deletion app/views/common/forms/_feature_import.html.erb
@@ -1,7 +1,8 @@
<h3>Feature: <%=h file[:file].sub(/\.feature/,"").gsub(/_/,' ') %></h3>
<%- form_for file[:feature], :id => "new_feature",:class => "new_feature hidden", :method => :post do |f|%>
  <fieldset class="ui-tabs ui-widget ui-widget-content ui-corner-all">
<%= hidden_field_tag :commit, 'Import' %>
<%= hidden_field_tag :commit, 'Import' %>
<%= hidden_field_tag :current_project_id, current_project.id %>
    <%= f.hidden_field :title %>
    <%= f.hidden_field :in_order %>
    <%= f.hidden_field :as_a %>
Expand Down
7 changes: 7 additions & 0 deletions spec/views/projects/import.html.erb_spec.rb
Expand Up @@ -10,9 +10,16 @@

assigns[:feature] = mock_model(Feature).as_null_object
assigns[:imported] = @project.import_features
assigns[:project] = @project
end

it "stores the current projects id for later use" do
render
response.should have_selector :input, attribute = {:type => "hidden", :id => 'current_project_id'}
end

describe "viewing the import form" do

context "invalid feature" do

context "disabling submit if" do
Expand Down

0 comments on commit 34bec4d

Please sign in to comment.