Created
March 5, 2019 13:39
-
-
Save Sohair63/d5fd65c42f7aafc93863e87b1b916f6d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
module ControllerMacros | |
def login_user | |
before(:each) do | |
@request.env['devise.mapping'] = Devise.mappings[:user] | |
current_collaborator = FactoryBot.create(:account_collaborator, :admin) | |
current_account = current_collaborator.account | |
@request.host = "#{current_collaborator.account.url}.example.com" | |
user = FactoryBot.create(:user) | |
current_collaborator.user = user | |
current_collaborator.save | |
sign_in user | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
RSpec.configure do |config| | |
config.include FactoryBot::Syntax::Methods | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require 'vcr' | |
VCR.configure do |c| | |
c.cassette_library_dir = 'spec/vcr' | |
c.hook_into :webmock | |
c.configure_rspec_metadata! | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require 'webmock/rspec' | |
RSpec.configure do |config| | |
config.before(:each) do | |
WebMock.reset! | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment