Created
August 19, 2012 06:07
-
-
Save masterkrang/3392512 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 StorybooksController do | |
let!(:user) { Factory(:user) } | |
let!(:storybook) { Factory(:storybook) } | |
#TODO make a before call to sign in user and DRY up | |
describe '#index' do | |
it "populates an array of storybooks" do | |
storybooks = [] | |
storybooks << Factory.create(:storybook, :user => user) | |
test_sign_in(user) | |
get '/storybooks.json' | |
response.should be_success | |
storybooks.to_json.should eq last_response.body | |
#p last_response.to_yaml | |
#p response.body | |
#p storybooks | |
end | |
end | |
describe 'GET #show' do | |
it "shows the right storybook" do | |
#storybook = Factory.create(:storybook) | |
get "/storybooks/#{storybook['id']}", :format => :json | |
storybook.to_json.should eq last_response.body | |
end | |
end | |
describe 'PUT #update' do | |
context "with valid attributes" do | |
it "updates the contact in the database" do | |
storybook = Factory.create(:storybook, :user => user) | |
put "/storybooks/#{storybook['id']}", :format => :json | |
end | |
end | |
context "with invalid attributes" do | |
it "does not update the contact" | |
it "issues an error message" | |
end | |
end | |
describe 'DELETE #destroy' do | |
it "deletes the contact from the database" | |
end | |
describe "POST #create" do | |
context "with valid attributes" do | |
it "saves the new storybook" do | |
end | |
end | |
context "with invalid attributes" do | |
it "does not save the new storybook in the database" | |
end | |
end | |
describe 'PUT #update' do | |
context "with valid attributes" do | |
it "updates the storybook" | |
end | |
context "with invalid attributes" do | |
it "does not update the contact" | |
end | |
end | |
context 'guest user' do | |
describe 'GET #show' do | |
it "assigns the requested contact to @contact" | |
it "renders the :show template" | |
end | |
describe 'GET #new' do | |
it "requires login" | |
end | |
describe "POST #create" do | |
it "requires login" | |
end | |
describe 'PUT #update' do | |
it "requires login" | |
end | |
describe 'DELETE #destroy' do | |
it "requires login" | |
end | |
end | |
context 'admin user' do | |
it "require admin login" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment