Skip to content

Commit

Permalink
properly test localized strings with a real file
Browse files Browse the repository at this point in the history
  • Loading branch information
clayallsopp committed May 29, 2013
1 parent 5b09c3e commit 3ddb628
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
1 change: 1 addition & 0 deletions resources/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"real_key" = "Real Key";
21 changes: 5 additions & 16 deletions spec/motion/core_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,27 +54,16 @@
describe "Localized string" do

it "loads the string from NSBundle" do
key = 'fake_key'
value = 'fake_value'

bundle = NSBundle.mainBundle
def bundle.arguments; @arguments; end
def bundle.localizedStringForKey(key, value:value, table:table); @arguments = [key, value, table]; end

BubbleWrap::localized_string(key, value)
bundle.arguments.should.equal [key, value, nil]
key = 'real_key'
value = 'Real Key'

BubbleWrap::localized_string(key, value).should == value
end

it "returns the key if localization not found and no value is given" do
key = 'fake_key'
value = nil

bundle = NSBundle.mainBundle
def bundle.arguments; @arguments; end
def bundle.localizedStringForKey(key, value:value, table:table); @arguments = [key, value, table]; end

BubbleWrap::localized_string(key)
bundle.arguments.should.equal [key, key, nil]
BubbleWrap::localized_string(key).should == key
end

end
Expand Down

0 comments on commit 3ddb628

Please sign in to comment.