Skip to content

Instantly share code, notes, and snippets.

@coreyjs
Created October 22, 2018 15:39
Show Gist options
  • Select an option

  • Save coreyjs/752eb850cc85e0be58612da442a6e923 to your computer and use it in GitHub Desktop.

Select an option

Save coreyjs/752eb850cc85e0be58612da442a6e923 to your computer and use it in GitHub Desktop.
require 'test_helper'
class AppTest < ActiveSupport::TestCase
# 1
test "app should save with unqiue name and token" do
app1 = App.new(name: 'Hello World', token: '13456')
app2 = App.new(name: 'Goodbye World', token: 'abcdef')
assert app1.save
assert app2.save
end
# 2
test "should not save with no name" do
app = App.new()
assert_not app.save
end
# 3
test "should not save if the name is not unique" do
app1 = App.new(name: 'app', token: 'aBcDeF')
app2 = App.new(name: 'app', token: '012345')
assert app1.save
assert_not app2.save
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment