spec/polytrix/validator_spec.rb in polytrix-0.1.0 vs spec/polytrix/validator_spec.rb in polytrix-0.1.1
- old
+ new
@@ -4,18 +4,18 @@
describe 'Validator' do
describe '#initialize' do
let(:global_matcher) { Validator::UNIVERSAL_MATCHER }
it 'accepts scope options and callback' do
- validator = Validator.new suite: 'java', sample: 'hello world' do |challenge|
+ validator = Validator.new 'dummy', suite: 'java', sample: 'hello world' do |challenge|
# Validate the challenge
end
expect(validator.suite).to eq('java')
end
it 'defaults suite and sample to the universal matcher' do
- validator = Validator.new do |challenge|
+ validator = Validator.new 'dummy' do |challenge|
# Validate
end
expect(validator.suite).to eq(Validator::UNIVERSAL_MATCHER)
expect(validator.sample).to eq(Validator::UNIVERSAL_MATCHER)
end
@@ -42,21 +42,21 @@
describe '#validate' do
let(:challenge) { Fabricate(:challenge) }
xit 'calls the validation callback' do
called = false
- validator = Validator.new do |challenge|
+ validator = Validator.new 'dummy' do |challenge|
called = true
end
expect { validator.validate challenge }.to change { called }.from(false).to(true)
end
end
def validator(*args)
scope = {}
scope[:suite] = args[0]
scope[:sample] = args[1] if args[1]
- Validator.new scope do |challenge|
+ Validator.new 'dummy', scope do |challenge|
# Dummy validator
end
end
end
end