spec/support/fixture_data.rb in flapjack-diner-2.0.0.pre.alpha.1 vs spec/support/fixture_data.rb in flapjack-diner-2.0.0.pre.alpha.2

- old
+ new

@@ -160,10 +160,16 @@ end def contact_rel(co_data) id = co_data[:id] { + :blackholes => { + :links => { + :self => "http://#{api_host}/contacts/#{id}/relationships/blackholes", + :related => "http://#{api_host}/contacts/#{id}/blackholes" + } + }, :checks => { :links => { :self => "http://#{api_host}/contacts/#{id}/relationships/checks", :related => "http://#{api_host}/contacts/#{id}/checks" } @@ -299,19 +305,17 @@ end def rule_data @rule_data ||= { :id => '05983623-fcef-42da-af44-ed6990b500fa', - :is_blackhole => false, :conditions_list => 'critical' } end def rule_2_data @rule_2_data ||= { :id => '20f182fc-6e32-4794-9007-97366d162c51', - :is_blackhole => false, :conditions_list => 'warning' } end def rule_json(ru_data) @@ -344,25 +348,71 @@ } } } end + def blackhole_data + @blackhole_data ||= { + :id => '05983623-fcef-42da-af44-ed6990b500fa', + :conditions_list => 'critical' + } + end + + def blackhole_2_data + @blackhole_2_data ||= { + :id => '20f182fc-6e32-4794-9007-97366d162c51', + :conditions_list => 'warning' + } + end + + def blackhole_json(bl_data) + { + :id => bl_data[:id], + :type => 'blackhole', + :attributes => bl_data.reject {|k,v| :id.eql?(k) } + } + end + + def blackhole_rel(bl_data) + id = bl_data[:id] + { + :contact => { + :links => { + :self => "http://example.org/blackholes/#{id}/relationships/contact", + :related => "http://example.org/blackholes/#{id}/contact" + } + }, + :media => { + :links => { + :self => "http://example.org/blackholes/#{id}/relationships/media", + :related => "http://example.org/blackholes/#{id}/media" + } + }, + :tags => { + :links => { + :self => "http://example.org/blackholes/#{id}/relationships/tags", + :related => "http://example.org/blackholes/#{id}/tags" + } + } + } + end + def state_data @state_data ||= { :id => '142acf62-31e7-4074-ada9-a30ae73d880d', :created_at => (fixture_time - 30).iso8601, :updated_at => (fixture_time - 30).iso8601, - :condition => 'critical' + :condition => 'critical', } end def state_2_data @state_2_data ||= { :id => '008d78fc-1c72-4c2a-8057-0d44b64c6f3d', :created_at => (fixture_time - 10).iso8601, :updated_at => (fixture_time - 10).iso8601, - :condition => 'ok' + :condition => 'ok', } end def state_json(st_data) id = st_data[:id] @@ -406,9 +456,15 @@ end def tag_rel(ta_data) id = ta_data[:name] { + :blackholes => { + :links => { + :self => "http://#{api_host}/tags/#{id}/relationships/blackholes", + :related => "http://#{api_host}/tags/#{id}/blackholes" + } + }, :checks => { :links => { :self => "http://#{api_host}/tags/#{id}/relationships/checks", :related => "http://#{api_host}/tags/#{id}/checks" } \ No newline at end of file