Skip to content

Instantly share code, notes, and snippets.

@drewB
Created March 18, 2010 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drewB/336898 to your computer and use it in GitHub Desktop.
Save drewB/336898 to your computer and use it in GitHub Desktop.
#---------------------------
#profile_controller_spec.rb
#---------------------------
describe ProfileController do
shared_examples_for "User" do
it "should show user profile" do
get :index
response.should be_success
end
it "should update user profile" do
update_profile...
end
end
context "MEMBER" do
it_should_behave_like "User"
it "shouldn't view someone else's profile" do
....
end
end
context "ADMIN" do
it_should_behave_like "User"
it "should view someone else's profile" do
....
end
end
end
#----------------------------
#history_controller_spec.rb
#---------------------------
describe HistoryController do
shared_examples_for "User" do
it "should show history" do
get :index
response.should be_success
end
end
context "MEMBER" do
it_should_behave_like "User"
it "shouldn't view someone else's history" do
....
end
end
context "ADMIN" do
it_should_behave_like "User"
it "should view someone else's history" do
....
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment