Created
December 12, 2011 15:09
-
-
Save mokevnin/1467728 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe Web::Admin::SectionMaterialsController do | |
render_views | |
before do | |
Factory 'section/material' | |
end | |
describe "GET 'index'" do | |
it "returns http success" do | |
get 'index' | |
response.should be_success | |
end | |
end | |
describe "GET 'new'" do | |
it "returns http success" do | |
get 'new' | |
response.should be_success | |
end | |
end | |
describe "POST 'create'" do | |
it "returns http redirect" do | |
attrs = Factory.attributes_for 'section/material' | |
post 'create', :section_material => attrs | |
response.should be_redirect | |
material = Section::Material.find_by_uri(attrs[:uri]) | |
material.name.should == attrs[:name] | |
end | |
end | |
describe "PUT 'update'" do | |
it "returns http redirect" do | |
attrs = Factory.attributes_for 'section/material' | |
material = Factory 'section/material' | |
put 'update', :id => material.id, :section_material => attrs | |
response.should be_redirect | |
material.reload | |
material.name.should == attrs[:name] | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment