From 1fee24a36143e8057d495e8a7e0f2d4b93d83f2a Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Thu, 16 Jul 2015 14:17:43 -0400 Subject: Remove unused `be_valid_commit` matcher --- spec/support/matchers.rb | 9 --------- 1 file changed, 9 deletions(-) (limited to 'spec/support/matchers.rb') diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb index a2f853e3e70..87a034cca3b 100644 --- a/spec/support/matchers.rb +++ b/spec/support/matchers.rb @@ -1,12 +1,3 @@ -RSpec::Matchers.define :be_valid_commit do - match do |actual| - actual && - actual.id == ValidCommit::ID && - actual.message == ValidCommit::MESSAGE && - actual.author_name == ValidCommit::AUTHOR_FULL_NAME - end -end - def emulate_user(user) user = case user when :user then create(:user) -- cgit v1.2.1 From a2ecfdc5859c1703dbbad6dde888f7a0eb5817c8 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Tue, 21 Jul 2015 22:09:02 -0400 Subject: Move access-related matchers to their own module --- spec/support/matchers.rb | 34 ---------------------------------- 1 file changed, 34 deletions(-) (limited to 'spec/support/matchers.rb') diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb index 87a034cca3b..d9b27ab08d8 100644 --- a/spec/support/matchers.rb +++ b/spec/support/matchers.rb @@ -1,37 +1,3 @@ -def emulate_user(user) - user = case user - when :user then create(:user) - when :visitor then nil - when :admin then create(:admin) - else user - end - login_with(user) if user -end - -RSpec::Matchers.define :be_allowed_for do |user| - match do |url| - emulate_user(user) - visit url - status_code != 404 && current_path != new_user_session_path - end -end - -RSpec::Matchers.define :be_denied_for do |user| - match do |url| - emulate_user(user) - visit url - status_code == 404 || current_path == new_user_session_path - end -end - -RSpec::Matchers.define :be_not_found_for do |user| - match do |url| - emulate_user(user) - visit url - status_code == 404 - end -end - RSpec::Matchers.define :include_module do |expected| match do described_class.included_modules.include?(expected) -- cgit v1.2.1 From 0d5cf111f3070994c0e80ef764d1bd4b9e4936b1 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Tue, 21 Jul 2015 22:09:58 -0400 Subject: Move custom matchers to their own files under spec/support/matchers --- spec/support/matchers.rb | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 spec/support/matchers.rb (limited to 'spec/support/matchers.rb') diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb deleted file mode 100644 index d9b27ab08d8..00000000000 --- a/spec/support/matchers.rb +++ /dev/null @@ -1,23 +0,0 @@ -RSpec::Matchers.define :include_module do |expected| - match do - described_class.included_modules.include?(expected) - end - - description do - "includes the #{expected} module" - end - - failure_message do - "expected #{described_class} to include the #{expected} module" - end -end - -# Extend shoulda-matchers -module Shoulda::Matchers::ActiveModel - class ValidateLengthOfMatcher - # Shortcut for is_at_least and is_at_most - def is_within(range) - is_at_least(range.min) && is_at_most(range.max) - end - end -end -- cgit v1.2.1