Skip to content

Commit

Permalink
Refactored to make way for the new specs.
Browse files Browse the repository at this point in the history
  • Loading branch information
baphled committed May 29, 2010
1 parent 877685e commit 7cf504e
Showing 1 changed file with 31 additions and 26 deletions.
57 changes: 31 additions & 26 deletions spec/views/features/new.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,42 @@
before(:each) do
@projects = [stub_model(Project).as_null_object,stub_model(Project).as_null_object]
Project.stub(:all).and_return @projects
assigns[:feature] = Feature.new
render
end

it "should have a form" do
response.should have_tag("form[action=#{features_path}][method=post]")
end

it "should have a list of checkboxes for each project that is avaiable" do
response.should have_selector :form do |content|
@projects.each do |project|
content.should have_selector :input, attribute = {:type => "checkbox", :value => "#{project.id}"}

context "filling in a new feature" do
before(:each) do
assigns[:feature] = Feature.new
render
end

it "should have a form" do
response.should have_tag("form[action=#{features_path}][method=post]")
end

it "should have a list of checkboxes for each project that is avaiable" do
response.should have_selector :form do |content|
@projects.each do |project|
content.should have_selector :input, attribute = {:type => "checkbox", :value => "#{project.id}"}
end
end
end
end

it "should have a 'In order' field " do
have_tag("form[action=#{features_path}][method=post]") do
with_tag('input#feature_in_order[name=?]', "feature[in_order]")

it "should have a 'In order' field " do
have_tag("form[action=#{features_path}][method=post]") do
with_tag('input#feature_in_order[name=?]', "feature[in_order]")
end
end
end

it "should have a 'As a' field " do
have_tag("form[action=#{features_path}][method=post]") do
with_tag('input#feature_as_a[name=?]', "feature[as_a]")

it "should have a 'As a' field " do
have_tag("form[action=#{features_path}][method=post]") do
with_tag('input#feature_as_a[name=?]', "feature[as_a]")
end
end
end

it "should have a 'I want' field " do
have_tag("form[action=#{features_path}][method=post]") do
with_tag('input#feature_i_want[name=?]', "feature[i_want]")

it "should have a 'I want' field " do
have_tag("form[action=#{features_path}][method=post]") do
with_tag('input#feature_i_want[name=?]', "feature[i_want]")
end
end
end
end

0 comments on commit 7cf504e

Please sign in to comment.