[ rspec ] basic

Rspec is one of the rails testing framework

Main File

class HelloWorld

def say_hello
"Hello World!"
end

end

Test File

describe HelloWorld do
context “When testing the HelloWorld class” do

it "should say 'Hello World' when we call the say_hello method" do
hw = HelloWorld.new
message = hw.say_hello
expect(message).to eq "Hello World!"
end

end
end

Execute in bash

rspec

Execute Describe block starts at line 545

spec spec/models/note_spec.rb:545

 

ref : https://www.tutorialspoint.com/rspec/rspec_basic_syntax.htm

, http://rspec.info/

, http://guides.rubyonrails.org/testing.html

, https://makandracards.com/makandra/736-run-a-single-example-group-in-rspec

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s