Skip to content

Instantly share code, notes, and snippets.

@mokevnin
Created December 12, 2011 15:09
Show Gist options
  • Save mokevnin/1467728 to your computer and use it in GitHub Desktop.
Save mokevnin/1467728 to your computer and use it in GitHub Desktop.
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