forked from bofh/fetsite
Introducing Lecturers
This commit is contained in:
24
spec/views/lecturers/edit.html.erb_spec.rb
Normal file
24
spec/views/lecturers/edit.html.erb_spec.rb
Normal file
@@ -0,0 +1,24 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "lecturers/edit" do
|
||||
before(:each) do
|
||||
@lecturer = assign(:lecturer, stub_model(Lecturer,
|
||||
:name => "MyString",
|
||||
:email => "MyString",
|
||||
:oid => 1,
|
||||
:picture => "MyString"
|
||||
))
|
||||
end
|
||||
|
||||
it "renders the edit lecturer form" do
|
||||
render
|
||||
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||
assert_select "form[action=?][method=?]", lecturer_path(@lecturer), "post" do
|
||||
assert_select "input#lecturer_name[name=?]", "lecturer[name]"
|
||||
assert_select "input#lecturer_email[name=?]", "lecturer[email]"
|
||||
assert_select "input#lecturer_oid[name=?]", "lecturer[oid]"
|
||||
assert_select "input#lecturer_picture[name=?]", "lecturer[picture]"
|
||||
end
|
||||
end
|
||||
end
|
||||
29
spec/views/lecturers/index.html.erb_spec.rb
Normal file
29
spec/views/lecturers/index.html.erb_spec.rb
Normal file
@@ -0,0 +1,29 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "lecturers/index" do
|
||||
before(:each) do
|
||||
assign(:lecturers, [
|
||||
stub_model(Lecturer,
|
||||
:name => "Name",
|
||||
:email => "Email",
|
||||
:oid => 1,
|
||||
:picture => "Picture"
|
||||
),
|
||||
stub_model(Lecturer,
|
||||
:name => "Name",
|
||||
:email => "Email",
|
||||
:oid => 1,
|
||||
:picture => "Picture"
|
||||
)
|
||||
])
|
||||
end
|
||||
|
||||
it "renders a list of lecturers" 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
|
||||
assert_select "tr>td", :text => "Email".to_s, :count => 2
|
||||
assert_select "tr>td", :text => 1.to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Picture".to_s, :count => 2
|
||||
end
|
||||
end
|
||||
24
spec/views/lecturers/new.html.erb_spec.rb
Normal file
24
spec/views/lecturers/new.html.erb_spec.rb
Normal file
@@ -0,0 +1,24 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "lecturers/new" do
|
||||
before(:each) do
|
||||
assign(:lecturer, stub_model(Lecturer,
|
||||
:name => "MyString",
|
||||
:email => "MyString",
|
||||
:oid => 1,
|
||||
:picture => "MyString"
|
||||
).as_new_record)
|
||||
end
|
||||
|
||||
it "renders new lecturer form" do
|
||||
render
|
||||
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||
assert_select "form[action=?][method=?]", lecturers_path, "post" do
|
||||
assert_select "input#lecturer_name[name=?]", "lecturer[name]"
|
||||
assert_select "input#lecturer_email[name=?]", "lecturer[email]"
|
||||
assert_select "input#lecturer_oid[name=?]", "lecturer[oid]"
|
||||
assert_select "input#lecturer_picture[name=?]", "lecturer[picture]"
|
||||
end
|
||||
end
|
||||
end
|
||||
21
spec/views/lecturers/show.html.erb_spec.rb
Normal file
21
spec/views/lecturers/show.html.erb_spec.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "lecturers/show" do
|
||||
before(:each) do
|
||||
@lecturer = assign(:lecturer, stub_model(Lecturer,
|
||||
:name => "Name",
|
||||
:email => "Email",
|
||||
:oid => 1,
|
||||
:picture => "Picture"
|
||||
))
|
||||
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/)
|
||||
rendered.should match(/Email/)
|
||||
rendered.should match(/1/)
|
||||
rendered.should match(/Picture/)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user