mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-13 17:57:21 +00:00
Merge "tests: Delete the rspec tests"
This commit is contained in:
commit
7c7e1763e4
22
.rubocop.yml
22
.rubocop.yml
|
@ -1,22 +0,0 @@
|
|||
inherit_from: .rubocop_todo.yml
|
||||
|
||||
AllCops:
|
||||
StyleGuideCopsOnly: true
|
||||
|
||||
Metrics/LineLength:
|
||||
Max: 100
|
||||
|
||||
Metrics/MethodLength:
|
||||
Enabled: false
|
||||
|
||||
Style/Alias:
|
||||
Enabled: false
|
||||
|
||||
Style/SignalException:
|
||||
Enabled: false
|
||||
|
||||
Style/StringLiterals:
|
||||
EnforcedStyle: single_quotes
|
||||
|
||||
Style/TrivialAccessors:
|
||||
ExactNameMatch: true
|
19
Rakefile
19
Rakefile
|
@ -1,19 +0,0 @@
|
|||
require 'bundler/setup'
|
||||
|
||||
require 'rubocop/rake_task'
|
||||
RuboCop::RakeTask.new(:rubocop) do |task|
|
||||
# if you use mediawiki-vagrant, rubocop will by default use it's .rubocop.yml
|
||||
# the next line makes it explicit that you want .rubocop.yml from the directory
|
||||
# where `bundle exec rake` is executed
|
||||
task.options = ['-c', '.rubocop.yml']
|
||||
end
|
||||
|
||||
require 'rspec/core/rake_task'
|
||||
RSpec::Core::RakeTask.new do |t|
|
||||
t.rspec_opts = 'tests/rspec/'
|
||||
end
|
||||
|
||||
task default: [:test]
|
||||
|
||||
desc 'Run all build/tests commands (CI entry point)'
|
||||
task test: [:rubocop, :spec]
|
|
@ -1,7 +0,0 @@
|
|||
# Usage
|
||||
|
||||
vagrant up
|
||||
vagrant roles enable echo flow wikimediaflow
|
||||
vagrant provision
|
||||
bundle install
|
||||
bundle exec rake spec
|
|
@ -1,55 +0,0 @@
|
|||
require 'mediawiki_api'
|
||||
|
||||
describe 'Echo' do
|
||||
before(:all) do
|
||||
if ENV['JENKINS_HOME']
|
||||
# jenkins
|
||||
@mediawiki_api = "#{ENV['MW_SERVER']}#{ENV['MW_SCRIPT_PATH']}/api.php"
|
||||
@admin_username = "#{ENV['MEDIAWIKI_USER']}"
|
||||
@admin_password = "#{ENV['MEDIAWIKI_PASSWORD']}"
|
||||
else
|
||||
# mediawiki-vagrant
|
||||
@mediawiki_api = 'http://127.0.0.1:8080/w/api.php'
|
||||
@admin_username = 'Admin'
|
||||
@admin_password = 'vagrant'
|
||||
end
|
||||
|
||||
@client = MediawikiApi::Client.new @mediawiki_api
|
||||
end
|
||||
|
||||
before(:each) do
|
||||
@client.log_in @admin_username, @admin_password
|
||||
|
||||
require 'securerandom'
|
||||
@random_username = "U#{SecureRandom.hex(5)}"
|
||||
@random_password = SecureRandom.hex(5)
|
||||
end
|
||||
|
||||
it 'should notify a new user with welcome message' do
|
||||
@client.create_account(@random_username, @random_password)
|
||||
|
||||
@client.log_in @random_username, @random_password
|
||||
notifications = @client.query(meta: 'notifications').data['notifications']['list']
|
||||
|
||||
welcome_notification = notifications.first
|
||||
expect(welcome_notification['type']).to eq 'welcome'
|
||||
expect(welcome_notification['agent']['name']).to eq @random_username
|
||||
expect(welcome_notification['timestamp']['date']).to eq 'Today'
|
||||
end
|
||||
|
||||
it 'should notify user about mention on wikitext page' do
|
||||
@client.create_account(@random_username, @random_password)
|
||||
|
||||
page = SecureRandom.hex(5).capitalize
|
||||
@client.edit(title: page, text: "[[User:#{@random_username}]] ~~~~")
|
||||
|
||||
@client.log_in @random_username, @random_password
|
||||
notifications = @client.query(meta: 'notifications').data['notifications']['list']
|
||||
|
||||
mention_notification = notifications.last
|
||||
expect(mention_notification['type']).to eq 'mention'
|
||||
expect(mention_notification['agent']['name']).to eq @admin_username
|
||||
expect(mention_notification['title']['full']).to eq page
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in a new issue