Last active
February 20, 2016 05:24
-
-
Save colby-swandale/f7d71ca03e12b82ec64b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class CPU | |
attr_reader :f | |
def initialize | |
@f = 0x00 | |
end | |
def instruction | |
if @f & 0x10 == 0x10 | |
# do something | |
else | |
# do something else | |
end | |
end | |
end | |
### RSPEC | |
describe CPU | |
let(:cpu) { CPU.new } | |
describe '#instruction' do | |
context 'when register state is 0x10' do | |
before { CPU.instance_variable_set "@#{f}", 0x10 } # <-- can this be improved? | |
it 'does something' | |
end | |
it 'does something else' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment