Skip to content

Commit

Permalink
Implemented most of the pending specs
Browse files Browse the repository at this point in the history
  • Loading branch information
baphled committed Jul 25, 2010
1 parent bb6caba commit 527a89a
Showing 1 changed file with 27 additions and 10 deletions.
37 changes: 27 additions & 10 deletions spec/controllers/features_controller_spec.rb
Expand Up @@ -52,34 +52,51 @@ def mock_feature(stubs={})

context "importing over XHR" do

it "redirects not to the import page" do
it "does not redirects to the import page" do
xhr :post, :create, {:commit => 'Import', :current_project_id => @project.id}
response.should_not redirect_to import_project_path(@project)
end

context "more features to import" do
before(:each) do
@project.stub!(:features_to_import?).and_return true
xhr :post, :create, {:commit => 'Import', :current_project_id => @project.id}
end

it "finds the project the feature was imported from" do
@feature.stub!(:find_by_project_id).and_return Project.first
xhr :post, :create, {:commit => 'Import', :current_project_id => @project.id}
end

it "renders the import RJS file" do
xhr :post, :create, {:commit => 'Import', :current_project_id => @project.id}
response.should render_template "import.rjs"
end

it "displays the import list"
it "does not display the imported feature"

it "displays a message stating the feature has been imported" do
flash[:notice].should contain "Feature: #{@feature.title}, was imported"
end
end

context "no more features to import" do
it "renders the project RJS file"
it "displays a notice stating that there are no more features to import"
it "displays the projects information"
before(:each) do
@project = Project.make
@project.stub!(:import_features).and_return []
Project.stub!(:find).and_return @project
xhr :post, :create, {:commit => 'Import', :current_project_id => @project.id}
end

it "renders the project RJS file" do
response.should render_template "index.rjs"
end

it "displays a notice stating that there are no more features to import" do
flash[:notice].should contain "No more features to import"
end

it "displays the features information" do
pending "Need to finish functionality" do
response.should have_selector :h3, :content => 'Feature Info'
end
end
end

end
Expand Down Expand Up @@ -352,7 +369,7 @@ def mock_feature(stubs={})

describe "GET, source" do
before(:each) do
@feature = mock_model(Feature,:title=>"A new feature").as_null_object
@feature = mock_model(Feature).as_null_object
@feature.stub!(:path).and_return "#{RAILS_ROOT}/features/plain/tag_cloud.feature"
Feature.stub!(:find).and_return @feature
end
Expand Down

0 comments on commit 527a89a

Please sign in to comment.