Skip to content

Commit

Permalink
fixed decorator tests
Browse files Browse the repository at this point in the history
  • Loading branch information
giusepped committed Feb 10, 2017
1 parent b21f194 commit 1da118e
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 51 deletions.
12 changes: 6 additions & 6 deletions spec/parliament/decorators/constituency_area_spec.rb
Expand Up @@ -7,7 +7,7 @@
describe '#latitude' do
context 'constituency has a latitude' do
it 'returns the latitude of the constituency area' do
constituency_area_node = response.filter('http://id.ukpds.org/schema/ConstituencyArea').first[0]
constituency_area_node = response.filter('http://id.ukpds.org/schema/ConstituencyArea')[0]

expect(constituency_area_node).to respond_to(:latitude)
expect(constituency_area_node.latitude).to eq '53.4156316801'
Expand All @@ -16,7 +16,7 @@

context 'constituency has no latitude' do
it 'returns an empty string' do
constituency_area_node = response.filter('http://id.ukpds.org/schema/ConstituencyArea').first[1]
constituency_area_node = response.filter('http://id.ukpds.org/schema/ConstituencyArea')[1]

expect(constituency_area_node).to respond_to(:latitude)
expect(constituency_area_node.latitude).to eq ''
Expand All @@ -27,7 +27,7 @@
describe '#longitude' do
context 'constituency has a longitude' do
it 'returns the longitude of the constituency area' do
constituency_area_node = response.filter('http://id.ukpds.org/schema/ConstituencyArea').first[0]
constituency_area_node = response.filter('http://id.ukpds.org/schema/ConstituencyArea')[0]

expect(constituency_area_node).to respond_to(:longitude)
expect(constituency_area_node.longitude).to eq '-1.46711981738'
Expand All @@ -36,7 +36,7 @@

context 'constituency has no longitude' do
it 'returns an empty string' do
constituency_area_node = response.filter('http://id.ukpds.org/schema/ConstituencyArea').first[1]
constituency_area_node = response.filter('http://id.ukpds.org/schema/ConstituencyArea')[1]

expect(constituency_area_node).to respond_to(:longitude)
expect(constituency_area_node.longitude).to eq ''
Expand All @@ -47,7 +47,7 @@
describe '#polygon' do
context 'constituency has a polygon' do
it 'returns the polygon of the constituency area' do
constituency_area_node = response.filter('http://id.ukpds.org/schema/ConstituencyArea').first[0]
constituency_area_node = response.filter('http://id.ukpds.org/schema/ConstituencyArea')[0]

expect(constituency_area_node).to respond_to(:polygon)
expected_polygon = 'Polygon((-1.50958909420 53.39937821832,-1.50978426399 53.39941048368))'
Expand All @@ -57,7 +57,7 @@

context 'constituency has no polygon' do
it 'returns an empty string' do
constituency_area_node = response.filter('http://id.ukpds.org/schema/ConstituencyArea').first[1]
constituency_area_node = response.filter('http://id.ukpds.org/schema/ConstituencyArea')[1]

expect(constituency_area_node).to respond_to(:polygon)
expect(constituency_area_node.polygon).to eq ''
Expand Down
32 changes: 16 additions & 16 deletions spec/parliament/decorators/constituency_group_spec.rb
Expand Up @@ -9,7 +9,7 @@
describe '#name' do
context 'constituency has a name' do
it 'returns the name of the constituency' do
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup').first[0]
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup')[0]

expect(constituency_node).to respond_to(:name)
expect(constituency_node.name).to eq 'Sheffield, Brightside and Hillsborough'
Expand All @@ -18,7 +18,7 @@

context 'constituency has no name' do
it 'returns an empty string' do
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup').first[1]
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup')[1]

expect(constituency_node).to respond_to(:name)
expect(constituency_node.name).to eq ''
Expand All @@ -29,7 +29,7 @@
describe '#start_date' do
context 'constituency has a start date' do
it 'returns the start date of the constituency' do
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup').first[0]
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup')[0]

expect(constituency_node).to respond_to(:start_date)
expect(constituency_node.start_date).to eq '2010-05-06'
Expand All @@ -38,7 +38,7 @@

