Commit 6dabfd3169bfe2352143883b3b02a89e613bf25c
1 parent
1c96bcfc
Exists in
colab
and in
4 other branches
Removing useless methods from Configuration and ReadingGroup ownership model
Showing
4 changed files
with
0 additions
and
38 deletions
Show diff stats
app/models/mezuro_configuration_ownership.rb
| 1 | class MezuroConfigurationOwnership < ActiveRecord::Base | 1 | class MezuroConfigurationOwnership < ActiveRecord::Base |
| 2 | belongs_to :user | 2 | belongs_to :user |
| 3 | validates :mezuro_configuration_id, presence: true | 3 | validates :mezuro_configuration_id, presence: true |
| 4 | - | ||
| 5 | - def mezuro_configuration | ||
| 6 | - MezuroConfiguration.find(mezuro_configuration_id) | ||
| 7 | - end | ||
| 8 | end | 4 | end |
app/models/reading_group_ownership.rb
| 1 | class ReadingGroupOwnership < ActiveRecord::Base | 1 | class ReadingGroupOwnership < ActiveRecord::Base |
| 2 | belongs_to :user | 2 | belongs_to :user |
| 3 | validates :reading_group_id, presence: true | 3 | validates :reading_group_id, presence: true |
| 4 | - | ||
| 5 | - def reading_group | ||
| 6 | - ReadingGroup.find(reading_group_id) | ||
| 7 | - end | ||
| 8 | end | 4 | end |
spec/models/mezuro_configuration_ownership_spec.rb
| @@ -4,19 +4,4 @@ describe MezuroConfigurationOwnership, :type => :model do | @@ -4,19 +4,4 @@ describe MezuroConfigurationOwnership, :type => :model do | ||
| 4 | describe 'associations' do | 4 | describe 'associations' do |
| 5 | it { is_expected.to belong_to(:user) } | 5 | it { is_expected.to belong_to(:user) } |
| 6 | end | 6 | end |
| 7 | - | ||
| 8 | - describe 'methods' do | ||
| 9 | - describe 'mezuro_configuration' do | ||
| 10 | - subject {FactoryGirl.build(:mezuro_configuration_ownership)} | ||
| 11 | - let(:mezuro_configuration) {FactoryGirl.build(:mezuro_configuration)} | ||
| 12 | - | ||
| 13 | - before :each do | ||
| 14 | - MezuroConfiguration.expects(:find).with(subject.mezuro_configuration_id).returns(mezuro_configuration) | ||
| 15 | - end | ||
| 16 | - | ||
| 17 | - it 'should return the mezuro_configuration' do | ||
| 18 | - expect(subject.mezuro_configuration).to eq(mezuro_configuration) | ||
| 19 | - end | ||
| 20 | - end | ||
| 21 | - end | ||
| 22 | end | 7 | end |
spec/models/reading_group_ownership_spec.rb
| @@ -4,19 +4,4 @@ describe ReadingGroupOwnership, :type => :model do | @@ -4,19 +4,4 @@ describe ReadingGroupOwnership, :type => :model do | ||
| 4 | describe 'associations' do | 4 | describe 'associations' do |
| 5 | it { is_expected.to belong_to(:user) } | 5 | it { is_expected.to belong_to(:user) } |
| 6 | end | 6 | end |
| 7 | - | ||
| 8 | - describe 'methods' do | ||
| 9 | - describe 'reading_group' do | ||
| 10 | - subject {FactoryGirl.build(:reading_group_ownership)} | ||
| 11 | - let(:reading_group) {FactoryGirl.build(:reading_group)} | ||
| 12 | - | ||
| 13 | - before :each do | ||
| 14 | - ReadingGroup.expects(:find).with(subject.reading_group_id).returns(reading_group) | ||
| 15 | - end | ||
| 16 | - | ||
| 17 | - it 'should return the reading_group' do | ||
| 18 | - expect(subject.reading_group).to eq(reading_group) | ||
| 19 | - end | ||
| 20 | - end | ||
| 21 | - end | ||
| 22 | end | 7 | end |