Created
October 22, 2018 15:39
-
-
Save coreyjs/752eb850cc85e0be58612da442a6e923 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
| 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