Commit c8b2ada5997e6eeee76f6a71cff84a9e2601e056

Authored by Rafael Manzo
1 parent a00c09a6

Adds coverage for RepositoryAttributes#repository

Also fixes the factory name.

Signed off by: Pedro Scocco <pedroscocco@gmail.com>
spec/factories/repository_attributes.rb
1 1 FactoryGirl.define do
2   - factory :repository_attribute do
  2 + factory :repository_attributes do
3 3 repository_id 1
4 4 association :user, strategy: :build
5 5 end
... ...
spec/models/repository_attributes_spec.rb
... ... @@ -9,4 +9,16 @@ RSpec.describe RepositoryAttributes, type: :model do
9 9 describe 'associations' do
10 10 it { is_expected.to belong_to(:user) }
11 11 end
  12 +
  13 + describe 'methods' do
  14 + describe 'repository' do
  15 + subject { FactoryGirl.build(:repository_attributes) }
  16 +
  17 + it 'is expected to find the repository by id' do
  18 + Repository.expects(:find).with(subject.repository_id).returns(subject)
  19 +
  20 + subject.repository
  21 + end
  22 + end
  23 + end
12 24 end
... ...