Skip to content

Commit

Permalink
Merge fc94af9 into 5166b95
Browse files Browse the repository at this point in the history
  • Loading branch information
lHydra committed Oct 26, 2018
2 parents 5166b95 + fc94af9 commit da19bad
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 45 deletions.
6 changes: 0 additions & 6 deletions spec/controllers/events_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -586,10 +586,4 @@
expect(page_analysis.pages.size).to be >= 3
end
end

def login(role)
@profile = FactoryGirl.create(:profile)
@profile.user.role = role
login_as(@profile.user, :scope => :user)
end
end
7 changes: 0 additions & 7 deletions spec/features/email_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,4 @@
expect(page.find('#email_subject').value).to eq(@template.subject)
expect(page.find('#email_content').value).to eq(@template.content)
end


def login(role)
@profile = FactoryGirl.create(:profile)
@profile.user.role = role
login_as(@profile.user, :scope => :user)
end
end
6 changes: 0 additions & 6 deletions spec/features/event_draft_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,4 @@
visit events_path
expect(page).to_not have_text(@event.name)
end

def login(role)
@profile = FactoryGirl.create(:profile)
@profile.user.role = role
login_as(@profile.user, :scope => :user)
end
end
6 changes: 0 additions & 6 deletions spec/features/events_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -440,10 +440,4 @@
expect(page).to have_every_text(not_accepted_names)
expect(page).to have_no_text(accepted_names)
end

def login(role)
@profile = FactoryGirl.create(:profile)
@profile.user.role = role
login_as(@profile.user, :scope => :user)
end
end
12 changes: 0 additions & 12 deletions spec/features/participants_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,6 @@
expect(page.body).to contain_ordered(expected_order.reverse)

end

def login(role)
@profile = FactoryGirl.create(:profile)
@profile.user.role = role
login_as(@profile.user, :scope => :user)
end
end

RSpec.feature "Event participants overview", :type => :feature do
Expand Down Expand Up @@ -123,10 +117,4 @@ def login(role)
expect{click_button I18n.t('emails.email_form.send')}.to change{ActionMailer::Base.deliveries.count}.by(0)
expect(page).to have_text(I18n.t('emails.submit.sending_failed'))
end

def login(role)
@profile = FactoryGirl.create(:profile)
@profile.user.role = role
login_as(@profile.user, :scope => :user)
end
end
6 changes: 0 additions & 6 deletions spec/features/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,4 @@
expect(page).to have_text(max2.profile.last_name)
expect(page).to_not have_text(user3.profile.last_name)
end

def login(role)
@profile = FactoryGirl.create(:profile)
@profile.user.role = role
login_as(@profile.user, :scope => :user)
end
end
1 change: 1 addition & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
config.include Warden::Test::Helpers
config.include Devise::Test::ControllerHelpers, :type => :controller
config.include Devise::Test::ControllerHelpers, :type => :view
config.include LoginMacros, type: :feature

# Reset warden after each test
config.after :each do
Expand Down
4 changes: 2 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
# Skip PhantomJS tests if PhantomJS is not installed.
config.filter_run_excluding :js => (not Cliver::detect('phantomjs'))

# load custom matchers
Dir[File.dirname(__FILE__) + "/support/matchers/*.rb"].each {|f| require f}
# load custom matchers and helpers
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }

# Use color not only in STDOUT but also in pagers and files
# config.tty = true
Expand Down
7 changes: 7 additions & 0 deletions spec/support/login_macros.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module LoginMacros
def login(role)
@profile = FactoryGirl.create(:profile)
@profile.user.role = role
login_as(@profile.user, :scope => :user)
end
end

0 comments on commit da19bad

Please sign in to comment.