Sha256: a3447e83936f4b897120938f2583019ea65d190a20c04962046772fca4b03301
Contents?: true
Size: 1.4 KB
Versions: 1
Compression:
Stored size: 1.4 KB
Contents
require 'spec_helper' require 'cadenero/testing_support/authentication_helpers' feature "User signup" do include Cadenero::TestingSupport::AuthenticationHelpers let!(:account) { FactoryGirl.create(:account_with_schema) } let(:root_url) { "http://#{account.subdomain}.example.com/" } scenario "under an account" do sign_up_user root_url expect(last_response.status).to eq 201 expect(json_last_response_body["user"]["membership_ids"]).to eq [account.id] expect(last_request.url).to eq "#{root_url}v1/users" get "#{root_url}v1/users/#{json_last_response_body['user']['id']}" expect(json_last_response_body["user"]["membership_ids"]).to eq [account.id] end scenario "under two accounts" do sign_up_user root_url user_id = json_last_response_body['user']['id'] get "#{root_url}v1/users/#{user_id}" expect(json_last_response_body["user"]["membership_ids"]).to eq [account.id] second_account = FactoryGirl.create(:account_with_schema, owner: Cadenero::User.where(id: user_id).first) sign_up_user "http://#{second_account.subdomain}.example.com/" expect(json_last_response_body["user"]["membership_ids"]).to eq [second_account.id] get "#{root_url}v1/users/#{user_id}" expect(json_last_response_body["user"]["membership_ids"]).to eq [account.id, second_account.id] get "#{root_url}v1/users" expect(json_last_response_body["users"].length).to eq 2 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cadenero-0.0.2.b4 | spec/features/users/sign_up_spec.rb |