diff --git a/spec/factories/maps.rb b/spec/factories/maps.rb index bfda5a9a..a786d109 100644 --- a/spec/factories/maps.rb +++ b/spec/factories/maps.rb @@ -1,6 +1,6 @@ FactoryGirl.define do factory :map do - name { random_string(10) } + sequence(:name) { |n| "Cool Map ##{n}" } permission :commons arranged { false } user diff --git a/spec/factories/synapses.rb b/spec/factories/synapses.rb index 10fd74da..b83a0073 100644 --- a/spec/factories/synapses.rb +++ b/spec/factories/synapses.rb @@ -1,6 +1,6 @@ FactoryGirl.define do factory :synapse do - desc { random_string(10) } + sequence(:desc) { |n| "Cool synapse ##{n}" } category :to permission :commons association :topic1, factory: :topic diff --git a/spec/factories/topics.rb b/spec/factories/topics.rb index c54301c1..17c69a25 100644 --- a/spec/factories/topics.rb +++ b/spec/factories/topics.rb @@ -1,6 +1,6 @@ FactoryGirl.define do factory :topic do - name { random_string(10) } + sequence(:name) { |n| "Cool Topic ##{n}" } permission :commons user metacode diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 8bdcb17e..fb380e7c 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -1,12 +1,15 @@ FactoryGirl.define do factory :user do - name { random_string(10) } - email { random_string(10) + '@' + random_string(10) + '.com' } - code { random_string(8) } - joinedwithcode { code } + sequence(:name) { |n| "Cool User ##{n}" } + sequence(:email) { |n| "cooluser#{n}@cooldomain.com" } + joinedwithcode { "qwertyui" } password 'omgwtfbbq' + transient do + validate false + end + # bypass validation of the joinedwithcode - to_create { |instance| instance.save(validate: false) } + to_create { |instance| instance.save(validate: instance.validate) } end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 14cfd1c7..a2b164b2 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,14 +6,4 @@ RSpec.configure do |config| config.mock_with :rspec do |mocks| mocks.verify_partial_doubles = true end - - # Print the 10 slowest examples and example groups at the - # end of the spec run, to help surface which specs are running - # particularly slow. - config.profile_examples = 10 -end - -def random_string(length = 10) - o = [('a'..'z'), ('A'..'Z')].map(&:to_a).flatten - (0...length).map { o[rand(o.length)] }.join end