spec/lib/contentful/management/space_membership_spec.rb in contentful-management-1.10.1 vs spec/lib/contentful/management/space_membership_spec.rb in contentful-management-2.0.0
- old
+ new
@@ -8,11 +8,11 @@
let(:token) { ENV.fetch('CF_TEST_CMA_TOKEN', '<ACCESS_TOKEN>') }
let(:space_id) { 'facgnwwgj5fe' }
let(:membership_id) { '6RdRdobdQzh8zKe1Hogiz4' }
let(:client) { Client.new(token, raise_errors: true) }
- subject { client.space_memberships }
+ subject { client.space_memberships(space_id) }
describe 'class methods' do
describe '::create_attributes' do
it 'requires admin, roles and email keys to be present' do
expect { described_class.create_attributes(nil, {}) }.to raise_error KeyError
@@ -66,16 +66,16 @@
end
end
describe '.all' do
it 'returns a Contentful::Array' do
- vcr('space_memberships/all') { expect(subject.all(space_id)).to be_kind_of Contentful::Management::Array }
+ vcr('space_memberships/all') { expect(subject.all).to be_kind_of Contentful::Management::Array }
end
it 'builds a Contentful::Management::SpaceMembership' do
vcr('space_memberships/all') {
- memberships = subject.all(space_id)
+ memberships = subject.all
admin_membership, normal_membership = memberships.items
expect(admin_membership).to be_a Contentful::Management::SpaceMembership
expect(admin_membership.admin).to eq true
@@ -93,11 +93,11 @@
end
describe '.find' do
it 'returns a Contentful::Management::SpaceMembership' do
vcr('space_memberships/find') {
- membership = subject.find(space_id, membership_id)
+ membership = subject.find(membership_id)
expect(membership).to be_a Contentful::Management::SpaceMembership
expect(membership.admin).to eq false
expect(membership.roles.first).to be_a Link
}
@@ -106,11 +106,10 @@
describe '.create' do
it 'creates a Contentful::Management::SpaceMembership' do
vcr('space_memberships/create') {
membership = subject.create(
- space_id,
admin: false,
roles: [
{
"sys" => {
"type" => "Link",
@@ -130,16 +129,16 @@
end
describe '#destroy' do
it 'deletes the membership' do
vcr('space_memberships/delete') {
- membership = subject.find(space_id, '7pcydolqtgMaSLwmXMvGqW')
+ membership = subject.find('7pcydolqtgMaSLwmXMvGqW')
expect(membership.id).to be_truthy
membership.destroy
- expect { subject.find(space_id, '7pcydolqtgMaSLwmXMvGqW') }.to raise_error Contentful::Management::NotFound
+ expect { subject.find('7pcydolqtgMaSLwmXMvGqW') }.to raise_error Contentful::Management::NotFound
}
end
end
end
end