Skip to content

Instantly share code, notes, and snippets.

@abhishek0
Created August 13, 2013 19:23
Show Gist options
  • Save abhishek0/6224731 to your computer and use it in GitHub Desktop.
Save abhishek0/6224731 to your computer and use it in GitHub Desktop.
require 'spec_helper'
describe UsersController do
render_views
describe 'franchisee actions on users' do
before :each do
fr = FactoryGirl.build(:user, user_type: 'franchisee')
fr.set_stamp(FactoryGirl.build(:stamp), FactoryGirl.build(:contact, email: '[email protected]'))
fr.save
@headers = {"HTTP_AUTHORIZATION" => %{Token token="#{fr.access_token}"}}
end
it "can add advisors" do
u = FactoryGirl.attributes_for(:user, user_type: 'advisor')
data = { :format => 'json', :user => u, :contact => FactoryGirl.attributes_for(:contact) }
post :create, data, @headers
response.status.should eq(200)
expect(JSON.parse(response.body)["status"]).to eq "success"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment