Skip to content

Commit

Permalink
Added some negative specs for Surface#opacity=.
Browse files Browse the repository at this point in the history
  • Loading branch information
jacius committed Feb 7, 2011
1 parent 9267cde commit 0c8576e
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions spec/surface_spec.rb
Expand Up @@ -1292,6 +1292,20 @@
@surface.opacity(2)
@surface.opacity.should eql( 1.0 )
end

invalid_args = {
"true" => true,
"a symbol" => :symbol,
"an array" => [1.0],
"a hash" => {1=>2},
"some object" => Object.new,
}

invalid_args.each do |thing, arg|
it "should fail when given #{thing}" do
expect{@surface.opacity(arg)}.to raise_error
end
end
end

end
Expand Down Expand Up @@ -1330,4 +1344,17 @@
@surface.opacity.should eql( 1.0 )
end

invalid_args = {
"true" => true,
"a symbol" => :symbol,
"an array" => [1.0],
"a hash" => {1=>2},
"some object" => Object.new,
}

invalid_args.each do |thing, arg|
it "should fail when given #{thing}" do
expect{@surface.opacity = arg}.to raise_error
end
end
end

0 comments on commit 0c8576e

Please sign in to comment.