Skip to content

Commit

Permalink
Merge pull request carrierwaveuploader#434 from commuter/add_descript…
Browse files Browse the repository at this point in the history
…ion_to_matchers

add descriptions for matchers called without a string
  • Loading branch information
jnicklas committed Aug 17, 2011
2 parents c445917 + da3433a commit 1c8ff86
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/carrierwave/test/matchers.rb
Expand Up @@ -13,16 +13,23 @@ class BeIdenticalTo # :nodoc:
def initialize(expected)
@expected = expected
end

def matches?(actual)
@actual = actual
FileUtils.identical?(@actual, @expected)
end

def failure_message
"expected #{@actual.inspect} to be identical to #{@expected.inspect}"
end

def negative_failure_message
"expected #{@actual.inspect} to not be identical to #{@expected.inspect}"
end

def description
"be identical to #{@expected.inspect}"
end
end

def be_identical_to(expected)
Expand All @@ -47,6 +54,10 @@ def failure_message
def negative_failure_message
"expected #{@actual.inspect} not to have permissions #{@expected.to_s(8)}, but it did"
end

def description
"have permissions #{@expected.to_s(8)}"
end
end

def have_permissions(expected)
Expand Down Expand Up @@ -75,6 +86,9 @@ def negative_failure_message
"expected #{@actual.current_path.inspect} to be larger than #{@width} by #{@height}, but it wasn't."
end

def description
"be no larger than #{@width} by #{@height}"
end
end

def be_no_larger_than(width, height)
Expand Down Expand Up @@ -103,6 +117,9 @@ def negative_failure_message
"expected #{@actual.current_path.inspect} not to have an exact size of #{@width} by #{@height}, but it did."
end

def description
"have an exact size of #{@width} by #{@height}"
end
end

def have_dimensions(width, height)
Expand Down

0 comments on commit 1c8ff86

Please sign in to comment.