fix dumb errors - only 2 topic specs fail now

This commit is contained in:
Devin Howard 2015-12-18 09:33:16 +08:00
parent ca282f7879
commit 6bb8ac7e1f
3 changed files with 21 additions and 21 deletions

View file

@ -20,19 +20,19 @@ RSpec.describe Map, type: :model do
end
it 'prevents visibility if private' do
expect(map.authorize_to_show(other_user)).to eq true
expect(map.authorize_to_show(owner)).to eq true
expect(private_map.authorize_to_show(owner)).to eq true
expect(map.authorize_to_show(other_user)).to eq map
expect(map.authorize_to_show(owner)).to eq map
expect(private_map.authorize_to_show(owner)).to eq private_map
expect(private_map.authorize_to_show(other_user)).to eq false
end
it 'only allows editing if commons or owned' do
expect(map.authorize_to_edit(other_user)).to eq true
expect(map.authorize_to_edit(owner)).to eq true
expect(map.authorize_to_edit(other_user)).to eq map
expect(map.authorize_to_edit(owner)).to eq map
expect(private_map.authorize_to_edit(other_user)).to eq false
expect(private_map.authorize_to_edit(owner)).to eq true
expect(private_map.authorize_to_edit(owner)).to eq private_map
expect(public_map.authorize_to_edit(other_user)).to eq false
expect(public_map.authorize_to_edit(owner)).to eq true
expect(public_map.authorize_to_edit(owner)).to eq public_map
end
end
end

View file

@ -24,19 +24,19 @@ RSpec.describe Synapse, type: :model do
end
it 'prevents visibility if private' do
expect(synapse.authorize_to_show(other_user)).to eq true
expect(synapse.authorize_to_show(owner)).to eq true
expect(private_synapse.authorize_to_show(owner)).to eq true
expect(synapse.authorize_to_show(other_user)).to eq synapse
expect(synapse.authorize_to_show(owner)).to eq synapse
expect(private_synapse.authorize_to_show(owner)).to eq private_synapse
expect(private_synapse.authorize_to_show(other_user)).to eq false
end
it 'only allows editing if commons or owned' do
expect(synapse.authorize_to_edit(other_user)).to eq true
expect(synapse.authorize_to_edit(owner)).to eq true
expect(synapse.authorize_to_edit(other_user)).to eq synapse
expect(synapse.authorize_to_edit(owner)).to eq synapse
expect(private_synapse.authorize_to_edit(other_user)).to eq false
expect(private_synapse.authorize_to_edit(owner)).to eq true
expect(private_synapse.authorize_to_edit(owner)).to eq private_synapse
expect(public_synapse.authorize_to_edit(other_user)).to eq false
expect(public_synapse.authorize_to_edit(owner)).to eq true
expect(public_synapse.authorize_to_edit(owner)).to eq public_synapse
end
end
end

View file

@ -63,19 +63,19 @@ RSpec.describe Topic, type: :model do
end
it 'prevents visibility if private' do
expect(topic.authorize_to_show(other_user)).to eq true
expect(topic.authorize_to_show(owner)).to eq true
expect(private_topic.authorize_to_show(owner)).to eq true
expect(topic.authorize_to_show(other_user)).to eq topic
expect(topic.authorize_to_show(owner)).to eq topic
expect(private_topic.authorize_to_show(owner)).to eq private_topic
expect(private_topic.authorize_to_show(other_user)).to eq false
end
it 'only allows editing if commons or owned' do
expect(topic.authorize_to_edit(other_user)).to eq true
expect(topic.authorize_to_edit(owner)).to eq true
expect(topic.authorize_to_edit(other_user)).to eq topic
expect(topic.authorize_to_edit(owner)).to eq topic
expect(private_topic.authorize_to_edit(other_user)).to eq false
expect(private_topic.authorize_to_edit(owner)).to eq true
expect(private_topic.authorize_to_edit(owner)).to eq private_topic
expect(public_topic.authorize_to_edit(other_user)).to eq false
expect(public_topic.authorize_to_edit(owner)).to eq true
expect(public_topic.authorize_to_edit(owner)).to eq public_topic
end
end
end