kono_epp_client 0.0.3 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +17 -0
- data/README.md +16 -0
- data/Rakefile +6 -0
- data/kono_epp_client.gemspec +39 -0
- data/lib/epp/epp_command/check_contacts.rb +17 -0
- data/lib/epp/epp_command/create_domain.rb +4 -2
- data/lib/epp/epp_command/kono_epp_check_domains.rb +18 -0
- data/lib/epp/epp_command/transfer_domain.rb +22 -5
- data/lib/epp/epp_command/update_domain.rb +60 -44
- data/lib/epp/exceptions.rb +10 -0
- data/lib/epp/server.rb +116 -84
- data/lib/epp/transport/http.rb +10 -5
- data/lib/kono_epp_client/VERSION +1 -0
- data/lib/kono_epp_client/version.rb +3 -0
- data/lib/kono_epp_client.rb +5 -14
- data/spec/epp/epp_command/kono_epp_check_contacts_spec.rb +25 -0
- data/spec/epp/epp_command/kono_epp_check_domains_spec.rb +16 -0
- data/spec/epp/epp_command/kono_epp_create_domain_spec.rb +37 -0
- data/spec/epp/epp_command/kono_epp_transfer_domain_spec.rb +33 -0
- data/spec/epp/epp_command/kono_epp_update_domain_spec.rb +125 -0
- data/spec/epp/kono_epp_command_spec.rb +16 -0
- data/spec/epp/server_spec.rb +69 -0
- data/spec/fixtures/snapshots/kono_epp_check_contacts/_construct.xml.snap +13 -0
- data/spec/fixtures/snapshots/kono_epp_check_domains/_construct.xml.snap +11 -0
- data/spec/fixtures/snapshots/kono_epp_create_domain/_create.xml.snap +29 -0
- data/spec/fixtures/snapshots/kono_epp_transfer_domain/_con_extension_construct.xml.snap +23 -0
- data/spec/fixtures/snapshots/kono_epp_transfer_domain/_construct.xml.snap +13 -0
- data/spec/fixtures/snapshots/kono_epp_update_domain/_restore_esiste_l'estensione_di_restore.xml.snap +15 -0
- data/spec/fixtures/snapshots/kono_epp_update_domain/_update_auth_info_cambia_AUTH_INFO.xml.snap +15 -0
- data/spec/fixtures/snapshots/kono_epp_update_domain/_update_auth_info_con_nuovo_registrant_cambia_REGISTRANT.xml.snap +16 -0
- data/spec/fixtures/snapshots/kono_epp_update_domain/_update_contacts_cambia_ADMIN_TECH.xml.snap +18 -0
- data/spec/fixtures/snapshots/kono_epp_update_domain/_update_nameservers_aggiunge_e_rimuove_ns.xml.snap +28 -0
- data/spec/fixtures/snapshots/kono_epp_update_domain/_update_status_cambia_status.xml.snap +16 -0
- data/spec/spec_helper.rb +111 -0
- data/spec/support/context.rb +15 -0
- data/spec/support/matchers.rb +6 -0
- data/spec/support/snapshot.rb +20 -0
- data/spec/support/superdiff.rb +1 -0
- metadata +159 -6
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'rexml/document'
|
3
|
+
|
4
|
+
RSpec.describe KonoEppCommand do
|
5
|
+
it 'generates a valid XML document with the expected structure' do
|
6
|
+
xml_document = KonoEppCommand.new
|
7
|
+
expect(xml_document).to be_a(REXML::Document)
|
8
|
+
expect(xml_document.to_s).to include("xsi:schemaLocation='urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd'")
|
9
|
+
expect(xml_document.to_s).to include("xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'")
|
10
|
+
expect(xml_document.to_s).to have_tag("epp",with:{
|
11
|
+
xmlns:"urn:ietf:params:xml:ns:epp-1.0"
|
12
|
+
}) do
|
13
|
+
have_tag("command",count:1)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
RSpec.describe KonoEppClient::Server do
|
2
|
+
|
3
|
+
let(:params) {
|
4
|
+
{
|
5
|
+
tag: "abc",
|
6
|
+
password: "123123",
|
7
|
+
server: "epp.pubtest.nic.it"
|
8
|
+
}
|
9
|
+
}
|
10
|
+
|
11
|
+
let(:instance) { described_class.new(params) }
|
12
|
+
|
13
|
+
describe "initialization" do
|
14
|
+
|
15
|
+
it "base" do
|
16
|
+
expect(instance).to have_attributes(
|
17
|
+
**params,
|
18
|
+
port: 700,
|
19
|
+
old_server: false,
|
20
|
+
lang: "en",
|
21
|
+
services: ["urn:ietf:params:xml:ns:domain-1.0", "urn:ietf:params:xml:ns:contact-1.0", "urn:ietf:params:xml:ns:host-1.0"],
|
22
|
+
extensions: [],
|
23
|
+
version: "1.0",
|
24
|
+
transport: :tcp,
|
25
|
+
transport_options: {},
|
26
|
+
timeout: 30,
|
27
|
+
ssl_version: :TLSv1
|
28
|
+
)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "#open_connection" do
|
33
|
+
|
34
|
+
it "default transport" do
|
35
|
+
|
36
|
+
double = instance_double(KonoEppClient::Transport::TcpTransport)
|
37
|
+
|
38
|
+
expect(KonoEppClient::Transport::TcpTransport).to receive(:new).with(params[:server], 700).and_return(double)
|
39
|
+
|
40
|
+
expect { instance.open_connection }.to change { instance.instance_variable_get(:@connection) }.
|
41
|
+
to(double)
|
42
|
+
end
|
43
|
+
|
44
|
+
context "transport http" do
|
45
|
+
|
46
|
+
let(:params) {
|
47
|
+
super().merge(
|
48
|
+
transport: :http,
|
49
|
+
transport_options: {cookie_file: "file_to_coockies"},
|
50
|
+
)
|
51
|
+
}
|
52
|
+
|
53
|
+
it "use http transport" do
|
54
|
+
double = instance_double(KonoEppClient::Transport::HttpTransport)
|
55
|
+
|
56
|
+
expect(KonoEppClient::Transport::HttpTransport).to receive(:new).with(
|
57
|
+
params[:server],
|
58
|
+
700, ssl_version: :TLSv1, cookie_file: "file_to_coockies").and_return(double)
|
59
|
+
|
60
|
+
expect { instance.open_connection }.to change { instance.instance_variable_get(:@connection) }.
|
61
|
+
to(double)
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
|
3
|
+
<command>
|
4
|
+
<check>
|
5
|
+
<contact:check xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
|
6
|
+
<contact:id>mm001</contact:id>
|
7
|
+
<contact:id>mb001</contact:id>
|
8
|
+
<contact:id>cl001</contact:id>
|
9
|
+
<contact:id>bb001</contact:id>
|
10
|
+
</contact:check>
|
11
|
+
</check>
|
12
|
+
</command>
|
13
|
+
</epp>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
|
3
|
+
<command>
|
4
|
+
<check>
|
5
|
+
<domain:check xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
|
6
|
+
<domain:name>test.it</domain:name>
|
7
|
+
<domain:name>wow.it</domain:name>
|
8
|
+
</domain:check>
|
9
|
+
</check>
|
10
|
+
</command>
|
11
|
+
</epp>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
|
3
|
+
<command>
|
4
|
+
<create>
|
5
|
+
<domain:create xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
|
6
|
+
<domain:name>architest.it</domain:name>
|
7
|
+
<domain:ns>
|
8
|
+
<domain:hostAttr>
|
9
|
+
<domain:hostName>ns.test.it</domain:hostName>
|
10
|
+
<domain:hostAddr ip="v4">192.168.100.10</domain:hostAddr>
|
11
|
+
</domain:hostAttr>
|
12
|
+
<domain:hostAttr>
|
13
|
+
<domain:hostName>ns2.test.it</domain:hostName>
|
14
|
+
<domain:hostAddr ip="v4">192.168.100.20</domain:hostAddr>
|
15
|
+
</domain:hostAttr>
|
16
|
+
<domain:hostAttr>
|
17
|
+
<domain:hostName>ns3.foo.com</domain:hostName>
|
18
|
+
</domain:hostAttr>
|
19
|
+
</domain:ns>
|
20
|
+
<domain:registrant>RRR12</domain:registrant>
|
21
|
+
<domain:contact type="admin">AAAA12</domain:contact>
|
22
|
+
<domain:contact type="tech">TTT12</domain:contact>
|
23
|
+
<domain:authInfo>
|
24
|
+
<domain:pw>WWW-test-it</domain:pw>
|
25
|
+
</domain:authInfo>
|
26
|
+
</domain:create>
|
27
|
+
</create>
|
28
|
+
</command>
|
29
|
+
</epp>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
|
3
|
+
<command>
|
4
|
+
<transfer op="request">
|
5
|
+
<domain:transfer xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
|
6
|
+
<domain:name>test.it</domain:name>
|
7
|
+
<domain:authInfo>
|
8
|
+
<domain:pw>wee-12-sd</domain:pw>
|
9
|
+
</domain:authInfo>
|
10
|
+
</domain:transfer>
|
11
|
+
</transfer>
|
12
|
+
<extension>
|
13
|
+
<extdom:trade xmlns:extdom="http://www.nic.it/ITNIC-EPP/extdom-2.0" xsi:schemaLocation="http://www.nic.it/ITNIC-EPP/extdom-2.0 extdom-2.0.xsd">
|
14
|
+
<extdom:transferTrade>
|
15
|
+
<extdom:newRegistrant>xx123fd</extdom:newRegistrant>
|
16
|
+
<extdom:newAuthInfo>
|
17
|
+
<extdom:pw>abc-sd934-sd</extdom:pw>
|
18
|
+
</extdom:newAuthInfo>
|
19
|
+
</extdom:transferTrade>
|
20
|
+
</extdom:trade>
|
21
|
+
</extension>
|
22
|
+
</command>
|
23
|
+
</epp>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
|
3
|
+
<command>
|
4
|
+
<transfer op="request">
|
5
|
+
<domain:transfer xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
|
6
|
+
<domain:name>test.it</domain:name>
|
7
|
+
<domain:authInfo>
|
8
|
+
<domain:pw>wee-12-sd</domain:pw>
|
9
|
+
</domain:authInfo>
|
10
|
+
</domain:transfer>
|
11
|
+
</transfer>
|
12
|
+
</command>
|
13
|
+
</epp>
|
data/spec/fixtures/snapshots/kono_epp_update_domain/_restore_esiste_l'estensione_di_restore.xml.snap
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
|
3
|
+
<command>
|
4
|
+
<update>
|
5
|
+
<domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
|
6
|
+
<domain:name>example.com</domain:name>
|
7
|
+
</domain:update>
|
8
|
+
</update>
|
9
|
+
<extension>
|
10
|
+
<rgp:update xmlns:rgp="urn:ietf:params:xml:ns:rgp-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:rgp-1.0 rgp-1.0.xsd">
|
11
|
+
<rgp:restore op="request"/>
|
12
|
+
</rgp:update>
|
13
|
+
</extension>
|
14
|
+
</command>
|
15
|
+
</epp>
|
data/spec/fixtures/snapshots/kono_epp_update_domain/_update_auth_info_cambia_AUTH_INFO.xml.snap
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
|
3
|
+
<command>
|
4
|
+
<update>
|
5
|
+
<domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
|
6
|
+
<domain:name>example.com</domain:name>
|
7
|
+
<domain:chg>
|
8
|
+
<domain:authInfo>
|
9
|
+
<domain:pw>AUTH12-!DSRTG</domain:pw>
|
10
|
+
</domain:authInfo>
|
11
|
+
</domain:chg>
|
12
|
+
</domain:update>
|
13
|
+
</update>
|
14
|
+
</command>
|
15
|
+
</epp>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
|
3
|
+
<command>
|
4
|
+
<update>
|
5
|
+
<domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
|
6
|
+
<domain:name>example.com</domain:name>
|
7
|
+
<domain:chg>
|
8
|
+
<domain:registrant>R0001</domain:registrant>
|
9
|
+
<domain:authInfo>
|
10
|
+
<domain:pw>AUTH12-!DSRTG</domain:pw>
|
11
|
+
</domain:authInfo>
|
12
|
+
</domain:chg>
|
13
|
+
</domain:update>
|
14
|
+
</update>
|
15
|
+
</command>
|
16
|
+
</epp>
|
data/spec/fixtures/snapshots/kono_epp_update_domain/_update_contacts_cambia_ADMIN_TECH.xml.snap
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
|
3
|
+
<command>
|
4
|
+
<update>
|
5
|
+
<domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
|
6
|
+
<domain:name>example.com</domain:name>
|
7
|
+
<domain:add>
|
8
|
+
<domain:contact type="admin">AAA1</domain:contact>
|
9
|
+
<domain:contact type="tech">TTT1</domain:contact>
|
10
|
+
</domain:add>
|
11
|
+
<domain:rem>
|
12
|
+
<domain:contact type="admin">AAA2</domain:contact>
|
13
|
+
<domain:contact type="tech">TTT2</domain:contact>
|
14
|
+
</domain:rem>
|
15
|
+
</domain:update>
|
16
|
+
</update>
|
17
|
+
</command>
|
18
|
+
</epp>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
|
3
|
+
<command>
|
4
|
+
<update>
|
5
|
+
<domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
|
6
|
+
<domain:name>example.com</domain:name>
|
7
|
+
<domain:add>
|
8
|
+
<domain:ns>
|
9
|
+
<domain:hostAttr>
|
10
|
+
<domain:hostName>ns1.example.com</domain:hostName>
|
11
|
+
<domain:hostAddr ip="v4">192.168.1.1</domain:hostAddr>
|
12
|
+
</domain:hostAttr>
|
13
|
+
<domain:hostAttr>
|
14
|
+
<domain:hostName>ns3.example.com</domain:hostName>
|
15
|
+
</domain:hostAttr>
|
16
|
+
</domain:ns>
|
17
|
+
</domain:add>
|
18
|
+
<domain:rem>
|
19
|
+
<domain:ns>
|
20
|
+
<domain:hostAttr>
|
21
|
+
<domain:hostName>ns2.example.com</domain:hostName>
|
22
|
+
</domain:hostAttr>
|
23
|
+
</domain:ns>
|
24
|
+
</domain:rem>
|
25
|
+
</domain:update>
|
26
|
+
</update>
|
27
|
+
</command>
|
28
|
+
</epp>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
|
3
|
+
<command>
|
4
|
+
<update>
|
5
|
+
<domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
|
6
|
+
<domain:name>example.com</domain:name>
|
7
|
+
<domain:add>
|
8
|
+
<domain:status s="clientTransferProhibited"/>
|
9
|
+
</domain:add>
|
10
|
+
<domain:rem>
|
11
|
+
<domain:status s="clientHold"/>
|
12
|
+
</domain:rem>
|
13
|
+
</domain:update>
|
14
|
+
</update>
|
15
|
+
</command>
|
16
|
+
</epp>
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
Bundler.setup
|
3
|
+
|
4
|
+
require 'simplecov'
|
5
|
+
SimpleCov.start do
|
6
|
+
add_group "Commands","lib/epp/epp_command"
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'kono_epp_client' # and any other gems you need
|
10
|
+
|
11
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
12
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
13
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
14
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
15
|
+
# files.
|
16
|
+
#
|
17
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
18
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
19
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
20
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
21
|
+
# a separate helper file that requires the additional dependencies and performs
|
22
|
+
# the additional setup, and require it from the spec files that actually need
|
23
|
+
# it.
|
24
|
+
#
|
25
|
+
# See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
26
|
+
Dir[File.join(File.dirname(__FILE__),"support/*.rb")].each { |f| require f }
|
27
|
+
|
28
|
+
RSpec.configure do |config|
|
29
|
+
|
30
|
+
# rspec-expectations config goes here. You can use an alternate
|
31
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
32
|
+
# assertions if you prefer.
|
33
|
+
config.expect_with :rspec do |expectations|
|
34
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
35
|
+
# and `failure_message` of custom matchers include text for helper methods
|
36
|
+
# defined using `chain`, e.g.:
|
37
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
38
|
+
# # => "be bigger than 2 and smaller than 4"
|
39
|
+
# ...rather than:
|
40
|
+
# # => "be bigger than 2"
|
41
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
42
|
+
end
|
43
|
+
|
44
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
45
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
46
|
+
config.mock_with :rspec do |mocks|
|
47
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
48
|
+
# a real object. This is generally recommended, and will default to
|
49
|
+
# `true` in RSpec 4.
|
50
|
+
mocks.verify_partial_doubles = true
|
51
|
+
end
|
52
|
+
|
53
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
54
|
+
# have no way to turn it off -- the option exists only for backwards
|
55
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
56
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
57
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
58
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
59
|
+
|
60
|
+
# The settings below are suggested to provide a good initial experience
|
61
|
+
# with RSpec, but feel free to customize to your heart's content.
|
62
|
+
=begin
|
63
|
+
# This allows you to limit a spec run to individual examples or groups
|
64
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
65
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
66
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
67
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
68
|
+
config.filter_run_when_matching :focus
|
69
|
+
|
70
|
+
# Allows RSpec to persist some state between runs in order to support
|
71
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
72
|
+
# you configure your source control system to ignore this file.
|
73
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
74
|
+
|
75
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
76
|
+
# recommended. For more details, see:
|
77
|
+
# https://rspec.info/features/3-12/rspec-core/configuration/zero-monkey-patching-mode/
|
78
|
+
config.disable_monkey_patching!
|
79
|
+
|
80
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
81
|
+
# be too noisy due to issues in dependencies.
|
82
|
+
config.warnings = true
|
83
|
+
|
84
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
85
|
+
# file, and it's useful to allow more verbose output when running an
|
86
|
+
# individual spec file.
|
87
|
+
if config.files_to_run.one?
|
88
|
+
# Use the documentation formatter for detailed output,
|
89
|
+
# unless a formatter has already been configured
|
90
|
+
# (e.g. via a command-line flag).
|
91
|
+
config.default_formatter = "doc"
|
92
|
+
end
|
93
|
+
|
94
|
+
# Print the 10 slowest examples and example groups at the
|
95
|
+
# end of the spec run, to help surface which specs are running
|
96
|
+
# particularly slow.
|
97
|
+
config.profile_examples = 10
|
98
|
+
|
99
|
+
# Run specs in random order to surface order dependencies. If you find an
|
100
|
+
# order dependency and want to debug it, you can fix the order by providing
|
101
|
+
# the seed, which is printed after each run.
|
102
|
+
# --seed 1234
|
103
|
+
config.order = :random
|
104
|
+
|
105
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
106
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
107
|
+
# test failures related to randomization by passing the same `--seed` value
|
108
|
+
# as the one that triggered the failure.
|
109
|
+
Kernel.srand config.seed
|
110
|
+
=end
|
111
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
RSpec.shared_context "like epp command" do
|
2
|
+
|
3
|
+
let(:instance) {
|
4
|
+
described_class.new
|
5
|
+
}
|
6
|
+
|
7
|
+
let(:raw_rendered_content) {
|
8
|
+
instance.to_s
|
9
|
+
}
|
10
|
+
let(:rendered) {
|
11
|
+
x = Nokogiri::XML(raw_rendered_content)
|
12
|
+
x.remove_namespaces! # FIXME non capisco come funzioni la ricerca con namespace
|
13
|
+
x
|
14
|
+
}
|
15
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "rspec/snapshot"
|
2
|
+
require "active_support/core_ext/string"
|
3
|
+
RSpec.configure do |config|
|
4
|
+
|
5
|
+
config.snapshot_dir = "spec/fixtures/snapshots"
|
6
|
+
|
7
|
+
config.after(:each, snapshot: true) do |example|
|
8
|
+
extension=nil
|
9
|
+
extension = ".#{example.metadata[:snapshot]}" unless example.metadata[:snapshot] === true
|
10
|
+
class_name = example.metadata[:described_class].name.underscore
|
11
|
+
test_name = example.metadata[:full_description].gsub(example.metadata[:described_class].name, "").tr(" ", "_")
|
12
|
+
raise "component snapshot has no content" if raw_rendered_content.nil? or raw_rendered_content.empty?
|
13
|
+
str_content = raw_rendered_content
|
14
|
+
if extension == ".xml"
|
15
|
+
str_content = Nokogiri.XML(str_content).to_xml
|
16
|
+
end
|
17
|
+
expect(str_content).to match_snapshot("#{class_name}/#{test_name}#{extension}")
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require "super_diff/rspec"
|