context 'constituency has no start date' do
it 'returns an empty string' do
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup').first[1]
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup')[1]

expect(constituency_node).to respond_to(:start_date)
expect(constituency_node.start_date).to eq ''
Expand All @@ -49,7 +49,7 @@
describe '#end_date' do
context 'constituency has an end date' do
it 'returns the end date of the constituency' do
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup').first[0]
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup')[0]

expect(constituency_node).to respond_to(:end_date)
expect(constituency_node.end_date).to eq '2011-05-06'
Expand All @@ -58,7 +58,7 @@

context 'constituency has no end date' do
it 'returns an empty string' do
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup').first[1]
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup')[1]

expect(constituency_node).to respond_to(:end_date)
expect(constituency_node.end_date).to eq ''
Expand All @@ -69,7 +69,7 @@
describe '#seats' do
context 'constituency has house seats' do
it 'returns an array of house seats' do
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup').first[0]
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup')[0]

expect(constituency_node).to respond_to(:seats)
expect(constituency_node.seats.size).to eq 1
Expand All @@ -79,7 +79,7 @@

context 'constituency has no house seats' do
it 'returns an empty array' do
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup').first[1]
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup')[1]

expect(constituency_node).to respond_to(:seats)
expect(constituency_node.seats).to eq []
Expand All @@ -90,7 +90,7 @@
describe '#seat_incumbencies' do
context 'constituency has seat incumbencies' do
it 'returns an array of seat incumbencies' do
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup').first[0]
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup')[0]

expect(constituency_node).to respond_to(:seat_incumbencies)
expect(constituency_node.seat_incumbencies.size).to eq 3
Expand All @@ -100,7 +100,7 @@

context 'constituency has no seat incumbencies' do
it 'returns an empty array' do
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup').first[1]
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup')[1]

expect(constituency_node).to respond_to(:seat_incumbencies)
expect(constituency_node.seat_incumbencies).to eq []
Expand All @@ -111,7 +111,7 @@
describe '#members' do
context 'constituency has members' do
it 'returns an array of members' do
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup').first[0]
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup')[0]

expect(constituency_node).to respond_to(:members)
expect(constituency_node.members.size).to eq 3
Expand All @@ -121,7 +121,7 @@

context 'constituency has no seat incumbencies' do
it 'returns an empty array' do
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup').first[1]
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup')[1]

expect(constituency_node).to respond_to(:members)
expect(constituency_node.members).to eq []
Expand All @@ -132,7 +132,7 @@
describe '#area' do
context 'constituency has an area' do
it 'returns the area' do
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup').first[0]
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup')[0]

expect(constituency_node).to respond_to(:area)
expect(constituency_node.area.type).to eq 'http://id.ukpds.org/schema/ConstituencyArea'
Expand All @@ -141,7 +141,7 @@

context 'constituency has no seat incumbencies' do
it 'returns nil' do
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup').first[1]
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup')[1]

expect(constituency_node).to respond_to(:area)
expect(constituency_node.area).to be_nil
Expand All @@ -152,7 +152,7 @@
describe '#contact_points' do
context 'constituency has contact points' do
it 'returns an array of contact points' do
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup').first[0]
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup')[0]

expect(constituency_node).to respond_to(:contact_points)
expect(constituency_node.contact_points.size).to eq 1
Expand All @@ -162,7 +162,7 @@

context 'constituency has no contact points' do
it 'returns an empty array' do
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup').first[1]
constituency_node = response.filter('http://id.ukpds.org/schema/ConstituencyGroup')[1]

expect(constituency_node).to respond_to(:contact_points)
expect(constituency_node.contact_points).to eq []
Expand Down
2 changes: 1 addition & 1 deletion spec/parliament/decorators/contact_point_spec.rb
Expand Up @@ -6,7 +6,7 @@
end

before(:each) do
@contact_point_nodes = response.filter('http://id.ukpds.org/schema/ContactPoint').first
@contact_point_nodes = response.filter('http://id.ukpds.org/schema/ContactPoint')
end

