Sha256: f28aa42fcb639d128fbe74c2dcf14abb4dcb94f3859e8c52091738f085a08d66

Contents?: true

Size: 1.31 KB

Versions: 26

Compression:

Stored size: 1.31 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}
    created_at '2015-05-30'
  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)
    created_at Date.today
    updated_at Date.today
    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)
    created_at Date.today
    updated_at Date.today
    initialize_with { attributes } 
  end

  factory :pull_request_payload_hash, class:Hash do 
    id {Faker::Number.number(6).to_i}
    type "PullRequestEvent"
    action 'opened'
    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

26 entries across 26 versions & 1 rubygems

Version Path
hubstats-1.2.1 spec/factories/pull_requests.rb
hubstats-1.2.0 spec/factories/pull_requests.rb
hubstats-1.1.0 spec/factories/pull_requests.rb
hubstats-1.0.0 spec/factories/pull_requests.rb
hubstats-1.0.0.beta3 spec/factories/pull_requests.rb
hubstats-1.0.0.beta2 spec/factories/pull_requests.rb
hubstats-1.0.0.beta1 spec/factories/pull_requests.rb
hubstats-1.0.0.beta spec/factories/pull_requests.rb
hubstats-0.12.2 spec/factories/pull_requests.rb
hubstats-0.12.1 spec/factories/pull_requests.rb
hubstats-0.12.0 spec/factories/pull_requests.rb
hubstats-0.11.5 spec/factories/pull_requests.rb
hubstats-0.11.4 spec/factories/pull_requests.rb
hubstats-0.11.1 spec/factories/pull_requests.rb
hubstats-0.11.0 spec/factories/pull_requests.rb
hubstats-0.10.0 spec/factories/pull_requests.rb
hubstats-0.9.5 spec/factories/pull_requests.rb
hubstats-0.9.4 spec/factories/pull_requests.rb
hubstats-0.9.3 spec/factories/pull_requests.rb
hubstats-0.9.2 spec/factories/pull_requests.rb