Sha256: c1562acc5befc36dfe7091fcb06e7c36f6fe197ac4efc0e745b64213a91067cf

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

# Generates fake pull request data we can use to test with
FactoryGirl.define do
  factory :pull_request, :class => Hubstats::PullRequest do
    user
    repo
    id {Faker::Number.number(6).to_i}
    number {|n| "#{n}".to_i}
  end

  factory :pull_request_hash, class:Hash do
    association :user, factory: :user_hash, strategy: :build
    association :repository, factory: :repo_hash, strategy: :build
    id {Faker::Number.number(6).to_i}
    number {|n| "#{n}".to_i}
    merged_by(:id => 202020)

    initialize_with { attributes } 
  end

  factory :pull_request_hash_no_merge, class:Hash do
    association :user, factory: :user_hash, strategy: :build
    association :repository, factory: :repo_hash, strategy: :build
    id {Faker::Number.number(6).to_i}
    number {|n| "#{n}".to_i}
    merged_by(nil)

    initialize_with { attributes } 
  end

  factory :pull_request_payload_hash, class:Hash do 
    id {Faker::Number.number(6).to_i}
    type "PullRequestEvent"
    association :repository, factory: :repo_hash, strategy: :build
    association :pull_request, factory: :pull_request_hash, strategy: :build
    merged_by(:id => 202020)

    initialize_with { attributes } 
  end 
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hubstats-0.4.4 spec/factories/pull_requests.rb
hubstats-0.4.2 spec/factories/pull_requests.rb
hubstats-0.4.1 spec/factories/pull_requests.rb