describe '#postal_addresses' do
Expand Down
2 changes: 1 addition & 1 deletion spec/parliament/decorators/gender_identity_spec.rb
Expand Up @@ -6,7 +6,7 @@
end

before(:each) do
@gender_identity_nodes = response.filter('http://id.ukpds.org/schema/GenderIdentity').first
@gender_identity_nodes = response.filter('http://id.ukpds.org/schema/GenderIdentity')
end

describe '#gender' do
Expand Down
2 changes: 1 addition & 1 deletion spec/parliament/decorators/gender_spec.rb
Expand Up @@ -6,7 +6,7 @@
end

before(:each) do
@gender_nodes = response.filter('http://id.ukpds.org/schema/Gender').first
@gender_nodes = response.filter('http://id.ukpds.org/schema/Gender')
end

describe '#name' do
Expand Down
4 changes: 2 additions & 2 deletions spec/parliament/decorators/house_seat_spec.rb
Expand Up @@ -6,7 +6,7 @@
end

before(:each) do
@seat_nodes = response.filter('http://id.ukpds.org/schema/HouseSeat').first
@seat_nodes = response.filter('http://id.ukpds.org/schema/HouseSeat')
end

describe '#house' do
Expand Down Expand Up @@ -47,7 +47,7 @@

describe '#seat_incumbencies' do
before(:each) do
@seat_nodes = response.filter('http://id.ukpds.org/schema/HouseSeat').first
@seat_nodes = response.filter('http://id.ukpds.org/schema/HouseSeat')
end

context 'Grom::Node has all the required objects' do
Expand Down
6 changes: 3 additions & 3 deletions spec/parliament/decorators/house_spec.rb
Expand Up @@ -7,7 +7,7 @@

describe '#name' do
before(:each) do
@house_nodes = response.filter('http://id.ukpds.org/schema/House').first
@house_nodes = response.filter('http://id.ukpds.org/schema/House')
end

context 'Grom::Node has all the required objects' do
Expand All @@ -31,7 +31,7 @@
before(:each) do
id = 'ff75cd0c-1a8b-49ab-8292-f00d153588e5'
response = Parliament::Request.new(base_url: 'http://localhost:3030').people(id).houses.get
@house_nodes = response.filter('http://id.ukpds.org/schema/House').first
@house_nodes = response.filter('http://id.ukpds.org/schema/House')
end

context 'Grom::Node has all the required objects' do
Expand All @@ -56,7 +56,7 @@
before(:each) do
id = 'ff75cd0c-1a8b-49ab-8292-f00d153588e5'
response = Parliament::Request.new(base_url: 'http://localhost:3030').people(id).houses.get
@house_nodes = response.filter('http://id.ukpds.org/schema/House').first
@house_nodes = response.filter('http://id.ukpds.org/schema/House')
end

context 'Grom::Node has all the required objects' do
Expand Down
2 changes: 1 addition & 1 deletion spec/parliament/decorators/party_membership_spec.rb
Expand Up @@ -6,7 +6,7 @@
end

before(:each) do
@party_membership_nodes = response.filter('http://id.ukpds.org/schema/PartyMembership').first
@party_membership_nodes = response.filter('http://id.ukpds.org/schema/PartyMembership')
end

describe '#party' do
Expand Down
4 changes: 2 additions & 2 deletions spec/parliament/decorators/party_spec.rb
Expand Up @@ -8,7 +8,7 @@

describe '#name' do
before(:each) do
@party_nodes = response.filter('http://id.ukpds.org/schema/Party').first
@party_nodes = response.filter('http://id.ukpds.org/schema/Party')
end

context 'Grom::Node has all the required objects' do
Expand Down Expand Up @@ -38,7 +38,7 @@
before(:each) do
id = '626b57f9-6ef0-475a-ae12-40a44aca7eff'
response = Parliament::Request.new(base_url: 'http://localhost:3030').people(id).parties.get
@party_nodes = response.filter('http://id.ukpds.org/schema/Party').first
@party_nodes = response.filter('http://id.ukpds.org/schema/Party')
end
context 'Grom::Node has all the required objects' do
it 'returns the party memberships for a Grom::Node object of type Party' do
Expand Down

0 comments on commit 1da118e

Please sign in to comment.