Re-namespacing a bit to clear out some fairly old stuff from the top level
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "people/edit.html.erb" do
|
||||
before(:each) do
|
||||
@person = assign(:person, stub_model(Person,
|
||||
:name => "MyString",
|
||||
:age => 1,
|
||||
:zipcode => "MyString"
|
||||
))
|
||||
end
|
||||
|
||||
it "renders the edit person form" do
|
||||
render
|
||||
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||
assert_select "form", :action => people_path(@person), :method => "post" do
|
||||
assert_select "input#person_name", :name => "person[name]"
|
||||
assert_select "input#person_age", :name => "person[age]"
|
||||
assert_select "input#person_zipcode", :name => "person[zipcode]"
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,28 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "people/index.html.erb" do
|
||||
before(:each) do
|
||||
assign(:people, [
|
||||
stub_model(Person,
|
||||
:name => "Name",
|
||||
:age => 1,
|
||||
:zipcode => "Zipcode"
|
||||
),
|
||||
stub_model(Person,
|
||||
:name => "Name",
|
||||
:age => 1,
|
||||
:zipcode => "Zipcode"
|
||||
)
|
||||
])
|
||||
end
|
||||
|
||||
it "renders a list of people" do
|
||||
render
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||
assert_select "tr>td", :text => "Name".to_s, :count => 2
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||
assert_select "tr>td", :text => 1.to_s, :count => 2
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||
assert_select "tr>td", :text => "Zipcode".to_s, :count => 2
|
||||
end
|
||||
end
|
@@ -0,0 +1,22 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "people/new.html.erb" do
|
||||
before(:each) do
|
||||
assign(:person, stub_model(Person,
|
||||
:name => "MyString",
|
||||
:age => 1,
|
||||
:zipcode => "MyString"
|
||||
).as_new_record)
|
||||
end
|
||||
|
||||
it "renders new person form" do
|
||||
render
|
||||
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||
assert_select "form", :action => people_path, :method => "post" do
|
||||
assert_select "input#person_name", :name => "person[name]"
|
||||
assert_select "input#person_age", :name => "person[age]"
|
||||
assert_select "input#person_zipcode", :name => "person[zipcode]"
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,21 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "people/show.html.erb" do
|
||||
before(:each) do
|
||||
@person = assign(:person, stub_model(Person,
|
||||
:name => "Name",
|
||||
:age => 1,
|
||||
:zipcode => "Zipcode"
|
||||
))
|
||||
end
|
||||
|
||||
it "renders attributes in <p>" do
|
||||
render
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||
rendered.should match(/Name/)
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||
rendered.should match(/1/)
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||
rendered.should match(/Zipcode/)
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user