diff --git a/spec/models/nocms/pages/page_spec.rb b/spec/models/nocms/pages/page_spec.rb index 9bd90ac..34dfe5d 100644 --- a/spec/models/nocms/pages/page_spec.rb +++ b/spec/models/nocms/pages/page_spec.rb @@ -61,9 +61,11 @@ let(:page) { create :nocms_page} let(:duplicated_page) { build :nocms_page, slug: page.slug} + before { duplicated_page.valid? } + subject { duplicated_page } - it("should not have a valid path") { expect(subject.errors_on(:path)).to_not be_blank } + it("should not have a valid path") { expect(subject.errors[:path]).to_not be_blank } end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9c906df..0e7d866 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -20,7 +20,7 @@ config.include FactoryGirl::Syntax::Methods # Capybara DSL only in request specs - config.include Capybara::DSL, :type => :request + config.include Capybara::DSL # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures config.fixture_path = "#{::Rails.root}/spec/fixtures" diff --git a/spec/support/concerns/model_with_required_attributes.rb b/spec/support/concerns/model_with_required_attributes.rb index e89c092..432e786 100644 --- a/spec/support/concerns/model_with_required_attributes.rb +++ b/spec/support/concerns/model_with_required_attributes.rb @@ -12,7 +12,7 @@ subject { model_object } it { should_not be_valid } - it { expect(subject.error_on(attribute_name)).to include I18n.t('errors.messages.blank') } + it { expect(subject.errors[attribute_name]).to include I18n.t('errors.messages.blank') } end end