Skip to content

Commit

Permalink
(fix): Run any individual test file on it’s own
Browse files Browse the repository at this point in the history
* I was observing this problem: rspec/rspec-mocks#1079 when running a feature spec in isolation.

```
  1) School viewing public listings when signed in with DfE Sign In A signed in school should see a link back to their own dashboard when viewing public listings
     Failure/Error: validates :minimum_salary, salary: { presence: true, minimum_value: true }

     NoMethodError:

       undefined method `new' for SalaryValidator:Module
```
  • Loading branch information
tahb committed Jul 9, 2018
1 parent c0e932c commit 2d8621c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion spec/form_models/job_specification_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
end

it 'the minimum salary should be at least equal to the minimum payscale value' do
stub_const('SalaryValidator::MIN_SALARY_ALLOWED', '3000')
stub_const("#{SalaryValidator}::MIN_SALARY_ALLOWED", '3000')
expect(job_specification.valid?). to be false
expect(job_specification.errors.messages[:minimum_salary][0])
. to eq('must be at least £3000')
Expand Down
2 changes: 1 addition & 1 deletion spec/models/vacancy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
end

it 'less than allowed minimum_salary and no maximum_salary' do
stub_const('SalaryValidator::MIN_SALARY_ALLOWED', '3000')
stub_const("#{SalaryValidator}::MIN_SALARY_ALLOWED", '3000')
job = build(:vacancy, minimum_salary: '20', maximum_salary: nil)

expect(job.valid?).to be false
Expand Down
2 changes: 1 addition & 1 deletion spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
config.include FactoryBot::Syntax::Methods

config.before do
stub_const('SalaryValidator::MIN_SALARY_ALLOWED', '1')
stub_const("#{SalaryValidator}::MIN_SALARY_ALLOWED", '1')
end

config.include ActionView::Helpers::NumberHelper
Expand Down
2 changes: 1 addition & 1 deletion spec/validators/salary_validator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

context 'if minimum_value: true' do
it 'validates that the value is not less than the minimum allowed' do
stub_const('SalaryValidator::MIN_SALARY_ALLOWED', '400')
stub_const("#{SalaryValidator}::MIN_SALARY_ALLOWED", '400')
model.amount = '12.23'

expect(model).to_not be_valid
Expand Down

0 comments on commit 2d8621c

Please sign in to comment.