mirror of
				https://gitea.invidious.io/iv-org/shard-spectator.git
				synced 2024-08-15 00:53:35 +00:00 
			
		
		
		
	Fix various expectation type code
This commit is contained in:
		
							parent
							
								
									21e10c1ef2
								
							
						
					
					
						commit
						3b1a5a1121
					
				
					 2 changed files with 9 additions and 9 deletions
				
			
		|  | @ -9,7 +9,7 @@ module Spectator | ||||||
|     # Creates the exception. |     # Creates the exception. | ||||||
|     # The exception string is generated from the expecation message. |     # The exception string is generated from the expecation message. | ||||||
|     def initialize(@expectation) |     def initialize(@expectation) | ||||||
|       super(@expectation.actual_message) |       super(@expectation.failure_message) | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -9,7 +9,7 @@ module Spectator::Expectations | ||||||
|     getter source : Source |     getter source : Source | ||||||
| 
 | 
 | ||||||
|     # Creates the expectation. |     # Creates the expectation. | ||||||
|     def initialize(@match_data : MatchData, @source : Source) |     def initialize(@match_data : Matchers::MatchData, @source : Source) | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     def satisfied? |     def satisfied? | ||||||
|  | @ -21,19 +21,19 @@ module Spectator::Expectations | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     def failure_message? |     def failure_message? | ||||||
|       @match_data.as?(FailedMatchData).try(&.failure_message) |       @match_data.as?(Matchers::FailedMatchData).try(&.failure_message) | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     def failure_message |     def failure_message | ||||||
|       @match_data.as(FailedMatchData).failure_message |       @match_data.as(Matchers::FailedMatchData).failure_message | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     def values? |     def values? | ||||||
|       @match_data.as?(FailedMatchData).try(&.values) |       @match_data.as?(Matchers::FailedMatchData).try(&.values) | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     def values |     def values | ||||||
|       @match_data.as(FailedMatchData).values |       @match_data.as(Matchers::FailedMatchData).values | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     # Creates the JSON representation of the expectation. |     # Creates the JSON representation of the expectation. | ||||||
|  | @ -41,18 +41,18 @@ module Spectator::Expectations | ||||||
|       json.object do |       json.object do | ||||||
|         json.field("source") { @source.to_json(json) } |         json.field("source") { @source.to_json(json) } | ||||||
|         json.field("satisfied", satisfied?) |         json.field("satisfied", satisfied?) | ||||||
|         if (failed = @match_data.as?(FailedMatchData)) |         if (failed = @match_data.as?(Matchers::FailedMatchData)) | ||||||
|           failed_to_json(failed, json) |           failed_to_json(failed, json) | ||||||
|         end |         end | ||||||
|       end |       end | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     private def failed_to_json(failed : FailedMatchData, json : ::JSON::Builder) |     private def failed_to_json(failed : Matchers::FailedMatchData, json : ::JSON::Builder) | ||||||
|       json.field("failure", failed.failure_message) |       json.field("failure", failed.failure_message) | ||||||
|       json.field("values") do |       json.field("values") do | ||||||
|         json.object do |         json.object do | ||||||
|           failed.values.each do |pair| |           failed.values.each do |pair| | ||||||
|             json.field(pair.label, pair.value) |             json.field(pair.first, pair.last) | ||||||
|           end |           end | ||||||
|         end |         end | ||||||
|       end |       end | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue