You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cartodb-4.29/spec/models/data_import_shared_examples.rb

23 lines
737 B

4 years ago
# Including specs must define `:data_import_class`
shared_examples_for 'DataImport model' do
describe 'validation' do
before(:all) do
@user = FactoryGirl.create(:valid_user)
end
after(:all) do
@user.destroy if @user
end
it 'only allows valid collision strategies' do
data_import = data_import_class.new(collision_strategy: 'wadus', user_id: @user.id)
data_import.valid?.should be_false
data_import.errors[:collision_strategy].should_not be_nil
data_import = data_import_class.new(collision_strategy: DataImport::COLLISION_STRATEGY_SKIP, user_id: @user.id)
data_import.valid?.should be_true
data_import.errors[:collision_strategy].should be_empty
end
end
end