spec/models/account_spec.rb in bookingsync-engine-0.5.0 vs spec/models/account_spec.rb in bookingsync-engine-1.0.0

- old
+ new

@@ -12,20 +12,20 @@ expect(account.oauth_expires_at).to eql("expires at") end end describe "validations" do - it { is_expected.to validate_uniqueness_of(:uid) } + it { is_expected.to validate_uniqueness_of(:synced_id) } end describe ".from_omniauth" do - before { Account.create!(provider: "bookingsync", uid: 456) } + before { Account.create!(provider: "bookingsync", synced_id: 456) } let(:auth) { OmniAuth.config.mock_auth[:bookingsync] } context "when account exists" do - let!(:account) { Account.create!(provider: "bookingsync", uid: 123) } + let!(:account) { Account.create!(provider: "bookingsync", synced_id: 123) } it "loads the existing account" do expect(Account.from_omniauth(auth)).to eql(account) end @@ -47,22 +47,22 @@ end describe "the newly created account" do let!(:account) { Account.from_omniauth(auth) } - it "sets uid and provider from auth" do - expect(account.uid).to eq 123 + it "sets synced_id and provider from auth" do + expect(account.synced_id).to eq 123 expect(account.provider).to eq "bookingsync" end it_behaves_like "it takes attributes from auth" end end end describe "#token" do let(:expires_at) { 1.day.from_now.to_i } - let!(:account) { Account.create!(uid: 123, oauth_access_token: "token", + let!(:account) { Account.create!(synced_id: 123, oauth_access_token: "token", oauth_refresh_token: "refresh_token", oauth_expires_at: expires_at) } context "when the stored token is fresh" do it "returns the token" do expect(account.token).to be_a OAuth2::AccessToken