Created
May 9, 2011 23:37
-
-
Save mjansen401/963646 to your computer and use it in GitHub Desktop.
_square.html.erb_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe "games/_square.html.erb" do | |
before(:each) do | |
@ttt = mock(TicTacToe) | |
end | |
it "displays a filled square" do | |
@ttt.stub!(:square_empty?).and_return false | |
@ttt.stub!(:get_square_value).and_return "X" | |
@ttt.stub!(:in_progress?).and_return true | |
render :partial => 'games/square', :locals => {:location => '3'} | |
rendered.should =~ /X/ | |
end | |
it "displays an empty square" do | |
@ttt.stub!(:square_empty?).and_return true | |
@ttt.stub!(:in_progress?).and_return true | |
render :partial => 'games/square', :locals => {:location => '3'} | |
assert_select "input", :name => "location", :value => "3" | |
end | |
it "displays empty square if game over" do | |
@ttt.stub!(:square_empty?).and_return true | |
@ttt.stub!(:in_progress?).and_return false | |
rendered.should =~ // | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment